@analogjs/vite-plugin-angular 3.0.0-alpha.4 → 3.0.0-alpha.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -0
- package/migrations/migrate-setup-vitest/migrate-setup-vitest.d.ts +2 -0
- package/migrations/migrate-setup-vitest/migrate-setup-vitest.js +49 -0
- package/migrations/migrate-setup-vitest/migrate-setup-vitest.js.map +1 -0
- package/migrations/migration.json +7 -1
- package/migrations/migrations.json +9 -0
- package/migrations/update-3-0-0/migrate-setup-vitest.d.ts +2 -0
- package/migrations/update-3-0-0/migrate-setup-vitest.js +36 -0
- package/migrations/update-3-0-0/migrate-setup-vitest.js.map +1 -0
- package/package.json +25 -12
- package/src/index.d.ts +3 -2
- package/src/index.js +6 -2
- package/src/index.js.map +1 -1
- package/src/lib/angular-build-optimizer-plugin.d.ts +4 -4
- package/src/lib/angular-build-optimizer-plugin.js +48 -62
- package/src/lib/angular-build-optimizer-plugin.js.map +1 -1
- package/src/lib/angular-jit-plugin.d.ts +3 -3
- package/src/lib/angular-jit-plugin.js +42 -37
- package/src/lib/angular-jit-plugin.js.map +1 -1
- package/src/lib/angular-pending-tasks.plugin.d.ts +7 -7
- package/src/lib/angular-pending-tasks.plugin.js +17 -18
- package/src/lib/angular-pending-tasks.plugin.js.map +1 -1
- package/src/lib/angular-vite-plugin.d.ts +250 -40
- package/src/lib/angular-vite-plugin.js +2216 -964
- package/src/lib/angular-vite-plugin.js.map +1 -1
- package/src/lib/angular-vitest-plugin.d.ts +19 -15
- package/src/lib/angular-vitest-plugin.js +99 -114
- package/src/lib/angular-vitest-plugin.js.map +1 -1
- package/src/lib/compiler/angular-version.d.ts +19 -0
- package/src/lib/compiler/angular-version.js +16 -0
- package/src/lib/compiler/angular-version.js.map +1 -0
- package/src/lib/compiler/class-field-lowering.d.ts +23 -0
- package/src/lib/compiler/class-field-lowering.js +131 -0
- package/src/lib/compiler/class-field-lowering.js.map +1 -0
- package/src/lib/compiler/compile.d.ts +44 -0
- package/src/lib/compiler/compile.js +731 -0
- package/src/lib/compiler/compile.js.map +1 -0
- package/src/lib/compiler/constants.d.ts +18 -0
- package/src/lib/compiler/constants.js +52 -0
- package/src/lib/compiler/constants.js.map +1 -0
- package/src/lib/compiler/debug.d.ts +22 -0
- package/src/lib/compiler/debug.js +20 -0
- package/src/lib/compiler/debug.js.map +1 -0
- package/src/lib/compiler/defer.d.ts +47 -0
- package/src/lib/compiler/defer.js +138 -0
- package/src/lib/compiler/defer.js.map +1 -0
- package/src/lib/compiler/dts-reader.d.ts +35 -0
- package/src/lib/compiler/dts-reader.js +365 -0
- package/src/lib/compiler/dts-reader.js.map +1 -0
- package/src/lib/compiler/hmr.d.ts +16 -0
- package/src/lib/compiler/hmr.js +69 -0
- package/src/lib/compiler/hmr.js.map +1 -0
- package/src/lib/compiler/index.d.ts +7 -0
- package/src/lib/compiler/index.js +7 -0
- package/src/lib/compiler/jit-metadata.d.ts +14 -0
- package/src/lib/compiler/jit-metadata.js +146 -0
- package/src/lib/compiler/jit-metadata.js.map +1 -0
- package/src/lib/compiler/jit-transform.d.ts +24 -0
- package/src/lib/compiler/jit-transform.js +200 -0
- package/src/lib/compiler/jit-transform.js.map +1 -0
- package/src/lib/compiler/js-emitter.d.ts +10 -0
- package/src/lib/compiler/js-emitter.js +420 -0
- package/src/lib/compiler/js-emitter.js.map +1 -0
- package/src/lib/compiler/metadata.d.ts +45 -0
- package/src/lib/compiler/metadata.js +633 -0
- package/src/lib/compiler/metadata.js.map +1 -0
- package/src/lib/compiler/registry.d.ts +49 -0
- package/src/lib/compiler/registry.js +164 -0
- package/src/lib/compiler/registry.js.map +1 -0
- package/src/lib/compiler/resource-inliner.d.ts +21 -0
- package/src/lib/compiler/resource-inliner.js +152 -0
- package/src/lib/compiler/resource-inliner.js.map +1 -0
- package/src/lib/compiler/style-ast.d.ts +8 -0
- package/src/lib/compiler/style-ast.js +54 -0
- package/src/lib/compiler/style-ast.js.map +1 -0
- package/src/lib/compiler/styles.d.ts +13 -0
- package/src/lib/compiler/test-helpers.d.ts +7 -0
- package/src/lib/compiler/type-elision.d.ts +26 -0
- package/src/lib/compiler/type-elision.js +211 -0
- package/src/lib/compiler/type-elision.js.map +1 -0
- package/src/lib/compiler/utils.d.ts +10 -0
- package/src/lib/compiler/utils.js +35 -0
- package/src/lib/compiler/utils.js.map +1 -0
- package/src/lib/compiler-plugin.d.ts +11 -11
- package/src/lib/compiler-plugin.js +43 -44
- package/src/lib/compiler-plugin.js.map +1 -1
- package/src/lib/component-resolvers.d.ts +23 -5
- package/src/lib/component-resolvers.js +153 -63
- package/src/lib/component-resolvers.js.map +1 -1
- package/src/lib/fast-compile-plugin.d.ts +14 -0
- package/src/lib/fast-compile-plugin.js +270 -0
- package/src/lib/fast-compile-plugin.js.map +1 -0
- package/src/lib/host.d.ts +10 -8
- package/src/lib/host.js +113 -101
- package/src/lib/host.js.map +1 -1
- package/src/lib/live-reload-plugin.d.ts +5 -5
- package/src/lib/live-reload-plugin.js +61 -62
- package/src/lib/live-reload-plugin.js.map +1 -1
- package/src/lib/models.d.ts +9 -9
- package/src/lib/nx-folder-plugin.d.ts +5 -5
- package/src/lib/nx-folder-plugin.js +18 -16
- package/src/lib/nx-folder-plugin.js.map +1 -1
- package/src/lib/plugins/file-replacements.plugin.d.ts +4 -4
- package/src/lib/plugins/file-replacements.plugin.js +40 -62
- package/src/lib/plugins/file-replacements.plugin.js.map +1 -1
- package/src/lib/router-plugin.d.ts +1 -1
- package/src/lib/router-plugin.js +23 -23
- package/src/lib/router-plugin.js.map +1 -1
- package/src/lib/style-pipeline.d.ts +15 -0
- package/src/lib/style-pipeline.js +31 -0
- package/src/lib/style-pipeline.js.map +1 -0
- package/src/lib/style-preprocessor.d.ts +35 -0
- package/src/lib/style-preprocessor.js +35 -0
- package/src/lib/style-preprocessor.js.map +1 -0
- package/src/lib/stylesheet-registry.d.ts +73 -0
- package/src/lib/stylesheet-registry.js +168 -0
- package/src/lib/stylesheet-registry.js.map +1 -0
- package/src/lib/tools/package.json +2 -7
- package/src/lib/tools/src/builders/vite/vite-build.impl.js +31 -38
- package/src/lib/tools/src/builders/vite/vite-build.impl.js.map +1 -1
- package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js +51 -62
- package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js.map +1 -1
- package/src/lib/tools/src/index.js +0 -2
- package/src/lib/utils/compiler-plugin-options.d.ts +11 -11
- package/src/lib/utils/debug-harness.d.ts +23 -0
- package/src/lib/utils/debug-harness.js +88 -0
- package/src/lib/utils/debug-harness.js.map +1 -0
- package/src/lib/utils/debug-log-file.d.ts +5 -0
- package/src/lib/utils/debug-log-file.js +56 -0
- package/src/lib/utils/debug-log-file.js.map +1 -0
- package/src/lib/utils/debug.d.ts +28 -0
- package/src/lib/utils/debug.js +39 -0
- package/src/lib/utils/debug.js.map +1 -0
- package/src/lib/utils/devkit.d.ts +6 -6
- package/src/lib/utils/devkit.js +34 -38
- package/src/lib/utils/devkit.js.map +1 -1
- package/src/lib/utils/hmr-candidates.d.ts +28 -28
- package/src/lib/utils/plugin-config.d.ts +30 -0
- package/src/lib/utils/plugin-config.js +64 -0
- package/src/lib/utils/plugin-config.js.map +1 -0
- package/src/lib/utils/rolldown.d.ts +2 -0
- package/src/lib/utils/rolldown.js +12 -0
- package/src/lib/utils/rolldown.js.map +1 -0
- package/src/lib/utils/source-file-cache.d.ts +8 -15
- package/src/lib/utils/source-file-cache.js +35 -37
- package/src/lib/utils/source-file-cache.js.map +1 -1
- package/src/lib/utils/tailwind-reference.d.ts +12 -0
- package/src/lib/utils/tailwind-reference.js +99 -0
- package/src/lib/utils/tailwind-reference.js.map +1 -0
- package/src/lib/utils/virtual-ids.d.ts +8 -0
- package/src/lib/utils/virtual-ids.js +35 -0
- package/src/lib/utils/virtual-ids.js.map +1 -0
- package/src/lib/utils/virtual-resources.d.ts +47 -0
- package/src/lib/utils/virtual-resources.js +89 -0
- package/src/lib/utils/virtual-resources.js.map +1 -0
- package/src/test-setup.d.ts +2 -0
- package/setup-vitest.d.ts +0 -4
- package/setup-vitest.js +0 -215
- package/setup-vitest.js.map +0 -1
- package/src/lib/models.js +0 -1
- package/src/lib/models.js.map +0 -1
- package/src/lib/tools/README.md +0 -3
- package/src/lib/tools/src/index.d.ts +0 -0
- package/src/lib/tools/src/index.js.map +0 -1
- package/src/lib/utils/compiler-plugin-options.js +0 -1
- package/src/lib/utils/compiler-plugin-options.js.map +0 -1
- package/src/lib/utils/hmr-candidates.js +0 -272
- package/src/lib/utils/hmr-candidates.js.map +0 -1
|
@@ -1,64 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
import { isAbsolute, resolve } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const foundReplace = mappedReplacements.find((replacement) => resolved?.id?.endsWith(replacement.replace));
|
|
39
|
-
if (foundReplace) {
|
|
40
|
-
try {
|
|
41
|
-
if (this.environment.name === 'ssr' && foundReplace.ssr) {
|
|
42
|
-
// return new file id for ssr
|
|
43
|
-
return {
|
|
44
|
-
id: foundReplace.ssr,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
else if (foundReplace.ssr) {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
// return new file id
|
|
51
|
-
return {
|
|
52
|
-
id: foundReplace.with,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
catch (err) {
|
|
56
|
-
console.error(err);
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return null;
|
|
61
|
-
},
|
|
62
|
-
};
|
|
1
|
+
import { debugCompiler } from "../utils/debug.js";
|
|
2
|
+
import { isAbsolute, resolve } from "node:path";
|
|
3
|
+
//#region packages/vite-plugin-angular/src/lib/plugins/file-replacements.plugin.ts
|
|
4
|
+
function replaceFiles(replacements, workspaceRoot) {
|
|
5
|
+
if (!replacements?.length) return false;
|
|
6
|
+
return {
|
|
7
|
+
name: "rollup-plugin-replace-files",
|
|
8
|
+
enforce: "pre",
|
|
9
|
+
async resolveId(source, importer, options) {
|
|
10
|
+
const resolved = await this.resolve(source, importer, {
|
|
11
|
+
...options,
|
|
12
|
+
skipSelf: true
|
|
13
|
+
});
|
|
14
|
+
const foundReplace = replacements.map((fr) => {
|
|
15
|
+
const frSSR = fr;
|
|
16
|
+
const frWith = fr;
|
|
17
|
+
return {
|
|
18
|
+
...fr,
|
|
19
|
+
ssr: frSSR.ssr ? isAbsolute(frSSR.ssr) ? frSSR.ssr : resolve(workspaceRoot, frSSR.ssr) : "",
|
|
20
|
+
with: frWith.with ? isAbsolute(frWith.with) ? frWith.with : resolve(workspaceRoot, frWith.with) : ""
|
|
21
|
+
};
|
|
22
|
+
}).find((replacement) => resolved?.id?.endsWith(replacement.replace));
|
|
23
|
+
if (foundReplace) try {
|
|
24
|
+
if (this.environment.name === "ssr" && foundReplace.ssr) return { id: foundReplace.ssr };
|
|
25
|
+
else if (foundReplace.ssr) return null;
|
|
26
|
+
return { id: foundReplace.with };
|
|
27
|
+
} catch (err) {
|
|
28
|
+
debugCompiler("file replacement error", {
|
|
29
|
+
error: String(err),
|
|
30
|
+
source,
|
|
31
|
+
importer
|
|
32
|
+
});
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
63
38
|
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { replaceFiles };
|
|
41
|
+
|
|
64
42
|
//# sourceMappingURL=file-replacements.plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-replacements.plugin.js","
|
|
1
|
+
{"version":3,"file":"file-replacements.plugin.js","names":[],"sources":["../../../../src/lib/plugins/file-replacements.plugin.ts"],"sourcesContent":["// source: https://github.com/Myrmod/vitejs-theming/blob/master/build-plugins/rollup/replace-files.js\nimport { isAbsolute, resolve } from 'node:path';\nimport { Plugin } from 'vite';\nimport { debugCompiler } from '../utils/debug.js';\n\nexport function replaceFiles(\n replacements: FileReplacement[],\n workspaceRoot: string,\n): Plugin | false {\n if (!replacements?.length) {\n return false;\n }\n\n return {\n name: 'rollup-plugin-replace-files',\n enforce: 'pre',\n async resolveId(source, importer, options) {\n const resolved = await this.resolve(source, importer, {\n ...options,\n skipSelf: true,\n });\n /**\n * The reason we're using endsWith here is because the resolved id\n * will be the absolute path to the file. We want to check if the\n * file ends with the file we're trying to replace, which will be essentially\n * the path from the root of our workspace.\n */\n const mappedReplacements = replacements.map((fr: FileReplacement) => {\n const frSSR = fr as FileReplacementSSR;\n const frWith = fr as FileReplacementWith;\n\n return {\n ...fr,\n ssr: frSSR.ssr\n ? isAbsolute(frSSR.ssr)\n ? frSSR.ssr\n : resolve(workspaceRoot, frSSR.ssr)\n : '',\n with: frWith.with\n ? isAbsolute(frWith.with)\n ? frWith.with\n : resolve(workspaceRoot, frWith.with)\n : '',\n };\n });\n const foundReplace = mappedReplacements.find((replacement) =>\n resolved?.id?.endsWith(replacement.replace),\n );\n if (foundReplace) {\n try {\n if (this.environment.name === 'ssr' && foundReplace.ssr) {\n // return new file id for ssr\n return {\n id: foundReplace.ssr,\n };\n } else if (foundReplace.ssr) {\n return null;\n }\n\n // return new file id\n return {\n id: foundReplace.with,\n };\n } catch (err) {\n debugCompiler('file replacement error', {\n error: String(err),\n source,\n importer,\n });\n return null;\n }\n }\n return null;\n },\n };\n}\n\nexport type FileReplacement = FileReplacementWith | FileReplacementSSR;\n\nexport interface FileReplacementBase {\n replace: string;\n}\nexport interface FileReplacementWith extends FileReplacementBase {\n with: string;\n}\n\nexport interface FileReplacementSSR extends FileReplacementBase {\n ssr: string;\n}\n"],"mappings":";;;AAKA,SAAgB,aACd,cACA,eACgB;AAChB,KAAI,CAAC,cAAc,OACjB,QAAO;AAGT,QAAO;EACL,MAAM;EACN,SAAS;EACT,MAAM,UAAU,QAAQ,UAAU,SAAS;GACzC,MAAM,WAAW,MAAM,KAAK,QAAQ,QAAQ,UAAU;IACpD,GAAG;IACH,UAAU;IACX,CAAC;GAyBF,MAAM,eAlBqB,aAAa,KAAK,OAAwB;IACnE,MAAM,QAAQ;IACd,MAAM,SAAS;AAEf,WAAO;KACL,GAAG;KACH,KAAK,MAAM,MACP,WAAW,MAAM,IAAI,GACnB,MAAM,MACN,QAAQ,eAAe,MAAM,IAAI,GACnC;KACJ,MAAM,OAAO,OACT,WAAW,OAAO,KAAK,GACrB,OAAO,OACP,QAAQ,eAAe,OAAO,KAAK,GACrC;KACL;KACD,CACsC,MAAM,gBAC5C,UAAU,IAAI,SAAS,YAAY,QAAQ,CAC5C;AACD,OAAI,aACF,KAAI;AACF,QAAI,KAAK,YAAY,SAAS,SAAS,aAAa,IAElD,QAAO,EACL,IAAI,aAAa,KAClB;aACQ,aAAa,IACtB,QAAO;AAIT,WAAO,EACL,IAAI,aAAa,MAClB;YACM,KAAK;AACZ,kBAAc,0BAA0B;KACtC,OAAO,OAAO,IAAI;KAClB;KACA;KACD,CAAC;AACF,WAAO;;AAGX,UAAO;;EAEV"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Plugin } from
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
2
|
export declare function routerPlugin(): Plugin;
|
package/src/lib/router-plugin.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
};
|
|
1
|
+
import { jt } from "./utils/devkit.js";
|
|
2
|
+
//#region packages/vite-plugin-angular/src/lib/router-plugin.ts
|
|
3
|
+
function routerPlugin() {
|
|
4
|
+
const javascriptTransformer = new jt({ jit: true }, 1);
|
|
5
|
+
/**
|
|
6
|
+
* Transforms Angular packages the didn't get picked up by Vite's pre-optimization.
|
|
7
|
+
*/
|
|
8
|
+
return {
|
|
9
|
+
name: "analogjs-router-optimization",
|
|
10
|
+
enforce: "pre",
|
|
11
|
+
apply: "serve",
|
|
12
|
+
transform: {
|
|
13
|
+
filter: { id: /fesm(.*?)\.mjs/ },
|
|
14
|
+
async handler(_code, id) {
|
|
15
|
+
const path = id.split("?")[0];
|
|
16
|
+
const contents = await javascriptTransformer.transformFile(path);
|
|
17
|
+
return { code: Buffer.from(contents).toString("utf-8") };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
24
21
|
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { routerPlugin };
|
|
24
|
+
|
|
25
25
|
//# sourceMappingURL=router-plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router-plugin.js","
|
|
1
|
+
{"version":3,"file":"router-plugin.js","names":[],"sources":["../../../src/lib/router-plugin.ts"],"sourcesContent":["import type { Plugin } from 'vite';\nimport { JavaScriptTransformer } from './utils/devkit.js';\n\nexport function routerPlugin(): Plugin {\n const javascriptTransformer = new JavaScriptTransformer({ jit: true }, 1);\n\n /**\n * Transforms Angular packages the didn't get picked up by Vite's pre-optimization.\n */\n return {\n name: 'analogjs-router-optimization',\n enforce: 'pre',\n apply: 'serve',\n transform: {\n filter: {\n id: /fesm(.*?)\\.mjs/,\n },\n async handler(_code: string, id: string) {\n const path = id.split('?')[0];\n const contents = await javascriptTransformer.transformFile(path);\n\n return {\n code: Buffer.from(contents).toString('utf-8'),\n };\n },\n },\n };\n}\n"],"mappings":";;AAGA,SAAgB,eAAuB;CACrC,MAAM,wBAAwB,IAAI,GAAsB,EAAE,KAAK,MAAM,EAAE,EAAE;;;;AAKzE,QAAO;EACL,MAAM;EACN,SAAS;EACT,OAAO;EACP,WAAW;GACT,QAAQ,EACN,IAAI,kBACL;GACD,MAAM,QAAQ,OAAe,IAAY;IACvC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC;IAC3B,MAAM,WAAW,MAAM,sBAAsB,cAAc,KAAK;AAEhE,WAAO,EACL,MAAM,OAAO,KAAK,SAAS,CAAC,SAAS,QAAQ,EAC9C;;GAEJ;EACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AnalogStylesheetRegistry } from "./stylesheet-registry.js";
|
|
2
|
+
import type { StylePipelineStylesheetRegistry, StylePreprocessor, StylesheetTransformContext, StylesheetTransformResult } from "./style-preprocessor.js";
|
|
3
|
+
export interface AngularStylePipelineContext {
|
|
4
|
+
workspaceRoot: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AngularStylePipelinePlugin {
|
|
7
|
+
name: string;
|
|
8
|
+
preprocessStylesheet?: (code: string, context: StylesheetTransformContext) => string | StylesheetTransformResult | undefined;
|
|
9
|
+
configureStylesheetRegistry?: (registry: StylePipelineStylesheetRegistry, context: AngularStylePipelineContext) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface AngularStylePipelineOptions {
|
|
12
|
+
plugins: AngularStylePipelinePlugin[];
|
|
13
|
+
}
|
|
14
|
+
export declare function stylePipelinePreprocessorFromPlugins(options: AngularStylePipelineOptions | undefined): StylePreprocessor | undefined;
|
|
15
|
+
export declare function configureStylePipelineRegistry(options: AngularStylePipelineOptions | undefined, registry: AnalogStylesheetRegistry, context: AngularStylePipelineContext): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { debugStylePipeline } from "./utils/debug.js";
|
|
2
|
+
import { normalizeStylesheetTransformResult } from "./style-preprocessor.js";
|
|
3
|
+
//#region packages/vite-plugin-angular/src/lib/style-pipeline.ts
|
|
4
|
+
function stylePipelinePreprocessorFromPlugins(options) {
|
|
5
|
+
const preprocessors = options?.plugins.map((plugin) => plugin.preprocessStylesheet).filter((preprocessor) => !!preprocessor) ?? [];
|
|
6
|
+
if (!preprocessors.length) return;
|
|
7
|
+
return (code, filename, context) => {
|
|
8
|
+
if (!context) {
|
|
9
|
+
debugStylePipeline("skipping community stylesheet preprocessors because Angular did not provide a stylesheet context", { filename });
|
|
10
|
+
return code;
|
|
11
|
+
}
|
|
12
|
+
let current = normalizeStylesheetTransformResult(void 0, code);
|
|
13
|
+
for (const preprocess of preprocessors) {
|
|
14
|
+
const next = normalizeStylesheetTransformResult(preprocess(current.code, context), current.code);
|
|
15
|
+
current = {
|
|
16
|
+
code: next.code,
|
|
17
|
+
dependencies: [...current.dependencies ?? [], ...next.dependencies ?? []],
|
|
18
|
+
diagnostics: [...current.diagnostics ?? [], ...next.diagnostics ?? []],
|
|
19
|
+
tags: [...current.tags ?? [], ...next.tags ?? []]
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return current;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function configureStylePipelineRegistry(options, registry, context) {
|
|
26
|
+
for (const plugin of options?.plugins ?? []) plugin.configureStylesheetRegistry?.(registry, context);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { configureStylePipelineRegistry, stylePipelinePreprocessorFromPlugins };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=style-pipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-pipeline.js","names":[],"sources":["../../../src/lib/style-pipeline.ts"],"sourcesContent":["import type { AnalogStylesheetRegistry } from './stylesheet-registry.js';\nimport type {\n StylePipelineStylesheetRegistry,\n StylePreprocessor,\n StylesheetTransformContext,\n StylesheetTransformResult,\n} from './style-preprocessor.js';\nimport { normalizeStylesheetTransformResult } from './style-preprocessor.js';\nimport { debugStylePipeline } from './utils/debug.js';\n\nexport interface AngularStylePipelineContext {\n workspaceRoot: string;\n}\n\nexport interface AngularStylePipelinePlugin {\n name: string;\n preprocessStylesheet?: (\n code: string,\n context: StylesheetTransformContext,\n ) => string | StylesheetTransformResult | undefined;\n configureStylesheetRegistry?: (\n registry: StylePipelineStylesheetRegistry,\n context: AngularStylePipelineContext,\n ) => void;\n}\n\nexport interface AngularStylePipelineOptions {\n plugins: AngularStylePipelinePlugin[];\n}\n\nexport function stylePipelinePreprocessorFromPlugins(\n options: AngularStylePipelineOptions | undefined,\n): StylePreprocessor | undefined {\n const preprocessors =\n options?.plugins\n .map((plugin) => plugin.preprocessStylesheet)\n .filter((preprocessor) => !!preprocessor) ?? [];\n\n if (!preprocessors.length) {\n return undefined;\n }\n\n return (code, filename, context) => {\n if (!context) {\n debugStylePipeline(\n 'skipping community stylesheet preprocessors because Angular did not provide a stylesheet context',\n {\n filename,\n },\n );\n return code;\n }\n\n let current = normalizeStylesheetTransformResult(undefined, code);\n for (const preprocess of preprocessors) {\n const next = normalizeStylesheetTransformResult(\n preprocess(current.code, context),\n current.code,\n );\n current = {\n code: next.code,\n dependencies: [\n ...(current.dependencies ?? []),\n ...(next.dependencies ?? []),\n ],\n diagnostics: [\n ...(current.diagnostics ?? []),\n ...(next.diagnostics ?? []),\n ],\n tags: [...(current.tags ?? []), ...(next.tags ?? [])],\n };\n }\n\n return current;\n };\n}\n\nexport function configureStylePipelineRegistry(\n options: AngularStylePipelineOptions | undefined,\n registry: AnalogStylesheetRegistry,\n context: AngularStylePipelineContext,\n): void {\n for (const plugin of options?.plugins ?? []) {\n plugin.configureStylesheetRegistry?.(registry, context);\n }\n}\n"],"mappings":";;;AA8BA,SAAgB,qCACd,SAC+B;CAC/B,MAAM,gBACJ,SAAS,QACN,KAAK,WAAW,OAAO,qBAAqB,CAC5C,QAAQ,iBAAiB,CAAC,CAAC,aAAa,IAAI,EAAE;AAEnD,KAAI,CAAC,cAAc,OACjB;AAGF,SAAQ,MAAM,UAAU,YAAY;AAClC,MAAI,CAAC,SAAS;AACZ,sBACE,oGACA,EACE,UACD,CACF;AACD,UAAO;;EAGT,IAAI,UAAU,mCAAmC,KAAA,GAAW,KAAK;AACjE,OAAK,MAAM,cAAc,eAAe;GACtC,MAAM,OAAO,mCACX,WAAW,QAAQ,MAAM,QAAQ,EACjC,QAAQ,KACT;AACD,aAAU;IACR,MAAM,KAAK;IACX,cAAc,CACZ,GAAI,QAAQ,gBAAgB,EAAE,EAC9B,GAAI,KAAK,gBAAgB,EAAE,CAC5B;IACD,aAAa,CACX,GAAI,QAAQ,eAAe,EAAE,EAC7B,GAAI,KAAK,eAAe,EAAE,CAC3B;IACD,MAAM,CAAC,GAAI,QAAQ,QAAQ,EAAE,EAAG,GAAI,KAAK,QAAQ,EAAE,CAAE;IACtD;;AAGH,SAAO;;;AAIX,SAAgB,+BACd,SACA,UACA,SACM;AACN,MAAK,MAAM,UAAU,SAAS,WAAW,EAAE,CACzC,QAAO,8BAA8B,UAAU,QAAQ"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface StylesheetTransformContext {
|
|
2
|
+
filename: string;
|
|
3
|
+
containingFile?: string;
|
|
4
|
+
resourceFile?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
order?: number;
|
|
7
|
+
inline: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface StylesheetDependency {
|
|
10
|
+
id: string;
|
|
11
|
+
kind?: "file" | "virtual" | "token" | "bridge" | "manifest" | "runtime";
|
|
12
|
+
owner?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface StylesheetDiagnostic {
|
|
15
|
+
severity: "warning" | "error";
|
|
16
|
+
code: string;
|
|
17
|
+
message: string;
|
|
18
|
+
}
|
|
19
|
+
export interface StylesheetTransformResult {
|
|
20
|
+
code: string;
|
|
21
|
+
dependencies?: Array<string | StylesheetDependency>;
|
|
22
|
+
diagnostics?: StylesheetDiagnostic[];
|
|
23
|
+
tags?: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface StylePipelineStylesheetRegistry {
|
|
26
|
+
getPublicIdsForSource(sourcePath: string): string[];
|
|
27
|
+
getRequestIdsForSource(sourcePath: string): string[];
|
|
28
|
+
getDependenciesForSource(sourcePath: string): StylesheetDependency[];
|
|
29
|
+
getDiagnosticsForSource(sourcePath: string): StylesheetDiagnostic[];
|
|
30
|
+
getTagsForSource(sourcePath: string): string[];
|
|
31
|
+
}
|
|
32
|
+
export type StylePreprocessor = (code: string, filename: string, context?: StylesheetTransformContext) => string | StylesheetTransformResult;
|
|
33
|
+
export declare function normalizeStylesheetTransformResult(value: string | StylesheetTransformResult | undefined, fallbackCode: string): StylesheetTransformResult;
|
|
34
|
+
export declare function normalizeStylesheetDependencies(dependencies: Array<string | StylesheetDependency> | undefined): StylesheetDependency[];
|
|
35
|
+
export declare function composeStylePreprocessors(preprocessors: Array<StylePreprocessor | false | null | undefined>): StylePreprocessor | undefined;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region packages/vite-plugin-angular/src/lib/style-preprocessor.ts
|
|
2
|
+
function normalizeStylesheetTransformResult(value, fallbackCode) {
|
|
3
|
+
if (value == null) return { code: fallbackCode };
|
|
4
|
+
if (typeof value === "string") return { code: value };
|
|
5
|
+
return {
|
|
6
|
+
code: value.code ?? fallbackCode,
|
|
7
|
+
dependencies: normalizeStylesheetDependencies(value.dependencies),
|
|
8
|
+
diagnostics: value.diagnostics ?? [],
|
|
9
|
+
tags: value.tags ?? []
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function normalizeStylesheetDependencies(dependencies) {
|
|
13
|
+
return (dependencies ?? []).map((dependency) => typeof dependency === "string" ? { id: dependency } : dependency);
|
|
14
|
+
}
|
|
15
|
+
function composeStylePreprocessors(preprocessors) {
|
|
16
|
+
const active = preprocessors.filter((preprocessor) => !!preprocessor);
|
|
17
|
+
if (!active.length) return;
|
|
18
|
+
return (code, filename, context) => {
|
|
19
|
+
let current = normalizeStylesheetTransformResult(void 0, code);
|
|
20
|
+
for (const preprocessor of active) {
|
|
21
|
+
const next = normalizeStylesheetTransformResult(preprocessor(current.code, filename, context), current.code);
|
|
22
|
+
current = {
|
|
23
|
+
code: next.code,
|
|
24
|
+
dependencies: [...current.dependencies ?? [], ...next.dependencies ?? []],
|
|
25
|
+
diagnostics: [...current.diagnostics ?? [], ...next.diagnostics ?? []],
|
|
26
|
+
tags: [...current.tags ?? [], ...next.tags ?? []]
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return current;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { composeStylePreprocessors, normalizeStylesheetDependencies, normalizeStylesheetTransformResult };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=style-preprocessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-preprocessor.js","names":[],"sources":["../../../src/lib/style-preprocessor.ts"],"sourcesContent":["export interface StylesheetTransformContext {\n filename: string;\n containingFile?: string;\n resourceFile?: string;\n className?: string;\n order?: number;\n inline: boolean;\n}\n\nexport interface StylesheetDependency {\n id: string;\n kind?: 'file' | 'virtual' | 'token' | 'bridge' | 'manifest' | 'runtime';\n owner?: string;\n}\n\nexport interface StylesheetDiagnostic {\n severity: 'warning' | 'error';\n code: string;\n message: string;\n}\n\nexport interface StylesheetTransformResult {\n code: string;\n dependencies?: Array<string | StylesheetDependency>;\n diagnostics?: StylesheetDiagnostic[];\n tags?: string[];\n}\n\nexport interface StylePipelineStylesheetRegistry {\n getPublicIdsForSource(sourcePath: string): string[];\n getRequestIdsForSource(sourcePath: string): string[];\n getDependenciesForSource(sourcePath: string): StylesheetDependency[];\n getDiagnosticsForSource(sourcePath: string): StylesheetDiagnostic[];\n getTagsForSource(sourcePath: string): string[];\n}\n\nexport type StylePreprocessor = (\n code: string,\n filename: string,\n context?: StylesheetTransformContext,\n) => string | StylesheetTransformResult;\n\nexport function normalizeStylesheetTransformResult(\n value: string | StylesheetTransformResult | undefined,\n fallbackCode: string,\n): StylesheetTransformResult {\n if (value == null) {\n return { code: fallbackCode };\n }\n\n if (typeof value === 'string') {\n return { code: value };\n }\n\n return {\n code: value.code ?? fallbackCode,\n dependencies: normalizeStylesheetDependencies(value.dependencies),\n diagnostics: value.diagnostics ?? [],\n tags: value.tags ?? [],\n };\n}\n\nexport function normalizeStylesheetDependencies(\n dependencies: Array<string | StylesheetDependency> | undefined,\n): StylesheetDependency[] {\n return (dependencies ?? []).map((dependency) =>\n typeof dependency === 'string' ? { id: dependency } : dependency,\n );\n}\n\nexport function composeStylePreprocessors(\n preprocessors: Array<StylePreprocessor | false | null | undefined>,\n): StylePreprocessor | undefined {\n const active = preprocessors.filter(\n (preprocessor): preprocessor is StylePreprocessor => !!preprocessor,\n );\n\n if (!active.length) {\n return undefined;\n }\n\n return (code, filename, context) => {\n let current = normalizeStylesheetTransformResult(undefined, code);\n\n for (const preprocessor of active) {\n const next = normalizeStylesheetTransformResult(\n preprocessor(current.code, filename, context),\n current.code,\n );\n current = {\n code: next.code,\n dependencies: [\n ...(current.dependencies ?? []),\n ...(next.dependencies ?? []),\n ],\n diagnostics: [\n ...(current.diagnostics ?? []),\n ...(next.diagnostics ?? []),\n ],\n tags: [...(current.tags ?? []), ...(next.tags ?? [])],\n };\n }\n\n return current;\n };\n}\n"],"mappings":";AA0CA,SAAgB,mCACd,OACA,cAC2B;AAC3B,KAAI,SAAS,KACX,QAAO,EAAE,MAAM,cAAc;AAG/B,KAAI,OAAO,UAAU,SACnB,QAAO,EAAE,MAAM,OAAO;AAGxB,QAAO;EACL,MAAM,MAAM,QAAQ;EACpB,cAAc,gCAAgC,MAAM,aAAa;EACjE,aAAa,MAAM,eAAe,EAAE;EACpC,MAAM,MAAM,QAAQ,EAAE;EACvB;;AAGH,SAAgB,gCACd,cACwB;AACxB,SAAQ,gBAAgB,EAAE,EAAE,KAAK,eAC/B,OAAO,eAAe,WAAW,EAAE,IAAI,YAAY,GAAG,WACvD;;AAGH,SAAgB,0BACd,eAC+B;CAC/B,MAAM,SAAS,cAAc,QAC1B,iBAAoD,CAAC,CAAC,aACxD;AAED,KAAI,CAAC,OAAO,OACV;AAGF,SAAQ,MAAM,UAAU,YAAY;EAClC,IAAI,UAAU,mCAAmC,KAAA,GAAW,KAAK;AAEjE,OAAK,MAAM,gBAAgB,QAAQ;GACjC,MAAM,OAAO,mCACX,aAAa,QAAQ,MAAM,UAAU,QAAQ,EAC7C,QAAQ,KACT;AACD,aAAU;IACR,MAAM,KAAK;IACX,cAAc,CACZ,GAAI,QAAQ,gBAAgB,EAAE,EAC9B,GAAI,KAAK,gBAAgB,EAAE,CAC5B;IACD,aAAa,CACX,GAAI,QAAQ,eAAe,EAAE,EAC7B,GAAI,KAAK,eAAe,EAAE,CAC3B;IACD,MAAM,CAAC,GAAI,QAAQ,QAAQ,EAAE,EAAG,GAAI,KAAK,QAAQ,EAAE,CAAE;IACtD;;AAGH,SAAO"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { StylePreprocessor, StylesheetDependency, StylesheetDiagnostic, StylesheetTransformResult, StylesheetTransformContext } from "./style-preprocessor.js";
|
|
2
|
+
export interface AnalogStylesheetRecord {
|
|
3
|
+
publicId: string;
|
|
4
|
+
sourcePath?: string;
|
|
5
|
+
originalCode?: string;
|
|
6
|
+
normalizedCode: string;
|
|
7
|
+
dependencies?: StylesheetDependency[];
|
|
8
|
+
diagnostics?: StylesheetDiagnostic[];
|
|
9
|
+
tags?: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare class AnalogStylesheetRegistry {
|
|
12
|
+
private servedById;
|
|
13
|
+
private servedAliasToId;
|
|
14
|
+
private externalRequestToSource;
|
|
15
|
+
/**
|
|
16
|
+
* Maps a real source stylesheet path back to the generated public stylesheet
|
|
17
|
+
* ids Analog serves for Angular. This is stable across requests and lets HMR
|
|
18
|
+
* reason about "which virtual stylesheet came from this source file?"
|
|
19
|
+
*/
|
|
20
|
+
private sourceToPublicIds;
|
|
21
|
+
/**
|
|
22
|
+
* Tracks the live request ids Vite/Angular have actually served for a source
|
|
23
|
+
* stylesheet, including both `?direct&ngcomp=...` CSS modules and
|
|
24
|
+
* `?ngcomp=...` JS wrapper modules. HMR must use these live request ids
|
|
25
|
+
* because Angular component styles are no longer addressed by their original
|
|
26
|
+
* file paths once externalized.
|
|
27
|
+
*/
|
|
28
|
+
private sourceToRequestIds;
|
|
29
|
+
private sourceToDependencies;
|
|
30
|
+
private sourceToDiagnostics;
|
|
31
|
+
private sourceToTags;
|
|
32
|
+
/**
|
|
33
|
+
* Canonicalizes browser-facing stylesheet request ids so Vite timestamp
|
|
34
|
+
* variants (`?t=...`) and path-shape variants (`abc.css?...` vs
|
|
35
|
+
* `/abc.css?...`) all collapse onto one logical module identity.
|
|
36
|
+
*
|
|
37
|
+
* This is critical for Angular component stylesheet HMR because the browser
|
|
38
|
+
* can keep both timestamped and non-timestamped requests alive for the same
|
|
39
|
+
* externalized stylesheet. If Analog tracks them as distinct resources, HMR
|
|
40
|
+
* can update one module while the browser continues rendering another stale
|
|
41
|
+
* module for the same public stylesheet id.
|
|
42
|
+
*/
|
|
43
|
+
private normalizeRequestId;
|
|
44
|
+
get servedCount(): number;
|
|
45
|
+
get externalCount(): number;
|
|
46
|
+
hasServed(requestId: string): boolean;
|
|
47
|
+
getServedContent(requestId: string): string | undefined;
|
|
48
|
+
resolveExternalSource(requestId: string): string | undefined;
|
|
49
|
+
getPublicIdsForSource(sourcePath: string): string[];
|
|
50
|
+
getRequestIdsForSource(sourcePath: string): string[];
|
|
51
|
+
getDependenciesForSource(sourcePath: string): StylesheetDependency[];
|
|
52
|
+
getDiagnosticsForSource(sourcePath: string): StylesheetDiagnostic[];
|
|
53
|
+
getTagsForSource(sourcePath: string): string[];
|
|
54
|
+
registerExternalRequest(requestId: string, sourcePath: string): void;
|
|
55
|
+
registerActiveRequest(requestId: string): void;
|
|
56
|
+
registerServedStylesheet(record: AnalogStylesheetRecord, aliases?: string[]): void;
|
|
57
|
+
private recomputeSourceMetadata;
|
|
58
|
+
private resolveServedRecord;
|
|
59
|
+
}
|
|
60
|
+
export declare function preprocessStylesheet(code: string, filename: string, stylePreprocessor?: StylePreprocessor, context?: StylesheetTransformContext): string;
|
|
61
|
+
export declare function preprocessStylesheetResult(code: string, filename: string, stylePreprocessor?: StylePreprocessor, context?: StylesheetTransformContext): StylesheetTransformResult;
|
|
62
|
+
export declare function rewriteRelativeCssImports(code: string, filename: string): string;
|
|
63
|
+
export declare function registerStylesheetContent(registry: AnalogStylesheetRegistry, { code, dependencies, diagnostics, tags, containingFile, className, order, inlineStylesExtension, resourceFile }: {
|
|
64
|
+
code: string;
|
|
65
|
+
dependencies?: StylesheetDependency[];
|
|
66
|
+
diagnostics?: StylesheetDiagnostic[];
|
|
67
|
+
tags?: string[];
|
|
68
|
+
containingFile: string;
|
|
69
|
+
className?: string;
|
|
70
|
+
order?: number;
|
|
71
|
+
inlineStylesExtension: string;
|
|
72
|
+
resourceFile?: string;
|
|
73
|
+
}): string;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { normalizeStylesheetTransformResult } from "./style-preprocessor.js";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { dirname, normalize, resolve } from "node:path";
|
|
4
|
+
import { normalizePath } from "vite";
|
|
5
|
+
//#region packages/vite-plugin-angular/src/lib/stylesheet-registry.ts
|
|
6
|
+
var AnalogStylesheetRegistry = class {
|
|
7
|
+
servedById = /* @__PURE__ */ new Map();
|
|
8
|
+
servedAliasToId = /* @__PURE__ */ new Map();
|
|
9
|
+
externalRequestToSource = /* @__PURE__ */ new Map();
|
|
10
|
+
/**
|
|
11
|
+
* Maps a real source stylesheet path back to the generated public stylesheet
|
|
12
|
+
* ids Analog serves for Angular. This is stable across requests and lets HMR
|
|
13
|
+
* reason about "which virtual stylesheet came from this source file?"
|
|
14
|
+
*/
|
|
15
|
+
sourceToPublicIds = /* @__PURE__ */ new Map();
|
|
16
|
+
/**
|
|
17
|
+
* Tracks the live request ids Vite/Angular have actually served for a source
|
|
18
|
+
* stylesheet, including both `?direct&ngcomp=...` CSS modules and
|
|
19
|
+
* `?ngcomp=...` JS wrapper modules. HMR must use these live request ids
|
|
20
|
+
* because Angular component styles are no longer addressed by their original
|
|
21
|
+
* file paths once externalized.
|
|
22
|
+
*/
|
|
23
|
+
sourceToRequestIds = /* @__PURE__ */ new Map();
|
|
24
|
+
sourceToDependencies = /* @__PURE__ */ new Map();
|
|
25
|
+
sourceToDiagnostics = /* @__PURE__ */ new Map();
|
|
26
|
+
sourceToTags = /* @__PURE__ */ new Map();
|
|
27
|
+
/**
|
|
28
|
+
* Canonicalizes browser-facing stylesheet request ids so Vite timestamp
|
|
29
|
+
* variants (`?t=...`) and path-shape variants (`abc.css?...` vs
|
|
30
|
+
* `/abc.css?...`) all collapse onto one logical module identity.
|
|
31
|
+
*
|
|
32
|
+
* This is critical for Angular component stylesheet HMR because the browser
|
|
33
|
+
* can keep both timestamped and non-timestamped requests alive for the same
|
|
34
|
+
* externalized stylesheet. If Analog tracks them as distinct resources, HMR
|
|
35
|
+
* can update one module while the browser continues rendering another stale
|
|
36
|
+
* module for the same public stylesheet id.
|
|
37
|
+
*/
|
|
38
|
+
normalizeRequestId(requestId) {
|
|
39
|
+
const [rawPathname, rawSearch = ""] = requestId.split("?");
|
|
40
|
+
const normalizedPathname = rawPathname.replace(/^\//, "");
|
|
41
|
+
if (!rawSearch) return normalizedPathname;
|
|
42
|
+
const normalizedSearch = rawSearch.split("&").filter((segment) => segment.length > 0).filter((segment) => {
|
|
43
|
+
const [key] = segment.split("=");
|
|
44
|
+
return key !== "t";
|
|
45
|
+
}).join("&");
|
|
46
|
+
return normalizedSearch ? `${normalizedPathname}?${normalizedSearch}` : normalizedPathname;
|
|
47
|
+
}
|
|
48
|
+
get servedCount() {
|
|
49
|
+
return this.servedById.size;
|
|
50
|
+
}
|
|
51
|
+
get externalCount() {
|
|
52
|
+
return this.externalRequestToSource.size;
|
|
53
|
+
}
|
|
54
|
+
hasServed(requestId) {
|
|
55
|
+
return this.resolveServedRecord(requestId) !== void 0;
|
|
56
|
+
}
|
|
57
|
+
getServedContent(requestId) {
|
|
58
|
+
return this.resolveServedRecord(requestId)?.normalizedCode;
|
|
59
|
+
}
|
|
60
|
+
resolveExternalSource(requestId) {
|
|
61
|
+
const normalizedRequestId = this.normalizeRequestId(requestId);
|
|
62
|
+
return this.externalRequestToSource.get(normalizedRequestId);
|
|
63
|
+
}
|
|
64
|
+
getPublicIdsForSource(sourcePath) {
|
|
65
|
+
return [...this.sourceToPublicIds.get(sourcePath) ?? []];
|
|
66
|
+
}
|
|
67
|
+
getRequestIdsForSource(sourcePath) {
|
|
68
|
+
return [...this.sourceToRequestIds.get(sourcePath) ?? []];
|
|
69
|
+
}
|
|
70
|
+
getDependenciesForSource(sourcePath) {
|
|
71
|
+
return [...this.sourceToDependencies.get(sourcePath) ?? []];
|
|
72
|
+
}
|
|
73
|
+
getDiagnosticsForSource(sourcePath) {
|
|
74
|
+
return [...this.sourceToDiagnostics.get(sourcePath) ?? []];
|
|
75
|
+
}
|
|
76
|
+
getTagsForSource(sourcePath) {
|
|
77
|
+
return [...this.sourceToTags.get(sourcePath) ?? []];
|
|
78
|
+
}
|
|
79
|
+
registerExternalRequest(requestId, sourcePath) {
|
|
80
|
+
this.externalRequestToSource.set(this.normalizeRequestId(requestId), sourcePath);
|
|
81
|
+
}
|
|
82
|
+
registerActiveRequest(requestId) {
|
|
83
|
+
const normalizedRequestId = this.normalizeRequestId(requestId);
|
|
84
|
+
const requestPath = normalizedRequestId.split("?")[0];
|
|
85
|
+
const sourcePath = this.resolveExternalSource(requestPath) ?? this.resolveExternalSource(requestPath.replace(/^\//, ""));
|
|
86
|
+
if (!sourcePath) return;
|
|
87
|
+
const requestIds = this.sourceToRequestIds.get(sourcePath) ?? /* @__PURE__ */ new Set();
|
|
88
|
+
requestIds.add(normalizedRequestId);
|
|
89
|
+
if (normalizedRequestId.includes("?direct&ngcomp=")) requestIds.add(normalizedRequestId.replace("?direct&ngcomp=", "?ngcomp="));
|
|
90
|
+
this.sourceToRequestIds.set(sourcePath, requestIds);
|
|
91
|
+
}
|
|
92
|
+
registerServedStylesheet(record, aliases = []) {
|
|
93
|
+
const publicId = this.normalizeRequestId(record.publicId);
|
|
94
|
+
this.servedById.set(publicId, {
|
|
95
|
+
...record,
|
|
96
|
+
publicId
|
|
97
|
+
});
|
|
98
|
+
this.servedAliasToId.set(publicId, publicId);
|
|
99
|
+
for (const alias of aliases) this.servedAliasToId.set(this.normalizeRequestId(alias), publicId);
|
|
100
|
+
if (record.sourcePath) {
|
|
101
|
+
const publicIds = this.sourceToPublicIds.get(record.sourcePath) ?? /* @__PURE__ */ new Set();
|
|
102
|
+
publicIds.add(publicId);
|
|
103
|
+
this.sourceToPublicIds.set(record.sourcePath, publicIds);
|
|
104
|
+
this.recomputeSourceMetadata(record.sourcePath);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
recomputeSourceMetadata(sourcePath) {
|
|
108
|
+
const dependencies = /* @__PURE__ */ new Map();
|
|
109
|
+
const diagnostics = /* @__PURE__ */ new Map();
|
|
110
|
+
const tags = /* @__PURE__ */ new Set();
|
|
111
|
+
for (const publicId of this.sourceToPublicIds.get(sourcePath) ?? []) {
|
|
112
|
+
const record = this.servedById.get(publicId);
|
|
113
|
+
if (!record) continue;
|
|
114
|
+
for (const dependency of record.dependencies ?? []) {
|
|
115
|
+
const key = `${dependency.kind ?? "unknown"}:${dependency.id}:${dependency.owner ?? ""}`;
|
|
116
|
+
dependencies.set(key, dependency);
|
|
117
|
+
}
|
|
118
|
+
for (const diagnostic of record.diagnostics ?? []) {
|
|
119
|
+
const key = `${diagnostic.severity}:${diagnostic.code}:${diagnostic.message}`;
|
|
120
|
+
diagnostics.set(key, diagnostic);
|
|
121
|
+
}
|
|
122
|
+
for (const tag of record.tags ?? []) tags.add(tag);
|
|
123
|
+
}
|
|
124
|
+
this.sourceToDependencies.set(sourcePath, [...dependencies.values()]);
|
|
125
|
+
this.sourceToDiagnostics.set(sourcePath, [...diagnostics.values()]);
|
|
126
|
+
this.sourceToTags.set(sourcePath, [...tags]);
|
|
127
|
+
}
|
|
128
|
+
resolveServedRecord(requestId) {
|
|
129
|
+
const normalizedRequestId = this.normalizeRequestId(requestId);
|
|
130
|
+
const publicId = this.servedAliasToId.get(normalizedRequestId) ?? this.servedAliasToId.get(normalizedRequestId.split("?")[0]) ?? normalizedRequestId.split("?")[0];
|
|
131
|
+
return this.servedById.get(publicId);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
function preprocessStylesheet(code, filename, stylePreprocessor, context) {
|
|
135
|
+
return preprocessStylesheetResult(code, filename, stylePreprocessor, context).code;
|
|
136
|
+
}
|
|
137
|
+
function preprocessStylesheetResult(code, filename, stylePreprocessor, context) {
|
|
138
|
+
return normalizeStylesheetTransformResult(stylePreprocessor?.(code, filename, context), code);
|
|
139
|
+
}
|
|
140
|
+
function rewriteRelativeCssImports(code, filename) {
|
|
141
|
+
const cssDir = dirname(filename);
|
|
142
|
+
return code.replace(/@import\s+(?:url\(\s*(["']?)(\.[^'")\s;]+)\1\s*\)|(["'])(\.[^'"]+)\3)/g, (_match, urlQuote, urlPath, stringQuote, stringPath) => {
|
|
143
|
+
const absPath = resolve(cssDir, urlPath ?? stringPath);
|
|
144
|
+
if (typeof urlPath === "string") return `@import url(${urlQuote}${absPath}${urlQuote})`;
|
|
145
|
+
return `@import ${stringQuote}${absPath}${stringQuote}`;
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function registerStylesheetContent(registry, { code, dependencies, diagnostics, tags, containingFile, className, order, inlineStylesExtension, resourceFile }) {
|
|
149
|
+
const stylesheetId = `${createHash("sha256").update(containingFile).update(className ?? "").update(String(order ?? 0)).update(code).digest("hex")}.${inlineStylesExtension}`;
|
|
150
|
+
const aliases = [];
|
|
151
|
+
if (resourceFile) {
|
|
152
|
+
const normalizedResourceFile = normalizePath(normalize(resourceFile));
|
|
153
|
+
aliases.push(resourceFile, normalizedResourceFile, resourceFile.replace(/^\//, ""), normalizedResourceFile.replace(/^\//, ""));
|
|
154
|
+
}
|
|
155
|
+
registry.registerServedStylesheet({
|
|
156
|
+
publicId: stylesheetId,
|
|
157
|
+
sourcePath: resourceFile,
|
|
158
|
+
normalizedCode: code,
|
|
159
|
+
dependencies,
|
|
160
|
+
diagnostics,
|
|
161
|
+
tags
|
|
162
|
+
}, aliases);
|
|
163
|
+
return stylesheetId;
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
export { AnalogStylesheetRegistry, preprocessStylesheet, preprocessStylesheetResult, registerStylesheetContent, rewriteRelativeCssImports };
|
|
167
|
+
|
|
168
|
+
//# sourceMappingURL=stylesheet-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stylesheet-registry.js","names":[],"sources":["../../../src/lib/stylesheet-registry.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport { dirname, normalize, resolve } from 'node:path';\nimport { normalizePath } from 'vite';\nimport type {\n StylePreprocessor,\n StylesheetDependency,\n StylesheetDiagnostic,\n StylesheetTransformResult,\n StylesheetTransformContext,\n} from './style-preprocessor.js';\nimport { normalizeStylesheetTransformResult as normalizeTransformResult } from './style-preprocessor.js';\n\nexport interface AnalogStylesheetRecord {\n publicId: string;\n sourcePath?: string;\n originalCode?: string;\n normalizedCode: string;\n dependencies?: StylesheetDependency[];\n diagnostics?: StylesheetDiagnostic[];\n tags?: string[];\n}\n\nexport class AnalogStylesheetRegistry {\n private servedById = new Map<string, AnalogStylesheetRecord>();\n private servedAliasToId = new Map<string, string>();\n private externalRequestToSource = new Map<string, string>();\n /**\n * Maps a real source stylesheet path back to the generated public stylesheet\n * ids Analog serves for Angular. This is stable across requests and lets HMR\n * reason about \"which virtual stylesheet came from this source file?\"\n */\n private sourceToPublicIds = new Map<string, Set<string>>();\n /**\n * Tracks the live request ids Vite/Angular have actually served for a source\n * stylesheet, including both `?direct&ngcomp=...` CSS modules and\n * `?ngcomp=...` JS wrapper modules. HMR must use these live request ids\n * because Angular component styles are no longer addressed by their original\n * file paths once externalized.\n */\n private sourceToRequestIds = new Map<string, Set<string>>();\n private sourceToDependencies = new Map<string, StylesheetDependency[]>();\n private sourceToDiagnostics = new Map<string, StylesheetDiagnostic[]>();\n private sourceToTags = new Map<string, string[]>();\n\n /**\n * Canonicalizes browser-facing stylesheet request ids so Vite timestamp\n * variants (`?t=...`) and path-shape variants (`abc.css?...` vs\n * `/abc.css?...`) all collapse onto one logical module identity.\n *\n * This is critical for Angular component stylesheet HMR because the browser\n * can keep both timestamped and non-timestamped requests alive for the same\n * externalized stylesheet. If Analog tracks them as distinct resources, HMR\n * can update one module while the browser continues rendering another stale\n * module for the same public stylesheet id.\n */\n private normalizeRequestId(requestId: string): string {\n const [rawPathname, rawSearch = ''] = requestId.split('?');\n const normalizedPathname = rawPathname.replace(/^\\//, '');\n\n if (!rawSearch) {\n return normalizedPathname;\n }\n\n // Preserve bare query flags like `?direct&ngcomp=...` exactly. Using\n // URLSearchParams reserializes `direct` as `direct=`, which changes the\n // module identity and breaks Vite module-graph lookups for Angular's\n // externalized component stylesheet requests.\n const normalizedSearch = rawSearch\n .split('&')\n .filter((segment) => segment.length > 0)\n .filter((segment) => {\n const [key] = segment.split('=');\n return key !== 't';\n })\n .join('&');\n\n return normalizedSearch\n ? `${normalizedPathname}?${normalizedSearch}`\n : normalizedPathname;\n }\n\n get servedCount(): number {\n return this.servedById.size;\n }\n\n get externalCount(): number {\n return this.externalRequestToSource.size;\n }\n\n hasServed(requestId: string): boolean {\n return this.resolveServedRecord(requestId) !== undefined;\n }\n\n getServedContent(requestId: string): string | undefined {\n return this.resolveServedRecord(requestId)?.normalizedCode;\n }\n\n resolveExternalSource(requestId: string): string | undefined {\n const normalizedRequestId = this.normalizeRequestId(requestId);\n return this.externalRequestToSource.get(normalizedRequestId);\n }\n\n getPublicIdsForSource(sourcePath: string): string[] {\n return [...(this.sourceToPublicIds.get(sourcePath) ?? [])];\n }\n\n getRequestIdsForSource(sourcePath: string): string[] {\n return [...(this.sourceToRequestIds.get(sourcePath) ?? [])];\n }\n\n getDependenciesForSource(sourcePath: string): StylesheetDependency[] {\n return [...(this.sourceToDependencies.get(sourcePath) ?? [])];\n }\n\n getDiagnosticsForSource(sourcePath: string): StylesheetDiagnostic[] {\n return [...(this.sourceToDiagnostics.get(sourcePath) ?? [])];\n }\n\n getTagsForSource(sourcePath: string): string[] {\n return [...(this.sourceToTags.get(sourcePath) ?? [])];\n }\n\n registerExternalRequest(requestId: string, sourcePath: string): void {\n this.externalRequestToSource.set(\n this.normalizeRequestId(requestId),\n sourcePath,\n );\n }\n\n registerActiveRequest(requestId: string): void {\n // Requests arrive in multiple shapes depending on who asked for the\n // stylesheet (`abc123.css?...` vs `/abc123.css?...`). Normalize both back to\n // the source file so later HMR events for `/src/...component.css` can find\n // the currently active virtual requests.\n const normalizedRequestId = this.normalizeRequestId(requestId);\n const requestPath = normalizedRequestId.split('?')[0];\n const sourcePath =\n this.resolveExternalSource(requestPath) ??\n this.resolveExternalSource(requestPath.replace(/^\\//, ''));\n if (!sourcePath) {\n return;\n }\n\n const requestIds = this.sourceToRequestIds.get(sourcePath) ?? new Set();\n requestIds.add(normalizedRequestId);\n // Angular component styles are served through both a direct CSS request\n // (`?direct&ngcomp=...`) and a JS wrapper request (`?ngcomp=...`). The\n // browser can already have the wrapper loaded even when Vite's live module\n // graph only surfaces the direct request during a CSS-only edit. Track the\n // derived wrapper id eagerly so HMR can reason about the browser-visible\n // stylesheet identity without waiting for that wrapper request to be\n // observed later in the session.\n if (normalizedRequestId.includes('?direct&ngcomp=')) {\n requestIds.add(\n normalizedRequestId.replace('?direct&ngcomp=', '?ngcomp='),\n );\n }\n this.sourceToRequestIds.set(sourcePath, requestIds);\n }\n\n registerServedStylesheet(\n record: AnalogStylesheetRecord,\n aliases: string[] = [],\n ): void {\n const publicId = this.normalizeRequestId(record.publicId);\n this.servedById.set(publicId, { ...record, publicId });\n this.servedAliasToId.set(publicId, publicId);\n\n for (const alias of aliases) {\n this.servedAliasToId.set(this.normalizeRequestId(alias), publicId);\n }\n\n if (record.sourcePath) {\n const publicIds =\n this.sourceToPublicIds.get(record.sourcePath) ?? new Set();\n publicIds.add(publicId);\n this.sourceToPublicIds.set(record.sourcePath, publicIds);\n this.recomputeSourceMetadata(record.sourcePath);\n }\n }\n\n private recomputeSourceMetadata(sourcePath: string): void {\n const dependencies = new Map<string, StylesheetDependency>();\n const diagnostics = new Map<string, StylesheetDiagnostic>();\n const tags = new Set<string>();\n\n for (const publicId of this.sourceToPublicIds.get(sourcePath) ?? []) {\n const record = this.servedById.get(publicId);\n if (!record) {\n continue;\n }\n\n for (const dependency of record.dependencies ?? []) {\n const key = `${dependency.kind ?? 'unknown'}:${dependency.id}:${dependency.owner ?? ''}`;\n dependencies.set(key, dependency);\n }\n\n for (const diagnostic of record.diagnostics ?? []) {\n const key = `${diagnostic.severity}:${diagnostic.code}:${diagnostic.message}`;\n diagnostics.set(key, diagnostic);\n }\n\n for (const tag of record.tags ?? []) {\n tags.add(tag);\n }\n }\n\n this.sourceToDependencies.set(sourcePath, [...dependencies.values()]);\n this.sourceToDiagnostics.set(sourcePath, [...diagnostics.values()]);\n this.sourceToTags.set(sourcePath, [...tags]);\n }\n\n private resolveServedRecord(\n requestId: string,\n ): AnalogStylesheetRecord | undefined {\n const normalizedRequestId = this.normalizeRequestId(requestId);\n const publicId =\n this.servedAliasToId.get(normalizedRequestId) ??\n this.servedAliasToId.get(normalizedRequestId.split('?')[0]) ??\n normalizedRequestId.split('?')[0];\n return this.servedById.get(publicId);\n }\n}\n\nexport function preprocessStylesheet(\n code: string,\n filename: string,\n stylePreprocessor?: StylePreprocessor,\n context?: StylesheetTransformContext,\n): string {\n return preprocessStylesheetResult(code, filename, stylePreprocessor, context)\n .code;\n}\n\nexport function preprocessStylesheetResult(\n code: string,\n filename: string,\n stylePreprocessor?: StylePreprocessor,\n context?: StylesheetTransformContext,\n): StylesheetTransformResult {\n return normalizeTransformResult(\n stylePreprocessor?.(code, filename, context),\n code,\n );\n}\n\nexport function rewriteRelativeCssImports(\n code: string,\n filename: string,\n): string {\n const cssDir = dirname(filename);\n return code.replace(\n /@import\\s+(?:url\\(\\s*([\"']?)(\\.[^'\")\\s;]+)\\1\\s*\\)|([\"'])(\\.[^'\"]+)\\3)/g,\n (_match, urlQuote, urlPath, stringQuote, stringPath) => {\n const relPath = urlPath ?? stringPath;\n const absPath = resolve(cssDir, relPath);\n\n if (typeof urlPath === 'string') {\n return `@import url(${urlQuote}${absPath}${urlQuote})`;\n }\n\n return `@import ${stringQuote}${absPath}${stringQuote}`;\n },\n );\n}\n\nexport function registerStylesheetContent(\n registry: AnalogStylesheetRegistry,\n {\n code,\n dependencies,\n diagnostics,\n tags,\n containingFile,\n className,\n order,\n inlineStylesExtension,\n resourceFile,\n }: {\n code: string;\n dependencies?: StylesheetDependency[];\n diagnostics?: StylesheetDiagnostic[];\n tags?: string[];\n containingFile: string;\n className?: string;\n order?: number;\n inlineStylesExtension: string;\n resourceFile?: string;\n },\n): string {\n const id = createHash('sha256')\n .update(containingFile)\n .update(className ?? '')\n .update(String(order ?? 0))\n .update(code)\n .digest('hex');\n const stylesheetId = `${id}.${inlineStylesExtension}`;\n\n const aliases: string[] = [];\n\n if (resourceFile) {\n const normalizedResourceFile = normalizePath(normalize(resourceFile));\n // Avoid basename-only aliases here: shared filenames like `index.css`\n // can collide across components and break HMR lookups.\n aliases.push(\n resourceFile,\n normalizedResourceFile,\n resourceFile.replace(/^\\//, ''),\n normalizedResourceFile.replace(/^\\//, ''),\n );\n }\n\n registry.registerServedStylesheet(\n {\n publicId: stylesheetId,\n sourcePath: resourceFile,\n normalizedCode: code,\n dependencies,\n diagnostics,\n tags,\n },\n aliases,\n );\n\n return stylesheetId;\n}\n"],"mappings":"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"}
|