@analogjs/vite-plugin-angular 3.0.0-alpha.8 → 3.0.0-alpha.9

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.
Files changed (51) hide show
  1. package/package.json +3 -7
  2. package/setup-vitest.js +154 -193
  3. package/setup-vitest.js.map +1 -1
  4. package/src/index.d.ts +1 -1
  5. package/src/index.js +6 -2
  6. package/src/index.js.map +1 -1
  7. package/src/lib/angular-build-optimizer-plugin.js +48 -63
  8. package/src/lib/angular-build-optimizer-plugin.js.map +1 -1
  9. package/src/lib/angular-jit-plugin.js +31 -37
  10. package/src/lib/angular-jit-plugin.js.map +1 -1
  11. package/src/lib/angular-pending-tasks.plugin.js +17 -18
  12. package/src/lib/angular-pending-tasks.plugin.js.map +1 -1
  13. package/src/lib/angular-vite-plugin.js +790 -1077
  14. package/src/lib/angular-vite-plugin.js.map +1 -1
  15. package/src/lib/angular-vitest-plugin.js +97 -135
  16. package/src/lib/angular-vitest-plugin.js.map +1 -1
  17. package/src/lib/compiler-plugin.js +40 -44
  18. package/src/lib/compiler-plugin.js.map +1 -1
  19. package/src/lib/component-resolvers.js +87 -120
  20. package/src/lib/component-resolvers.js.map +1 -1
  21. package/src/lib/host.js +69 -101
  22. package/src/lib/host.js.map +1 -1
  23. package/src/lib/live-reload-plugin.js +51 -63
  24. package/src/lib/live-reload-plugin.js.map +1 -1
  25. package/src/lib/nx-folder-plugin.js +18 -16
  26. package/src/lib/nx-folder-plugin.js.map +1 -1
  27. package/src/lib/plugins/file-replacements.plugin.js +35 -62
  28. package/src/lib/plugins/file-replacements.plugin.js.map +1 -1
  29. package/src/lib/router-plugin.js +23 -23
  30. package/src/lib/router-plugin.js.map +1 -1
  31. package/src/lib/tools/package.json +2 -5
  32. package/src/lib/tools/src/builders/vite/vite-build.impl.js +31 -38
  33. package/src/lib/tools/src/builders/vite/vite-build.impl.js.map +1 -1
  34. package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js +52 -60
  35. package/src/lib/tools/src/builders/vite-dev-server/dev-server.impl.js.map +1 -1
  36. package/src/lib/tools/src/index.js +0 -2
  37. package/src/lib/utils/devkit.js +34 -38
  38. package/src/lib/utils/devkit.js.map +1 -1
  39. package/src/lib/utils/rolldown.js +9 -5
  40. package/src/lib/utils/rolldown.js.map +1 -1
  41. package/src/lib/utils/source-file-cache.js +35 -37
  42. package/src/lib/utils/source-file-cache.js.map +1 -1
  43. package/README.md +0 -91
  44. package/src/lib/models.js +0 -1
  45. package/src/lib/models.js.map +0 -1
  46. package/src/lib/tools/README.md +0 -3
  47. package/src/lib/tools/src/index.js.map +0 -1
  48. package/src/lib/utils/compiler-plugin-options.js +0 -1
  49. package/src/lib/utils/compiler-plugin-options.js.map +0 -1
  50. package/src/lib/utils/hmr-candidates.js +0 -272
  51. package/src/lib/utils/hmr-candidates.js.map +0 -1
