mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
d20a379583
The substitution regex `\./(.+)/third_party/domino/bundled-domino` was used to rewrite the relative execroot path emitted by Rollup for the domino external import into `../third_party/domino/bundled-domino.mjs`.
However, `ng_package` runs `text_replace` across all generated package files, including `.map` files which are serialized on a single line. The `\./` pattern unintentionally matched the `./` inside `"../../"` in the `sources` array, and the greedy `.+` wildcard matched across the rest of `sources` and the `"sourcesContent": [` declaration up to the domino import within the first source file's content. This corrupted `init.mjs.map` and `_server-chunk.mjs.map` by destroying `sourcesContent` and populating `sources` with raw file contents.
This commit updates the substitution regex to use a negative lookbehind `(?<!\.)` to prevent matching `../` sequences, and restricts the path characters to valid filesystem path characters `[a-zA-Z0-9_./-]+` rather than `.+`.
Fixes #70625
(cherry picked from commit bc3a6cda5d)
99 lines
2.5 KiB
Python
99 lines
2.5 KiB
Python
load("@npm//:defs.bzl", "npm_link_all_packages")
|
|
load("//tools:defaults.bzl", "api_golden_test_npm_package", "generate_api_docs", "ng_package", "ng_project", "tsec_test")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
npm_link_all_packages()
|
|
|
|
ng_project(
|
|
name = "platform-server",
|
|
srcs = glob(
|
|
[
|
|
"*.ts",
|
|
"src/**/*.ts",
|
|
],
|
|
),
|
|
deps = [
|
|
"//:node_modules/@types/node",
|
|
"//:node_modules/rxjs",
|
|
"//packages/common",
|
|
"//packages/common/http",
|
|
"//packages/core",
|
|
"//packages/platform-browser",
|
|
"//packages/platform-server:node_modules/xhr2",
|
|
"//packages/platform-server/third_party/domino:bundled_domino_lib",
|
|
],
|
|
)
|
|
|
|
tsec_test(
|
|
name = "tsec_test",
|
|
target = ":platform-server",
|
|
tsconfig = "//packages:tsconfig_build",
|
|
)
|
|
|
|
ng_package(
|
|
srcs = [
|
|
"package.json",
|
|
],
|
|
externals = [
|
|
"xhr2",
|
|
"../../third_party/domino/bundled-domino",
|
|
"../third_party/domino/bundled-domino",
|
|
],
|
|
nested_packages = [
|
|
"//packages/platform-server/third_party/domino:bundled_domino_lib",
|
|
],
|
|
package = "@angular/platform-server",
|
|
side_effect_entry_points = [
|
|
"@angular/platform-server/init",
|
|
],
|
|
substitutions = {
|
|
# Needed for the FESM files.
|
|
"(?<!\\.)\\./[a-zA-Z0-9_./-]+/third_party/domino/bundled-domino": "../third_party/domino/bundled-domino.mjs",
|
|
},
|
|
tags = [
|
|
"release-with-framework",
|
|
],
|
|
# Do not add more to this list.
|
|
# Dependencies on the full npm_package cause long re-builds.
|
|
visibility = [
|
|
"//adev:__pkg__",
|
|
"//integration:__subpackages__",
|
|
"//modules/ssr-benchmarks:__subpackages__",
|
|
"//packages/compiler-cli/integrationtest:__pkg__",
|
|
],
|
|
deps = [
|
|
":platform-server",
|
|
"//packages/platform-server/init",
|
|
"//packages/platform-server/testing",
|
|
],
|
|
)
|
|
|
|
api_golden_test_npm_package(
|
|
name = "platform-server_api",
|
|
data = [
|
|
":npm_package",
|
|
"//goldens:public-api",
|
|
],
|
|
golden_dir = "goldens/public-api/platform-server",
|
|
npm_package = "packages/platform-server/npm_package",
|
|
)
|
|
|
|
filegroup(
|
|
name = "files_for_docgen",
|
|
srcs = glob([
|
|
"*.ts",
|
|
"src/**/*.ts",
|
|
]) + ["PACKAGE.md"],
|
|
)
|
|
|
|
generate_api_docs(
|
|
name = "platform-server_docs",
|
|
srcs = [
|
|
":files_for_docgen",
|
|
"//packages:common_files_and_deps_for_docs",
|
|
],
|
|
entry_point = ":index.ts",
|
|
module_name = "@angular/platform-server",
|
|
)
|