@analogjs/platform 3.0.0-alpha.90 → 3.0.0-alpha.92

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 (53) hide show
  1. package/migrations/migrate-to-separated-plugins/migrate-to-separated-plugins.d.ts +2 -0
  2. package/migrations/migrate-to-separated-plugins/migrate-to-separated-plugins.js +203 -0
  3. package/migrations/migrate-to-separated-plugins/migrate-to-separated-plugins.js.map +1 -0
  4. package/package.json +11 -7
  5. package/src/index.d.ts +1 -2
  6. package/src/index.js +1 -2
  7. package/src/index.js.map +1 -1
  8. package/src/lib/clear-client-page-endpoint.js +1 -0
  9. package/src/lib/clear-client-page-endpoint.js.map +1 -1
  10. package/src/lib/deps-plugin.js +17 -6
  11. package/src/lib/deps-plugin.js.map +1 -1
  12. package/src/lib/nitro/analog-nitro-plugin.js +102 -45
  13. package/src/lib/nitro/analog-nitro-plugin.js.map +1 -1
  14. package/src/lib/nitro/get-server-fn-handlers.d.ts +29 -0
  15. package/src/lib/nitro/get-server-fn-handlers.js +66 -0
  16. package/src/lib/nitro/get-server-fn-handlers.js.map +1 -0
  17. package/src/lib/nitro/server-fn-endpoints.d.ts +41 -0
  18. package/src/lib/nitro/server-fn-endpoints.js +57 -0
  19. package/src/lib/nitro/server-fn-endpoints.js.map +1 -0
  20. package/src/lib/nx-plugin/src/generators/app/files/template-angular/src/server/routes/api/v1/hello.ts__template__ +2 -2
  21. package/src/lib/nx-plugin/src/generators/app/files/template-angular/vite.config.ts__template__ +4 -0
  22. package/src/lib/nx-plugin/src/generators/app/versions/nx_18_X/versions.d.ts +7 -5
  23. package/src/lib/nx-plugin/src/generators/app/versions/nx_18_X/versions.js.map +1 -1
  24. package/src/lib/nx-plugin/src/generators/preset/__snapshots__/generator.spec.ts.snap +3 -1
  25. package/src/lib/nx-plugin/src/utils/versions/ng_19_X/versions.d.ts +5 -5
  26. package/src/lib/nx-plugin/src/utils/versions/ng_19_X/versions.js +5 -5
  27. package/src/lib/nx-plugin/src/utils/versions/ng_19_X/versions.js.map +1 -1
  28. package/src/lib/options.d.ts +9 -49
  29. package/src/lib/platform-plugin.js +42 -6
  30. package/src/lib/platform-plugin.js.map +1 -1
  31. package/src/lib/route-file-discovery.d.ts +3 -1
  32. package/src/lib/route-file-discovery.js +19 -8
  33. package/src/lib/route-file-discovery.js.map +1 -1
  34. package/src/lib/route-manifest.d.ts +22 -26
  35. package/src/lib/route-manifest.js +58 -189
  36. package/src/lib/route-manifest.js.map +1 -1
  37. package/src/lib/ssr/defer-streaming-plugin.js +97 -0
  38. package/src/lib/ssr/defer-streaming-plugin.js.map +1 -0
  39. package/src/lib/typed-routes-plugin.d.ts +6 -43
  40. package/src/lib/typed-routes-plugin.js +80 -195
  41. package/src/lib/typed-routes-plugin.js.map +1 -1
  42. package/src/lib/utils/debug.js +4 -7
  43. package/src/lib/utils/debug.js.map +1 -1
  44. package/src/lib/utils/rolldown.js +1 -1
  45. package/src/server-mode-plugin.d.ts +1 -1
  46. package/src/server-mode-plugin.js +13 -1
  47. package/src/server-mode-plugin.js.map +1 -1
  48. package/src/lib/json-ld-manifest-plugin.d.ts +0 -41
  49. package/src/lib/json-ld-manifest-plugin.js +0 -84
  50. package/src/lib/json-ld-manifest-plugin.js.map +0 -1
  51. package/src/lib/route-generation-plugin.d.ts +0 -3
  52. package/src/lib/route-generation-plugin.js +0 -45
  53. package/src/lib/route-generation-plugin.js.map +0 -1
