mirror of
https://github.com/morluto/rea.git
synced 2026-11-23 23:15:58 +00:00
perf(javascript): index artifact package directory lookups (#13327)
This commit is contained in:
1 parent
11a75a5c19
commit
4b86932527
6 files changed
+99
-113
No files matched your search
@@ -8,6 +8,7 @@ const paths = [
|
||||
"renderer/app.js",
|
||||
"renderer/a/app.js",
|
||||
"renderer/assets/app.js",
|
||||
"renderer/100%.js",
|
||||
"app.js",
|
||||
];
|
||||
const files = new Map<string, JavaScriptArtifactFile>(
|
||||
@@ -54,8 +55,7 @@ describe("HTML base href URL components", () => {
|
||||
);
|
||||
|
||||
it.each([
|
||||
"/assets/?cache=/wrong/",
|
||||
"/assets/#/wrong/",
|
||||
"/assets/?cache=/wrong/#/also-wrong/",
|
||||
"/assets/index.html?cache=/wrong/",
|
||||
])("ignores query and fragment path-looking characters in %s", (base) => {
|
||||
expect(resolve("app.js", base)).toMatchObject({
|
||||
@@ -76,7 +76,6 @@ describe("HTML base href URL components", () => {
|
||||
describe("HTML base href dot segments", () => {
|
||||
it.each([
|
||||
[".", "renderer/app.js"],
|
||||
["./", "renderer/app.js"],
|
||||
["a/.", "renderer/a/app.js"],
|
||||
["a/..", "renderer/app.js"],
|
||||
["..", "app.js"],
|
||||
@@ -87,7 +86,6 @@ describe("HTML base href dot segments", () => {
|
||||
});
|
||||
});
|
||||
it.each([
|
||||
["app.js/", "/assets/", "assets/app.js"],
|
||||
["app.js/.", "/assets/", "assets/app.js"],
|
||||
["?cache=1", "/assets/app.js/", "assets/app.js"],
|
||||
])(
|
||||
@@ -119,7 +117,7 @@ describe("HTML base href empty segments", () => {
|
||||
});
|
||||
});
|
||||
describe("HTML base href path syntax", () => {
|
||||
it.each(["%2e%2e/secret/", "/a/%2e%2e/", "/a\\b/", "a\0b"])(
|
||||
it.each(["/a/%2e%2e/", "/a\\b/", "a\0b"])(
|
||||
"rejects base href %j with the same admission rules a declared path gets",
|
||||
(base) => {
|
||||
const outcome = resolve("app.js", base);
|
||||
@@ -145,9 +143,7 @@ describe("HTML base href path syntax", () => {
|
||||
describe("HTML reference URL text", () => {
|
||||
it.each([
|
||||
["%61pp.js", "/assets/", "assets/app.js"],
|
||||
[" app.js ", "/assets/", "assets/app.js"],
|
||||
["\napp.js\t", "/assets/", "assets/app.js"],
|
||||
["a\npp.js", "/assets/", "assets/app.js"],
|
||||
[" \napp.\njs\t ", "/assets/", "assets/app.js"],
|
||||
["app.js", "%61/", "renderer/a/app.js"],
|
||||
["app.js", " /%61ssets/ ", "assets/app.js"],
|
||||
["/%61ssets/app.js", "", "assets/app.js"],
|
||||
@@ -160,10 +156,8 @@ describe("HTML reference URL text", () => {
|
||||
});
|
||||
it("keeps a literal percent sign that starts no escape", () => {
|
||||
expect(resolve("100%.js", "")).toMatchObject({
|
||||
resolution_status: "not-found",
|
||||
limitations: [
|
||||
"The exact HTML resource renderer/100%.js was not found among the selected application files.",
|
||||
],
|
||||
resolution_status: "resolved",
|
||||
resolved_path: "renderer/100%.js",
|
||||
});
|
||||
});
|
||||
it.each(["%00app.js", "%ff.js"])(
|
||||
@@ -195,7 +189,7 @@ describe("HTML reference URL text", () => {
|
||||
});
|
||||
},
|
||||
);
|
||||
it.each(["%2e%2e/app.js", "a%2fapp.js", "%2\ne%2\te/app.js"])(
|
||||
it.each(["a%2fapp.js", "%2\ne%2\te/app.js"])(
|
||||
"still rejects encoded dot and separator bytes in %j",
|
||||
(declared) => {
|
||||
expect(resolve(declared, "")).toMatchObject({
|
||||
|
||||
Reference in new issue
Block a user