@@ -1,39 +1,33 @@
1
- import { createHash } from 'node:crypto';
2
- import { preprocessCSS } from 'vite';
3
- export function jitPlugin({ inlineStylesExtension, }) {
4
- let config;
5
- return {
6
- name: '@analogjs/vite-plugin-angular-jit',
7
- configResolved(_config) {
8
- config = _config;
9
- },
10
- resolveId(id) {
11
- if (id.startsWith('virtual:angular')) {
12
- return `\0${id}`;
13
- }
14
- return;
15
- },
16
- async load(id) {
17
- if (id.includes('virtual:angular:jit:style:inline;')) {
18
- const styleId = id.split('style:inline;')[1];
19
- // styleId may exceed 255 bytes of base64-encoded content, limit to 16
20
- const styleIdHash = createHash('sha256')
21
- .update(styleId)
22
- .digest('hex')
23
- .slice(0, 16);
24
- const decodedStyles = Buffer.from(decodeURIComponent(styleId), 'base64').toString();
25
- let styles = '';
26
- try {
27
- const compiled = await preprocessCSS(decodedStyles, `${styleIdHash}.${inlineStylesExtension}?direct`, config);
28
- styles = compiled?.code;
29
- }
30
- catch (e) {
31
- console.error(`${e}`);
32
- }
33
- return `export default \`${styles}\``;
34
- }
35
- return;
36
- },
37
- };
1
+ import { preprocessCSS } from "vite";
2
+ import { createHash } from "node:crypto";
3
+ //#region packages/vite-plugin-angular/src/lib/angular-jit-plugin.ts
4
+ function jitPlugin({ inlineStylesExtension }) {
5
+ let config;
6
+ return {
7
+ name: "@analogjs/vite-plugin-angular-jit",
8
+ configResolved(_config) {
9
+ config = _config;
10
+ },
11
+ resolveId(id) {
12
+ if (id.startsWith("virtual:angular")) return `\0${id}`;
13
+ },
14
+ async load(id) {
15
+ if (id.includes("virtual:angular:jit:style:inline;")) {
16
+ const styleId = id.split("style:inline;")[1];
17
+ const styleIdHash = createHash("sha256").update(styleId).digest("hex").slice(0, 16);
18
+ const decodedStyles = Buffer.from(decodeURIComponent(styleId), "base64").toString();
19
+ let styles = "";
20
+ try {
21
+ styles = (await preprocessCSS(decodedStyles, `${styleIdHash}.${inlineStylesExtension}?direct`, config))?.code;
22
+ } catch (e) {
23
+ console.error(`${e}`);
24
+ }
25
+ return `export default \`${styles}\``;
26
+ }
27
+ }
28
+ };
38
29
  }
30
+ //#endregion
31
+ export { jitPlugin };
32
+
39
33
  //# sourceMappingURL=angular-jit-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"angular-jit-plugin.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-angular/src/lib/angular-jit-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAA0B,aAAa,EAAE,MAAM,MAAM,CAAC;AAE7D,MAAM,UAAU,SAAS,CAAC,EACxB,qBAAqB,GAGtB;IACC,IAAI,MAAsB,CAAC;IAE3B,OAAO;QACL,IAAI,EAAE,mCAAmC;QACzC,cAAc,CAAC,OAAO;YACpB,MAAM,GAAG,OAAO,CAAC;QACnB,CAAC;QACD,SAAS,CAAC,EAAU;YAClB,IAAI,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;gBACrC,OAAO,KAAK,EAAE,EAAE,CAAC;YACnB,CAAC;YAED,OAAO;QACT,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAU;YACnB,IAAI,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC,EAAE,CAAC;gBACrD,MAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7C,sEAAsE;gBACtE,MAAM,WAAW,GAAG,UAAU,CAAC,QAAQ,CAAC;qBACrC,MAAM,CAAC,OAAO,CAAC;qBACf,MAAM,CAAC,KAAK,CAAC;qBACb,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAEhB,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAC/B,kBAAkB,CAAC,OAAO,CAAC,EAC3B,QAAQ,CACT,CAAC,QAAQ,EAAE,CAAC;gBAEb,IAAI,MAAM,GAAuB,EAAE,CAAC;gBAEpC,IAAI,CAAC;oBACH,MAAM,QAAQ,GAAG,MAAM,aAAa,CAClC,aAAa,EACb,GAAG,WAAW,IAAI,qBAAqB,SAAS,EAChD,MAAM,CACP,CAAC;oBACF,MAAM,GAAG,QAAQ,EAAE,IAAI,CAAC;gBAC1B,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACxB,CAAC;gBAED,OAAO,oBAAoB,MAAM,IAAI,CAAC;YACxC,CAAC;YAED,OAAO;QACT,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"angular-jit-plugin.js","names":[],"sources":["../../../../../packages/vite-plugin-angular/src/lib/angular-jit-plugin.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport { Plugin, ResolvedConfig, preprocessCSS } from 'vite';\n\nexport function jitPlugin({\n inlineStylesExtension,\n}: {\n inlineStylesExtension: string;\n}): Plugin {\n let config: ResolvedConfig;\n\n return {\n name: '@analogjs/vite-plugin-angular-jit',\n configResolved(_config) {\n config = _config;\n },\n resolveId(id: string) {\n if (id.startsWith('virtual:angular')) {\n return `\\0${id}`;\n }\n\n return;\n },\n async load(id: string) {\n if (id.includes('virtual:angular:jit:style:inline;')) {\n const styleId = id.split('style:inline;')[1];\n // styleId may exceed 255 bytes of base64-encoded content, limit to 16\n const styleIdHash = createHash('sha256')\n .update(styleId)\n .digest('hex')\n .slice(0, 16);\n\n const decodedStyles = Buffer.from(\n decodeURIComponent(styleId),\n 'base64',\n ).toString();\n\n let styles: string | undefined = '';\n\n try {\n const compiled = await preprocessCSS(\n decodedStyles,\n `${styleIdHash}.${inlineStylesExtension}?direct`,\n config,\n );\n styles = compiled?.code;\n } catch (e) {\n console.error(`${e}`);\n }\n\n return `export default \\`${styles}\\``;\n }\n\n return;\n },\n };\n}\n"],"mappings":";;;AAGA,SAAgB,UAAU,EACxB,yBAGS;CACT,IAAI;AAEJ,QAAO;EACL,MAAM;EACN,eAAe,SAAS;AACtB,YAAS;;EAEX,UAAU,IAAY;AACpB,OAAI,GAAG,WAAW,kBAAkB,CAClC,QAAO,KAAK;;EAKhB,MAAM,KAAK,IAAY;AACrB,OAAI,GAAG,SAAS,oCAAoC,EAAE;IACpD,MAAM,UAAU,GAAG,MAAM,gBAAgB,CAAC;IAE1C,MAAM,cAAc,WAAW,SAAS,CACrC,OAAO,QAAQ,CACf,OAAO,MAAM,CACb,MAAM,GAAG,GAAG;IAEf,MAAM,gBAAgB,OAAO,KAC3B,mBAAmB,QAAQ,EAC3B,SACD,CAAC,UAAU;IAEZ,IAAI,SAA6B;AAEjC,QAAI;AAMF,eALiB,MAAM,cACrB,eACA,GAAG,YAAY,GAAG,sBAAsB,UACxC,OACD,GACkB;aACZ,GAAG;AACV,aAAQ,MAAM,GAAG,IAAI;;AAGvB,WAAO,oBAAoB,OAAO;;;EAKvC"}
@@ -1,21 +1,20 @@
1
+ //#region packages/vite-plugin-angular/src/lib/angular-pending-tasks.plugin.ts
1
2
  /**
2
- * This plugin is a workaround for the ɵPendingTasks symbol being renamed
3
- * to ɵPendingTasksInternal in Angular v19.0.4. The symbol is renamed to support previous versions of
4
- * Angular with Analog that used the ɵPendingTasks symbol.
5
- *
6
- * Commmit: https://github.com/angular/angular/commit/24e317cb157bf1ef159ed8554f1b79cb3443edf4
7
- */
8
- export function pendingTasksPlugin() {
9
- return {
10
- name: 'analogjs-pending-tasks-plugin',
11
- transform(code, id) {
12
- if (id.includes('analogjs-content.mjs')) {
13
- return {
14
- code: code.replace('ɵPendingTasksInternal', 'ɵPendingTasks'),
15
- };
16
- }
17
- return;
18
- },
19
- };
3
+ * This plugin is a workaround for the ɵPendingTasks symbol being renamed
4
+ * to ɵPendingTasksInternal in Angular v19.0.4. The symbol is renamed to support previous versions of
5
+ * Angular with Analog that used the ɵPendingTasks symbol.
6
+ *
7
+ * Commmit: https://github.com/angular/angular/commit/24e317cb157bf1ef159ed8554f1b79cb3443edf4
8
+ */
9
+ function pendingTasksPlugin() {
10
+ return {
11
+ name: "analogjs-pending-tasks-plugin",
12
+ transform(code, id) {
13
+ if (id.includes("analogjs-content.mjs")) return { code: code.replace("ɵPendingTasksInternal", "ɵPendingTasks") };
14
+ }
15
+ };
20
16
  }
17
+ //#endregion
18
+ export { pendingTasksPlugin };
19
+
21
20
  //# sourceMappingURL=angular-pending-tasks.plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"angular-pending-tasks.plugin.js","sourceRoot":"","sources":["../../../../../packages/vite-plugin-angular/src/lib/angular-pending-tasks.plugin.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,IAAI,EAAE,+BAA+B;QACrC,SAAS,CAAC,IAAI,EAAE,EAAE;YAChB,IAAI,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC;gBACxC,OAAO;oBACL,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,eAAe,CAAC;iBAC7D,CAAC;YACJ,CAAC;YACD,OAAO;QACT,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"angular-pending-tasks.plugin.js","names":[],"sources":["../../../../../packages/vite-plugin-angular/src/lib/angular-pending-tasks.plugin.ts"],"sourcesContent":["import { Plugin } from 'vite';\n\nimport { angularFullVersion } from './utils/devkit.js';\n\n/**\n * This plugin is a workaround for the ɵPendingTasks symbol being renamed\n * to ɵPendingTasksInternal in Angular v19.0.4. The symbol is renamed to support previous versions of\n * Angular with Analog that used the ɵPendingTasks symbol.\n *\n * Commmit: https://github.com/angular/angular/commit/24e317cb157bf1ef159ed8554f1b79cb3443edf4\n */\nexport function pendingTasksPlugin(): Plugin {\n return {\n name: 'analogjs-pending-tasks-plugin',\n transform(code, id) {\n if (id.includes('analogjs-content.mjs')) {\n return {\n code: code.replace('ɵPendingTasksInternal', 'ɵPendingTasks'),\n };\n }\n return;\n },\n };\n}\n"],"mappings":";;;;;;;;AAWA,SAAgB,qBAA6B;AAC3C,QAAO;EACL,MAAM;EACN,UAAU,MAAM,IAAI;AAClB,OAAI,GAAG,SAAS,uBAAuB,CACrC,QAAO,EACL,MAAM,KAAK,QAAQ,yBAAyB,gBAAgB,EAC7D;;EAIN"}