@@ -1,3 +1,5 @@
1
+ import { resolve } from "node:path";
2
+ import { normalizePath } from "vite";
1
3
  //#region packages/platform/src/server-mode-plugin.ts
2
4
  var SERVER_MODE_ID = "virtual:@analogjs/platform/server-mode";
3
5
  var RESOLVED_SERVER_MODE_ID = `\0${SERVER_MODE_ID}`;
@@ -11,9 +13,19 @@ var RESOLVED_SERVER_MODE_ID = `\0${SERVER_MODE_ID}`;
11
13
  * first so the flag is set before any application module evaluates. A text
12
14
  * replacement cannot do this because Angular is pre-bundled for SSR.
13
15
  */
14
- function serverModePlugin() {
16
+ function serverModePlugin(entryServer) {
17
+ let entryServerPath = "";
15
18
  return [{
16
19
  name: "analogjs-server-mode-plugin",
20
+ configResolved(config) {
21
+ entryServerPath = normalizePath(resolve(config.root, entryServer ?? "src/main.server.ts"));
22
+ },
23
+ transform(code, id, options) {
24
+ if (options?.ssr && normalizePath(id) === entryServerPath) return {
25
+ code: `import ${JSON.stringify(SERVER_MODE_ID)};\n${code}`,
26
+ map: null
27
+ };
28
+ },
17
29
  resolveId(id) {
18
30
  return id === "virtual:@analogjs/platform/server-mode" ? RESOLVED_SERVER_MODE_ID : void 0;
19
31
  },
@@ -1 +1 @@
1
- {"version":3,"file":"server-mode-plugin.js","names":[],"sources":["../../src/server-mode-plugin.ts"],"sourcesContent":["import { Plugin } from 'vite';\n\nexport const SERVER_MODE_ID = 'virtual:@analogjs/platform/server-mode';\nconst RESOLVED_SERVER_MODE_ID = `\\0${SERVER_MODE_ID}`;\n\n/**\n * Serves a module that sets `globalThis.ngServerMode = true`.\n *\n * Angular decides at provider-creation time whether browser-only features\n * such as event replay apply, and `provideClientHydration()` runs while the\n * app config module evaluates, before `platformServer()` or\n * `provideServerRendering()` set the flag. The SSR entry imports this module\n * first so the flag is set before any application module evaluates. A text\n * replacement cannot do this because Angular is pre-bundled for SSR.\n */\nexport function serverModePlugin(): Plugin[] {\n return [\n {\n name: 'analogjs-server-mode-plugin',\n resolveId(id) {\n return id === SERVER_MODE_ID ? RESOLVED_SERVER_MODE_ID : undefined;\n },\n load(id) {\n return id === RESOLVED_SERVER_MODE_ID\n ? 'globalThis.ngServerMode = true;\\nexport {};\\n'\n : undefined;\n },\n },\n ];\n}\n"],"mappings":";AAEA,IAAa,iBAAiB;AAC9B,IAAM,0BAA0B,KAAK;;;;;;;;;;;AAYrC,SAAgB,mBAA6B;AAC3C,QAAO,CACL;EACE,MAAM;EACN,UAAU,IAAI;AACZ,UAAO,OAAA,2CAAwB,0BAA0B,KAAA;;EAE3D,KAAK,IAAI;AACP,UAAO,OAAO,0BACV,kDACA,KAAA;;EAEP,CACF"}
1
+ {"version":3,"file":"server-mode-plugin.js","names":[],"sources":["../../src/server-mode-plugin.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { Plugin, normalizePath } from 'vite';\n\nexport const SERVER_MODE_ID = 'virtual:@analogjs/platform/server-mode';\nconst RESOLVED_SERVER_MODE_ID = `\\0${SERVER_MODE_ID}`;\n\n/**\n * Serves a module that sets `globalThis.ngServerMode = true`.\n *\n * Angular decides at provider-creation time whether browser-only features\n * such as event replay apply, and `provideClientHydration()` runs while the\n * app config module evaluates, before `platformServer()` or\n * `provideServerRendering()` set the flag. The SSR entry imports this module\n * first so the flag is set before any application module evaluates. A text\n * replacement cannot do this because Angular is pre-bundled for SSR.\n */\nexport function serverModePlugin(entryServer?: string): Plugin[] {\n let entryServerPath = '';\n\n return [\n {\n name: 'analogjs-server-mode-plugin',\n configResolved(config) {\n entryServerPath = normalizePath(\n resolve(config.root, entryServer ?? 'src/main.server.ts'),\n );\n },\n // Nitro v2 builds `main.server.ts` as the SSR entry directly, so set the\n // flag there too.\n transform(code, id, options) {\n if (options?.ssr && normalizePath(id) === entryServerPath) {\n return {\n code: `import ${JSON.stringify(SERVER_MODE_ID)};\\n${code}`,\n map: null,\n };\n }\n return undefined;\n },\n resolveId(id) {\n return id === SERVER_MODE_ID ? RESOLVED_SERVER_MODE_ID : undefined;\n },\n load(id) {\n return id === RESOLVED_SERVER_MODE_ID\n ? 'globalThis.ngServerMode = true;\\nexport {};\\n'\n : undefined;\n },\n },\n ];\n}\n"],"mappings":";;;AAGA,IAAa,iBAAiB;AAC9B,IAAM,0BAA0B,KAAK;;;;;;;;;;;AAYrC,SAAgB,iBAAiB,aAAgC;CAC/D,IAAI,kBAAkB;AAEtB,QAAO,CACL;EACE,MAAM;EACN,eAAe,QAAQ;AACrB,qBAAkB,cAChB,QAAQ,OAAO,MAAM,eAAe,qBAAqB,CAC1D;;EAIH,UAAU,MAAM,IAAI,SAAS;AAC3B,OAAI,SAAS,OAAO,cAAc,GAAG,KAAK,gBACxC,QAAO;IACL,MAAM,UAAU,KAAK,UAAU,eAAe,CAAC,KAAK;IACpD,KAAK;IACN;;EAIL,UAAU,IAAI;AACZ,UAAO,OAAA,2CAAwB,0BAA0B,KAAA;;EAE3D,KAAK,IAAI;AACP,UAAO,OAAO,0BACV,kDACA,KAAA;;EAEP,CACF"}
@@ -1,41 +0,0 @@
1
- import { type JsonLdObject } from "./route-manifest.js";
2
- export type JsonLdModuleManifestEntry = {
3
- kind: "module";
4
- routePath: string;
5
- sourceFile: string;
6
- importAlias: string;
7
- };
8
- export type JsonLdContentManifestEntry = {
9
- kind: "content";
10
- routePath: string;
11
- sourceFile: string;
12
- jsonLd: JsonLdObject[];
13
- };
14
- export type JsonLdManifestEntry = JsonLdModuleManifestEntry | JsonLdContentManifestEntry;
15
- /**
16
- * Heuristic detector for JSON-LD exports in route modules.
17
- *
18
- * This is intentionally regex-based for speed during file scanning.
19
- * It reliably detects these direct export patterns:
20
- *
21
- * - `export const routeJsonLd = ...`
22
- * - `export const routeMeta = { ..., jsonLd: ... }`
23
- * - `export const routeJsonLd = (route) => ...` (function form)
24
- *
25
- * Known limitations (not detected):
26
- *
27
- * - re-exports: `export { routeJsonLd } from './data'`
28
- * - aliased exports: `export { something as routeJsonLd }`
29
- * - default exports: `export default { jsonLd: ... }`
30
- * - indirect assignment: `const data = { jsonLd: ... }; export const routeMeta = data`
31
- *
32
- * Known false-positive risks:
33
- *
34
- * - comment text containing `export const routeJsonLd`
35
- * - unrelated `jsonLd` text appearing after `export const routeMeta`
36
- *
37
- * Prefer the supported direct export patterns listed above.
38
- */
39
- export declare function detectJsonLdModuleExports(fileContent: string): boolean;
40
- export declare function extractMarkdownJsonLd(rawContent: string): JsonLdObject[];
41
- export declare function generateJsonLdManifestSource(entries: JsonLdManifestEntry[], outFile: string): string;
@@ -1,84 +0,0 @@
1
- import { normalizeJsonLd } from "./route-manifest.js";
2
- import { dirname, relative } from "node:path";
3
- import { normalizePath } from "vite";
4
- import fm from "front-matter";
5
- //#region packages/platform/src/lib/json-ld-manifest-plugin.ts
6
- /**
7
- * Heuristic detector for JSON-LD exports in route modules.
8
- *
9
- * This is intentionally regex-based for speed during file scanning.
10
- * It reliably detects these direct export patterns:
11
- *
12
- * - `export const routeJsonLd = ...`
13
- * - `export const routeMeta = { ..., jsonLd: ... }`
14
- * - `export const routeJsonLd = (route) => ...` (function form)
15
- *
16
- * Known limitations (not detected):
17
- *
18
- * - re-exports: `export { routeJsonLd } from './data'`
19
- * - aliased exports: `export { something as routeJsonLd }`
20
- * - default exports: `export default { jsonLd: ... }`
21
- * - indirect assignment: `const data = { jsonLd: ... }; export const routeMeta = data`
22
- *
23
- * Known false-positive risks:
24
- *
25
- * - comment text containing `export const routeJsonLd`
26
- * - unrelated `jsonLd` text appearing after `export const routeMeta`
27
- *
28
- * Prefer the supported direct export patterns listed above.
29
- */
30
- function detectJsonLdModuleExports(fileContent) {
31
- return /export\s+const\s+routeJsonLd\b/.test(fileContent) || /export\s+const\s+routeMeta\b[\s\S]*?\bjsonLd\b/.test(fileContent);
32
- }
33
- function extractMarkdownJsonLd(rawContent) {
34
- const { attributes } = fm(rawContent);
35
- return normalizeJsonLd(attributes["jsonLd"]);
36
- }
37
- function generateJsonLdManifestSource(entries, outFile) {
38
- const lines = [];
39
- const moduleEntries = entries.filter((entry) => entry.kind === "module");
40
- lines.push("// This file is auto-generated by @analogjs/platform");
41
- lines.push("// Do not edit manually");
42
- lines.push("");
43
- lines.push("import type { Graph, Thing, WithContext } from 'schema-dts';");
44
- moduleEntries.forEach((entry) => {
45
- lines.push(`import * as ${entry.importAlias} from '${toImportPath(outFile, entry.sourceFile)}';`);
46
- });
47
- lines.push("");
48
- lines.push("export type AnalogJsonLdDocument = WithContext<Thing> | Graph | Array<WithContext<Thing>>;");
49
- lines.push("export type GeneratedJsonLdManifestEntry = { routePath: string; sourceFile: string; kind: 'module' | 'content'; resolveJsonLd: () => AnalogJsonLdDocument[]; };");
50
- lines.push("");
51
- lines.push("function normalizeJsonLd(value: unknown): AnalogJsonLdDocument[] {");
52
- lines.push(" if (Array.isArray(value)) {");
53
- lines.push(" return value.filter((entry): entry is AnalogJsonLdDocument => typeof entry === 'object' && entry !== null && !Array.isArray(entry));");
54
- lines.push(" }");
55
- lines.push("");
56
- lines.push(" return typeof value === 'object' && value !== null ? [value as AnalogJsonLdDocument] : [];");
57
- lines.push("}");
58
- lines.push("");
59
- lines.push("function resolveModuleJsonLd(routeModule: unknown): AnalogJsonLdDocument[] {");
60
- lines.push(" const typedRouteModule = routeModule as { routeJsonLd?: unknown; routeMeta?: { jsonLd?: unknown } };");
61
- lines.push(" return normalizeJsonLd(typedRouteModule.routeMeta?.jsonLd ?? typedRouteModule.routeJsonLd);");
62
- lines.push("}");
63
- lines.push("");
64
- lines.push("export const routeJsonLdManifest = new Map<string, GeneratedJsonLdManifestEntry>([");
65
- entries.forEach((entry) => {
66
- if (entry.kind === "module") {
67
- lines.push(` ['${entry.routePath}', { routePath: '${entry.routePath}', sourceFile: '${entry.sourceFile}', kind: 'module', resolveJsonLd: () => resolveModuleJsonLd(${entry.importAlias}) }],`);
68
- return;
69
- }
70
- lines.push(` ['${entry.routePath}', { routePath: '${entry.routePath}', sourceFile: '${entry.sourceFile}', kind: 'content', resolveJsonLd: () => ${JSON.stringify(entry.jsonLd)} }],`);
71
- });
72
- lines.push("]);");
73
- lines.push("");
74
- return lines.join("\n");
75
- }
76
- function toImportPath(outFile, sourceFile) {
77
- const relativePath = normalizePath(relative(dirname(outFile), sourceFile.replace(/^\//, "").replace(/\.(ts|js|analog|ag)$/, "")));
78
- if (relativePath.startsWith(".")) return relativePath;
79
- return `./${relativePath}`;
80
- }
81
- //#endregion
82
- export { detectJsonLdModuleExports, extractMarkdownJsonLd, generateJsonLdManifestSource };
83
-
84
- //# sourceMappingURL=json-ld-manifest-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-ld-manifest-plugin.js","names":[],"sources":["../../../src/lib/json-ld-manifest-plugin.ts"],"sourcesContent":["import fm from 'front-matter';\nimport { normalizePath } from 'vite';\nimport { dirname, relative } from 'node:path';\n\nimport { normalizeJsonLd, type JsonLdObject } from './route-manifest.js';\n\nexport type JsonLdModuleManifestEntry = {\n kind: 'module';\n routePath: string;\n sourceFile: string;\n importAlias: string;\n};\n\nexport type JsonLdContentManifestEntry = {\n kind: 'content';\n routePath: string;\n sourceFile: string;\n jsonLd: JsonLdObject[];\n};\n\nexport type JsonLdManifestEntry =\n | JsonLdModuleManifestEntry\n | JsonLdContentManifestEntry;\n\n/**\n * Heuristic detector for JSON-LD exports in route modules.\n *\n * This is intentionally regex-based for speed during file scanning.\n * It reliably detects these direct export patterns:\n *\n * - `export const routeJsonLd = ...`\n * - `export const routeMeta = { ..., jsonLd: ... }`\n * - `export const routeJsonLd = (route) => ...` (function form)\n *\n * Known limitations (not detected):\n *\n * - re-exports: `export { routeJsonLd } from './data'`\n * - aliased exports: `export { something as routeJsonLd }`\n * - default exports: `export default { jsonLd: ... }`\n * - indirect assignment: `const data = { jsonLd: ... }; export const routeMeta = data`\n *\n * Known false-positive risks:\n *\n * - comment text containing `export const routeJsonLd`\n * - unrelated `jsonLd` text appearing after `export const routeMeta`\n *\n * Prefer the supported direct export patterns listed above.\n */\nexport function detectJsonLdModuleExports(fileContent: string): boolean {\n return (\n /export\\s+const\\s+routeJsonLd\\b/.test(fileContent) ||\n /export\\s+const\\s+routeMeta\\b[\\s\\S]*?\\bjsonLd\\b/.test(fileContent)\n );\n}\n\nexport function extractMarkdownJsonLd(rawContent: string): JsonLdObject[] {\n const { attributes } = fm<Record<string, unknown>>(rawContent);\n return normalizeJsonLd(attributes['jsonLd']);\n}\n\nexport function generateJsonLdManifestSource(\n entries: JsonLdManifestEntry[],\n outFile: string,\n): string {\n const lines: string[] = [];\n const moduleEntries = entries.filter(\n (entry): entry is JsonLdModuleManifestEntry => entry.kind === 'module',\n );\n\n lines.push('// This file is auto-generated by @analogjs/platform');\n lines.push('// Do not edit manually');\n lines.push('');\n\n lines.push(\"import type { Graph, Thing, WithContext } from 'schema-dts';\");\n\n moduleEntries.forEach((entry) => {\n lines.push(\n `import * as ${entry.importAlias} from '${toImportPath(outFile, entry.sourceFile)}';`,\n );\n });\n\n lines.push('');\n lines.push(\n 'export type AnalogJsonLdDocument = WithContext<Thing> | Graph | Array<WithContext<Thing>>;',\n );\n lines.push(\n \"export type GeneratedJsonLdManifestEntry = { routePath: string; sourceFile: string; kind: 'module' | 'content'; resolveJsonLd: () => AnalogJsonLdDocument[]; };\",\n );\n lines.push('');\n lines.push(\n 'function normalizeJsonLd(value: unknown): AnalogJsonLdDocument[] {',\n );\n lines.push(' if (Array.isArray(value)) {');\n lines.push(\n \" return value.filter((entry): entry is AnalogJsonLdDocument => typeof entry === 'object' && entry !== null && !Array.isArray(entry));\",\n );\n lines.push(' }');\n lines.push('');\n lines.push(\n \" return typeof value === 'object' && value !== null ? [value as AnalogJsonLdDocument] : [];\",\n );\n lines.push('}');\n lines.push('');\n lines.push(\n 'function resolveModuleJsonLd(routeModule: unknown): AnalogJsonLdDocument[] {',\n );\n lines.push(\n ' const typedRouteModule = routeModule as { routeJsonLd?: unknown; routeMeta?: { jsonLd?: unknown } };',\n );\n lines.push(\n // Match runtime precedence (mergeRouteJsonLdIntoRouteMeta in routes.ts):\n // routeMeta.jsonLd wins over standalone routeJsonLd.\n ' return normalizeJsonLd(typedRouteModule.routeMeta?.jsonLd ?? typedRouteModule.routeJsonLd);',\n );\n lines.push('}');\n lines.push('');\n lines.push(\n 'export const routeJsonLdManifest = new Map<string, GeneratedJsonLdManifestEntry>([',\n );\n\n entries.forEach((entry) => {\n if (entry.kind === 'module') {\n lines.push(\n ` ['${entry.routePath}', { routePath: '${entry.routePath}', sourceFile: '${entry.sourceFile}', kind: 'module', resolveJsonLd: () => resolveModuleJsonLd(${entry.importAlias}) }],`,\n );\n return;\n }\n\n lines.push(\n ` ['${entry.routePath}', { routePath: '${entry.routePath}', sourceFile: '${entry.sourceFile}', kind: 'content', resolveJsonLd: () => ${JSON.stringify(entry.jsonLd)} }],`,\n );\n });\n\n lines.push(']);');\n lines.push('');\n\n return lines.join('\\n');\n}\n\nfunction toImportPath(outFile: string, sourceFile: string): string {\n // JSON-LD entries are emitted inside the same generated route module, so\n // imports are always resolved relative to that single output file.\n const fromDir = dirname(outFile);\n const sourceNoExt = sourceFile\n .replace(/^\\//, '')\n .replace(/\\.(ts|js|analog|ag)$/, '');\n const relativePath = normalizePath(relative(fromDir, sourceNoExt));\n\n if (relativePath.startsWith('.')) {\n return relativePath;\n }\n\n return `./${relativePath}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,0BAA0B,aAA8B;AACtE,QACE,iCAAiC,KAAK,YAAY,IAClD,iDAAiD,KAAK,YAAY;;AAItE,SAAgB,sBAAsB,YAAoC;CACxE,MAAM,EAAE,eAAe,GAA4B,WAAW;AAC9D,QAAO,gBAAgB,WAAW,UAAU;;AAG9C,SAAgB,6BACd,SACA,SACQ;CACR,MAAM,QAAkB,EAAE;CAC1B,MAAM,gBAAgB,QAAQ,QAC3B,UAA8C,MAAM,SAAS,SAC/D;AAED,OAAM,KAAK,uDAAuD;AAClE,OAAM,KAAK,0BAA0B;AACrC,OAAM,KAAK,GAAG;AAEd,OAAM,KAAK,+DAA+D;AAE1E,eAAc,SAAS,UAAU;AAC/B,QAAM,KACJ,eAAe,MAAM,YAAY,SAAS,aAAa,SAAS,MAAM,WAAW,CAAC,IACnF;GACD;AAEF,OAAM,KAAK,GAAG;AACd,OAAM,KACJ,6FACD;AACD,OAAM,KACJ,kKACD;AACD,OAAM,KAAK,GAAG;AACd,OAAM,KACJ,qEACD;AACD,OAAM,KAAK,gCAAgC;AAC3C,OAAM,KACJ,2IACD;AACD,OAAM,KAAK,MAAM;AACjB,OAAM,KAAK,GAAG;AACd,OAAM,KACJ,+FACD;AACD,OAAM,KAAK,IAAI;AACf,OAAM,KAAK,GAAG;AACd,OAAM,KACJ,+EACD;AACD,OAAM,KACJ,yGACD;AACD,OAAM,KAGJ,gGACD;AACD,OAAM,KAAK,IAAI;AACf,OAAM,KAAK,GAAG;AACd,OAAM,KACJ,qFACD;AAED,SAAQ,SAAS,UAAU;AACzB,MAAI,MAAM,SAAS,UAAU;AAC3B,SAAM,KACJ,OAAO,MAAM,UAAU,mBAAmB,MAAM,UAAU,kBAAkB,MAAM,WAAW,8DAA8D,MAAM,YAAY,OAC9K;AACD;;AAGF,QAAM,KACJ,OAAO,MAAM,UAAU,mBAAmB,MAAM,UAAU,kBAAkB,MAAM,WAAW,2CAA2C,KAAK,UAAU,MAAM,OAAO,CAAC,MACtK;GACD;AAEF,OAAM,KAAK,MAAM;AACjB,OAAM,KAAK,GAAG;AAEd,QAAO,MAAM,KAAK,KAAK;;AAGzB,SAAS,aAAa,SAAiB,YAA4B;CAOjE,MAAM,eAAe,cAAc,SAJnB,QAAQ,QAAQ,EACZ,WACjB,QAAQ,OAAO,GAAG,CAClB,QAAQ,wBAAwB,GAAG,CAC2B,CAAC;AAElE,KAAI,aAAa,WAAW,IAAI,CAC9B,QAAO;AAGT,QAAO,KAAK"}
@@ -1,3 +0,0 @@
1
- import type { Plugin } from "vite";
2
- import type { Options } from "./options.js";
3
- export declare function routeGenerationPlugin(options?: Options): Plugin;
@@ -1,45 +0,0 @@
1
- import { debugTypedRouter } from "./utils/debug.js";
2
- import { typedRoutes } from "./typed-routes-plugin.js";
3
- //#region packages/platform/src/lib/route-generation-plugin.ts
4
- function resolveTypedRouterOptions(experimental) {
5
- const typedRouter = experimental?.typedRouter;
6
- if (!typedRouter) return {
7
- enabled: false,
8
- options: {}
9
- };
10
- if (typedRouter === true) return {
11
- enabled: true,
12
- options: { jsonLdManifest: true }
13
- };
14
- return {
15
- enabled: true,
16
- options: {
17
- ...typedRouter,
18
- jsonLdManifest: typedRouter.jsonLdManifest ?? true
19
- }
20
- };
21
- }
22
- function routeGenerationPlugin(options) {
23
- const { enabled, options: typedRouterOptions } = resolveTypedRouterOptions(options?.experimental);
24
- if (!enabled) {
25
- debugTypedRouter("disabled by experimental.typedRouter === false");
26
- return { name: "analog-route-generation-disabled" };
27
- }
28
- const pluginOptions = {
29
- ...typedRouterOptions,
30
- workspaceRoot: options?.workspaceRoot,
31
- additionalPagesDirs: options?.additionalPagesDirs,
32
- additionalContentDirs: options?.additionalContentDirs
33
- };
34
- debugTypedRouter("enabled", {
35
- outFile: pluginOptions.outFile,
36
- jsonLdManifest: pluginOptions.jsonLdManifest,
37
- additionalPagesDirs: pluginOptions.additionalPagesDirs,
38
- additionalContentDirs: pluginOptions.additionalContentDirs
39
- });
40
- return typedRoutes(pluginOptions);
41
- }
42
- //#endregion
43
- export { routeGenerationPlugin };
44
-
45
- //# sourceMappingURL=route-generation-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"route-generation-plugin.js","names":[],"sources":["../../../src/lib/route-generation-plugin.ts"],"sourcesContent":["import type { Plugin } from 'vite';\n\nimport type { Options, TypedRouterOptions } from './options.js';\nimport {\n typedRoutes,\n type TypedRoutesPluginOptions,\n} from './typed-routes-plugin.js';\nimport { debugTypedRouter } from './utils/debug.js';\n\nfunction resolveTypedRouterOptions(experimental: Options['experimental']): {\n enabled: boolean;\n options: TypedRouterOptions;\n} {\n const typedRouter = experimental?.typedRouter;\n if (!typedRouter) {\n return { enabled: false, options: {} };\n }\n if (typedRouter === true) {\n return { enabled: true, options: { jsonLdManifest: true } };\n }\n return {\n enabled: true,\n options: {\n ...typedRouter,\n jsonLdManifest: typedRouter.jsonLdManifest ?? true,\n },\n };\n}\n\nexport function routeGenerationPlugin(options?: Options): Plugin {\n const { enabled, options: typedRouterOptions } = resolveTypedRouterOptions(\n options?.experimental,\n );\n\n if (!enabled) {\n debugTypedRouter('disabled by experimental.typedRouter === false');\n return {\n name: 'analog-route-generation-disabled',\n };\n }\n\n const pluginOptions: TypedRoutesPluginOptions = {\n ...typedRouterOptions,\n workspaceRoot: options?.workspaceRoot,\n additionalPagesDirs: options?.additionalPagesDirs,\n additionalContentDirs: options?.additionalContentDirs,\n };\n debugTypedRouter('enabled', {\n outFile: pluginOptions.outFile,\n jsonLdManifest: pluginOptions.jsonLdManifest,\n additionalPagesDirs: pluginOptions.additionalPagesDirs,\n additionalContentDirs: pluginOptions.additionalContentDirs,\n });\n\n return typedRoutes(pluginOptions);\n}\n"],"mappings":";;;AASA,SAAS,0BAA0B,cAGjC;CACA,MAAM,cAAc,cAAc;AAClC,KAAI,CAAC,YACH,QAAO;EAAE,SAAS;EAAO,SAAS,EAAE;EAAE;AAExC,KAAI,gBAAgB,KAClB,QAAO;EAAE,SAAS;EAAM,SAAS,EAAE,gBAAgB,MAAM;EAAE;AAE7D,QAAO;EACL,SAAS;EACT,SAAS;GACP,GAAG;GACH,gBAAgB,YAAY,kBAAkB;GAC/C;EACF;;AAGH,SAAgB,sBAAsB,SAA2B;CAC/D,MAAM,EAAE,SAAS,SAAS,uBAAuB,0BAC/C,SAAS,aACV;AAED,KAAI,CAAC,SAAS;AACZ,mBAAiB,iDAAiD;AAClE,SAAO,EACL,MAAM,oCACP;;CAGH,MAAM,gBAA0C;EAC9C,GAAG;EACH,eAAe,SAAS;EACxB,qBAAqB,SAAS;EAC9B,uBAAuB,SAAS;EACjC;AACD,kBAAiB,WAAW;EAC1B,SAAS,cAAc;EACvB,gBAAgB,cAAc;EAC9B,qBAAqB,cAAc;EACnC,uBAAuB,cAAc;EACtC,CAAC;AAEF,QAAO,YAAY,cAAc"}