@analogjs/platform 3.0.0-alpha.8 → 3.0.0-alpha.80
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/migrations/migration.json +7 -1
- package/package.json +27 -24
- package/src/index.d.ts +5 -2
- package/src/index.js +9 -3
- package/src/index.js.map +1 -0
- package/src/lib/clear-client-page-endpoint.d.ts +2 -2
- package/src/lib/clear-client-page-endpoint.js +44 -34
- package/src/lib/clear-client-page-endpoint.js.map +1 -0
- package/src/lib/content/marked/index.d.ts +5 -5
- package/src/lib/content/marked/index.js +10 -6
- package/src/lib/content/marked/index.js.map +1 -0
- package/src/lib/content/marked/marked-content-highlighter.d.ts +2 -2
- package/src/lib/content/marked/marked-content-highlighter.js +6 -3
- package/src/lib/content/marked/marked-content-highlighter.js.map +1 -0
- package/src/lib/content/marked/marked-setup.service.d.ts +8 -8
- package/src/lib/content/marked/marked-setup.service.js +44 -54
- package/src/lib/content/marked/marked-setup.service.js.map +1 -0
- package/src/lib/content/prism/angular.js +18 -19
- package/src/lib/content/prism/angular.js.map +1 -0
- package/src/lib/content/prism/index.d.ts +1 -1
- package/src/lib/content/prism/index.js +10 -7
- package/src/lib/content/prism/index.js.map +1 -0
- package/src/lib/content/prism/options.d.ts +1 -1
- package/src/lib/content/prism/prism-highlighter.d.ts +5 -5
- package/src/lib/content/prism/prism-highlighter.js +33 -33
- package/src/lib/content/prism/prism-highlighter.js.map +1 -0
- package/src/lib/content/shiki/index.d.ts +3 -3
- package/src/lib/content/shiki/index.js +22 -28
- package/src/lib/content/shiki/index.js.map +1 -0
- package/src/lib/content/shiki/options.d.ts +8 -7
- package/src/lib/content/shiki/shiki-highlighter.d.ts +14 -13
- package/src/lib/content/shiki/shiki-highlighter.js +49 -43
- package/src/lib/content/shiki/shiki-highlighter.js.map +1 -0
- package/src/lib/content-plugin.d.ts +19 -19
- package/src/lib/content-plugin.js +181 -223
- package/src/lib/content-plugin.js.map +1 -0
- package/src/lib/deps-plugin.d.ts +2 -2
- package/src/lib/deps-plugin.js +84 -78
- package/src/lib/deps-plugin.js.map +1 -0
- package/src/lib/discover-library-routes.d.ts +19 -0
- package/src/lib/discover-library-routes.js +72 -0
- package/src/lib/discover-library-routes.js.map +1 -0
- package/src/lib/i18n-component-registry-plugin.d.ts +17 -0
- package/src/lib/i18n-component-registry-plugin.js +100 -0
- package/src/lib/i18n-component-registry-plugin.js.map +1 -0
- package/src/lib/i18n-extract-plugin.d.ts +33 -0
- package/src/lib/inject-server-fn-ids.d.ts +17 -0
- package/src/lib/inject-server-fn-ids.js +94 -0
- package/src/lib/inject-server-fn-ids.js.map +1 -0
- package/src/lib/json-ld-manifest-plugin.d.ts +41 -0
- package/src/lib/json-ld-manifest-plugin.js +84 -0
- package/src/lib/json-ld-manifest-plugin.js.map +1 -0
- package/src/lib/library-pages-plugin.d.ts +8 -0
- package/src/lib/library-pages-plugin.js +21 -0
- package/src/lib/library-pages-plugin.js.map +1 -0
- package/src/lib/nitro/analog-nitro-plugin.d.ts +18 -0
- package/src/lib/nitro/analog-nitro-plugin.js +555 -0
- package/src/lib/nitro/analog-nitro-plugin.js.map +1 -0
- package/src/lib/nitro/angular-linker-plugin.d.ts +17 -0
- package/src/lib/nitro/angular-linker-plugin.js +51 -0
- package/src/lib/nitro/angular-linker-plugin.js.map +1 -0
- package/src/lib/nitro/build-sitemap.d.ts +23 -0
- package/src/lib/nitro/build-sitemap.js +137 -0
- package/src/lib/nitro/build-sitemap.js.map +1 -0
- package/src/lib/nitro/debug.d.ts +5 -0
- package/src/lib/nitro/debug.js +11 -0
- package/src/lib/nitro/debug.js.map +1 -0
- package/src/lib/nitro/get-content-files.d.ts +13 -0
- package/src/lib/nitro/get-content-files.js +52 -0
- package/src/lib/nitro/get-content-files.js.map +1 -0
- package/src/lib/nitro/get-page-handlers.d.ts +22 -0
- package/src/lib/nitro/get-page-handlers.js +33 -0
- package/src/lib/nitro/get-page-handlers.js.map +1 -0
- package/src/lib/nitro/i18n-prerender.d.ts +29 -0
- package/src/lib/nitro/i18n-prerender.js +61 -0
- package/src/lib/nitro/i18n-prerender.js.map +1 -0
- package/src/lib/nitro/page-endpoints-plugin.d.ts +7 -0
- package/src/lib/nitro/page-endpoints-plugin.js +72 -0
- package/src/lib/nitro/page-endpoints-plugin.js.map +1 -0
- package/src/lib/nitro/post-rendering-hook.d.ts +2 -0
- package/src/lib/nitro/post-rendering-hook.js +10 -0
- package/src/lib/nitro/post-rendering-hook.js.map +1 -0
- package/src/lib/nitro/renderers.d.ts +33 -0
- package/src/lib/nitro/renderers.js +22 -0
- package/src/lib/nitro/renderers.js.map +1 -0
- package/src/lib/nitro/types.d.ts +122 -0
- package/src/lib/nx-plugin/_virtual/_rolldown/runtime.js +23 -0
- package/src/lib/nx-plugin/builders.json +15 -0
- package/src/lib/nx-plugin/executors.json +13 -5
- package/src/lib/nx-plugin/generators.json +25 -0
- package/src/lib/nx-plugin/node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/camelCase.js +13 -0
- package/src/lib/nx-plugin/node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/camelCase.js.map +1 -0
- package/src/lib/nx-plugin/node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/capitalize.js +8 -0
- package/src/lib/nx-plugin/node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/capitalize.js.map +1 -0
- package/src/lib/nx-plugin/node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/words.js +9 -0
- package/src/lib/nx-plugin/node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/words.js.map +1 -0
- package/src/lib/nx-plugin/package.json +1 -5
- package/src/lib/nx-plugin/src/builders/vite/schema.json +39 -0
- package/src/lib/nx-plugin/src/builders/vite/vite-build.d.ts +11 -0
- package/src/lib/nx-plugin/src/builders/vite/vite-build.js +18 -0
- package/src/lib/nx-plugin/src/builders/vite/vite-build.js.map +1 -0
- package/src/lib/nx-plugin/src/builders/vite-dev-server/dev-server.d.ts +7 -0
- package/src/lib/nx-plugin/src/builders/vite-dev-server/dev-server.js +14 -0
- package/src/lib/nx-plugin/src/builders/vite-dev-server/dev-server.js.map +1 -0
- package/src/lib/nx-plugin/src/builders/vite-dev-server/schema.json +27 -0
- package/src/lib/nx-plugin/src/executors/vite-dev-server/compat.d.ts +1 -1
- package/src/lib/nx-plugin/src/executors/vite-dev-server/compat.js +7 -7
- package/src/lib/nx-plugin/src/executors/vite-dev-server/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/executors/vite-dev-server/schema.d.ts +1 -1
- package/src/lib/nx-plugin/src/executors/vite-dev-server/vite-dev-server.impl.d.ts +1 -1
- package/src/lib/nx-plugin/src/executors/vite-dev-server/vite-dev-server.impl.js +6 -4
- package/src/lib/nx-plugin/src/executors/vite-dev-server/vite-dev-server.impl.js.map +1 -1
- package/src/lib/nx-plugin/src/executors/vitest/compat.d.ts +1 -1
- package/src/lib/nx-plugin/src/executors/vitest/compat.js +7 -7
- package/src/lib/nx-plugin/src/executors/vitest/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/executors/vitest/schema.d.ts +1 -1
- package/src/lib/nx-plugin/src/executors/vitest/vitest.impl.d.ts +1 -1
- package/src/lib/nx-plugin/src/executors/vitest/vitest.impl.js +6 -4
- package/src/lib/nx-plugin/src/executors/vitest/vitest.impl.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/compat.d.ts +9 -3
- package/src/lib/nx-plugin/src/generators/app/compat.js +18 -7
- package/src/lib/nx-plugin/src/generators/app/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/files/agents/AGENTS.md +11 -0
- package/src/lib/nx-plugin/src/generators/app/files/agents/CLAUDE.md +1 -0
- package/src/lib/nx-plugin/src/generators/app/files/root/tsconfig.base.json +3 -6
- package/src/lib/nx-plugin/src/generators/app/files/template-angular/src/test-setup.ts__template__ +1 -0
- package/src/lib/nx-plugin/src/generators/app/files/template-angular/tsconfig.app.json__template__ +1 -3
- package/src/lib/nx-plugin/src/generators/app/files/template-angular/tsconfig.json__template__ +2 -1
- package/src/lib/nx-plugin/src/generators/app/files/template-angular/vite.config.ts__template__ +6 -2
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v17/src/app/app.config.ts__template__ +0 -6
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v17/tsconfig.json__template__ +4 -2
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v17/vite.config.ts__template__ +1 -21
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v18/src/app/app.config.ts__template__ +0 -6
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v18/tsconfig.json__template__ +4 -2
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v18/vite.config.ts__template__ +2 -22
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v19/src/app/app.config.ts__template__ +0 -6
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v19/tsconfig.app.json__template__ +1 -3
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v19/tsconfig.json__template__ +4 -2
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v19/vite.config.ts__template__ +1 -12
- package/src/lib/nx-plugin/src/generators/app/generator.d.ts +11 -11
- package/src/lib/nx-plugin/src/generators/app/generator.js +81 -92
- package/src/lib/nx-plugin/src/generators/app/generator.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-agent-context.d.ts +2 -0
- package/src/lib/nx-plugin/src/generators/app/lib/add-agent-context.js +16 -0
- package/src/lib/nx-plugin/src/generators/app/lib/add-agent-context.js.map +1 -0
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-dependencies.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-project-config.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-project-config.js +73 -81
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-project-config.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-angular-app.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/app/lib/add-angular-app.js +25 -58
- package/src/lib/nx-plugin/src/generators/app/lib/add-angular-app.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-eslint.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/app/lib/add-files.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/app/lib/add-files.js +16 -16
- package/src/lib/nx-plugin/src/generators/app/lib/add-files.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-home-page.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/app/lib/add-home-page.js +15 -13
- package/src/lib/nx-plugin/src/generators/app/lib/add-home-page.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-config.d.ts +7 -7
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-config.js +19 -29
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-config.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-helpers.d.ts +4 -5
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-helpers.js +61 -103
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-helpers.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-vite-plugin.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/cleanup-files.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/app/lib/cleanup-files.js +17 -20
- package/src/lib/nx-plugin/src/generators/app/lib/cleanup-files.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/initialize-analog-workspace.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/app/lib/update-index-html.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/update-index-html.js +15 -18
- package/src/lib/nx-plugin/src/generators/app/lib/update-index-html.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/schema.d.ts +2 -0
- package/src/lib/nx-plugin/src/generators/app/versions/minimum-supported-versions.d.ts +2 -3
- package/src/lib/nx-plugin/src/generators/app/versions/minimum-supported-versions.js +7 -10
- package/src/lib/nx-plugin/src/generators/app/versions/minimum-supported-versions.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/versions/nx-dependencies.d.ts +0 -3
- package/src/lib/nx-plugin/src/generators/app/versions/nx_17_X/versions.d.ts +1 -6
- package/src/lib/nx-plugin/src/generators/app/versions/nx_18_X/versions.d.ts +12 -17
- package/src/lib/nx-plugin/src/generators/app/versions/nx_18_X/versions.js +11 -37
- package/src/lib/nx-plugin/src/generators/app/versions/nx_18_X/versions.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/versions/tailwind-dependencies.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/app/versions/tailwind-dependencies.js +11 -15
- package/src/lib/nx-plugin/src/generators/app/versions/tailwind-dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/versions.d.ts +0 -28
- package/src/lib/nx-plugin/src/generators/init/compat.d.ts +9 -3
- package/src/lib/nx-plugin/src/generators/init/compat.js +18 -7
- package/src/lib/nx-plugin/src/generators/init/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/files/vite.config.ts__template__ +2 -6
- package/src/lib/nx-plugin/src/generators/init/generator.d.ts +3 -3
- package/src/lib/nx-plugin/src/generators/init/generator.js +55 -65
- package/src/lib/nx-plugin/src/generators/init/generator.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/add-analog-dependencies.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/add-analog-dependencies.js +20 -20
- package/src/lib/nx-plugin/src/generators/init/lib/add-analog-dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-app-tsconfig.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-app-tsconfig.js +21 -21
- package/src/lib/nx-plugin/src/generators/init/lib/update-app-tsconfig.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-build-target.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-build-target.js +57 -66
- package/src/lib/nx-plugin/src/generators/init/lib/update-build-target.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-git-ignore.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-git-ignore.js +12 -11
- package/src/lib/nx-plugin/src/generators/init/lib/update-git-ignore.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-index-html.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-index-html.js +18 -21
- package/src/lib/nx-plugin/src/generators/init/lib/update-index-html.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-main.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-main.js +13 -15
- package/src/lib/nx-plugin/src/generators/init/lib/update-main.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-package-json.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-package-json.js +20 -31
- package/src/lib/nx-plugin/src/generators/init/lib/update-package-json.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-serve-target.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-serve-target.js +44 -51
- package/src/lib/nx-plugin/src/generators/init/lib/update-serve-target.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-test-target.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-test-target.js +28 -34
- package/src/lib/nx-plugin/src/generators/init/lib/update-test-target.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-test-tsconfig.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-test-tsconfig.js +20 -20
- package/src/lib/nx-plugin/src/generators/init/lib/update-test-tsconfig.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/test-files/src/test-setup.ts__template__ +1 -0
- package/src/lib/nx-plugin/src/generators/page/__snapshots__/generator.spec.ts.snap +0 -7
- package/src/lib/nx-plugin/src/generators/page/compat.d.ts +9 -0
- package/src/lib/nx-plugin/src/generators/page/compat.js +19 -0
- package/src/lib/nx-plugin/src/generators/page/compat.js.map +1 -0
- package/src/lib/nx-plugin/src/generators/page/files/__fileName__.page.ts__template__ +0 -1
- package/src/lib/nx-plugin/src/generators/page/generator.d.ts +3 -4
- package/src/lib/nx-plugin/src/generators/page/generator.js +35 -44
- package/src/lib/nx-plugin/src/generators/page/generator.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/preset/__snapshots__/generator.spec.ts.snap +8 -7
- package/src/lib/nx-plugin/src/generators/preset/generator.d.ts +3 -3
- package/src/lib/nx-plugin/src/generators/preset/generator.js +24 -43
- package/src/lib/nx-plugin/src/generators/preset/generator.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/setup-vitest/compat.d.ts +9 -3
- package/src/lib/nx-plugin/src/generators/setup-vitest/compat.js +18 -7
- package/src/lib/nx-plugin/src/generators/setup-vitest/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/setup-vitest/files/src/test-setup.ts__template__ +1 -0
- package/src/lib/nx-plugin/src/generators/setup-vitest/files/vite.config.mts__template__ +0 -6
- package/src/lib/nx-plugin/src/generators/setup-vitest/generator.d.ts +3 -3
- package/src/lib/nx-plugin/src/generators/setup-vitest/generator.js +33 -42
- package/src/lib/nx-plugin/src/generators/setup-vitest/generator.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/add-analog-dependencies.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/add-analog-dependencies.js +8 -7
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/add-analog-dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/update-test-target.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/update-test-target.js +21 -27
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/update-test-target.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/update-tsconfig.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/update-tsconfig.js +20 -22
- package/src/lib/nx-plugin/src/generators/setup-vitest/lib/update-tsconfig.js.map +1 -1
- package/src/lib/nx-plugin/src/index.js +0 -2
- package/src/lib/nx-plugin/src/utils/version-utils.d.ts +1 -1
- package/src/lib/nx-plugin/src/utils/version-utils.js +21 -27
- package/src/lib/nx-plugin/src/utils/version-utils.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/dependencies.js +43 -62
- package/src/lib/nx-plugin/src/utils/versions/dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/dev-dependencies.js +50 -83
- package/src/lib/nx-plugin/src/utils/versions/dev-dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/ng_17_X/versions.d.ts +1 -1
- package/src/lib/nx-plugin/src/utils/versions/ng_17_X/versions.js +33 -20
- package/src/lib/nx-plugin/src/utils/versions/ng_17_X/versions.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/ng_18_X/versions.d.ts +1 -1
- package/src/lib/nx-plugin/src/utils/versions/ng_18_X/versions.js +33 -20
- package/src/lib/nx-plugin/src/utils/versions/ng_18_X/versions.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/ng_19_X/versions.d.ts +9 -8
- package/src/lib/nx-plugin/src/utils/versions/ng_19_X/versions.js +39 -23
- package/src/lib/nx-plugin/src/utils/versions/ng_19_X/versions.js.map +1 -1
- package/src/lib/options.d.ts +165 -84
- package/src/lib/platform-plugin.d.ts +2 -2
- package/src/lib/platform-plugin.js +45 -65
- package/src/lib/platform-plugin.js.map +1 -0
- package/src/lib/route-file-discovery.d.ts +23 -0
- package/src/lib/route-file-discovery.js +114 -0
- package/src/lib/route-file-discovery.js.map +1 -0
- package/src/lib/route-generation-plugin.d.ts +3 -0
- package/src/lib/route-generation-plugin.js +45 -0
- package/src/lib/route-generation-plugin.js.map +1 -0
- package/src/lib/route-idiom-diagnostics.d.ts +13 -0
- package/src/lib/route-idiom-diagnostics.js +160 -0
- package/src/lib/route-idiom-diagnostics.js.map +1 -0
- package/src/lib/route-manifest.d.ts +122 -0
- package/src/lib/route-manifest.js +431 -0
- package/src/lib/route-manifest.js.map +1 -0
- package/src/lib/router-plugin.d.ts +19 -19
- package/src/lib/router-plugin.js +229 -185
- package/src/lib/router-plugin.js.map +1 -0
- package/src/lib/server-fn-client-transform.d.ts +26 -0
- package/src/lib/server-fn-client-transform.js +97 -0
- package/src/lib/server-fn-client-transform.js.map +1 -0
- package/src/lib/server-fn-id.d.ts +25 -0
- package/src/lib/server-fn-id.js +37 -0
- package/src/lib/server-fn-id.js.map +1 -0
- package/src/lib/ssr/defer-streaming-plugin.d.ts +65 -0
- package/src/lib/ssr/inject-html-plugin.d.ts +1 -1
- package/src/lib/ssr/inject-html-plugin.js +25 -25
- package/src/lib/ssr/inject-html-plugin.js.map +1 -0
- package/src/lib/ssr/ssr-build-plugin.d.ts +24 -16
- package/src/lib/ssr/ssr-build-plugin.js +37 -88
- package/src/lib/ssr/ssr-build-plugin.js.map +1 -0
- package/src/lib/typed-routes-plugin.d.ts +50 -0
- package/src/lib/typed-routes-plugin.js +234 -0
- package/src/lib/typed-routes-plugin.js.map +1 -0
- 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 +20 -0
- package/src/lib/utils/debug.js +24 -0
- package/src/lib/utils/debug.js.map +1 -0
- package/src/lib/utils/rolldown.d.ts +2 -2
- package/src/lib/utils/rolldown.js +12 -8
- package/src/lib/utils/rolldown.js.map +1 -0
- package/src/server-mode-plugin.d.ts +5 -5
- package/src/server-mode-plugin.js +16 -20
- package/src/server-mode-plugin.js.map +1 -0
- package/README.md +0 -5
- package/src/lib/content/prism/options.js +0 -1
- package/src/lib/content/shiki/options.js +0 -1
- package/src/lib/nx-plugin/README.md +0 -23
- package/src/lib/nx-plugin/src/executors/vite/compat.d.ts +0 -3
- package/src/lib/nx-plugin/src/executors/vite/compat.js +0 -8
- package/src/lib/nx-plugin/src/executors/vite/compat.js.map +0 -1
- package/src/lib/nx-plugin/src/executors/vite/schema.d.ts +0 -2
- package/src/lib/nx-plugin/src/executors/vite/schema.json +0 -147
- package/src/lib/nx-plugin/src/executors/vite/vite.impl.d.ts +0 -2
- package/src/lib/nx-plugin/src/executors/vite/vite.impl.js +0 -5
- package/src/lib/nx-plugin/src/executors/vite/vite.impl.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/files/tailwind/v4/.postcssrc.json +0 -5
- package/src/lib/nx-plugin/src/generators/app/files/tailwind/v4/tailwind.config.ts__template__ +0 -14
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/index.html__template__ +0 -15
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/app/app.component.spec.ts__template__ +0 -17
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/app/app.component.ts__template__ +0 -10
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/favicon.ico__template__ +0 -0
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/main.providers.ts__template__ +0 -5
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/main.server.ts__template__ +0 -23
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/main.ts__template__ +0 -17
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/public/assets/.gitkeep__template__ +0 -0
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/public/assets/analog.svg__template__ +0 -1
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/public/assets/vite.svg__template__ +0 -1
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/server/routes/v1/hello.ts__template__ +0 -3
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/styles.css__template__ +0 -4
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/test-setup.ts__template__ +0 -12
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/vite-env.d.ts__template__ +0 -1
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/tsconfig.app.json__template__ +0 -16
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/tsconfig.editor.json__template__ +0 -7
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/tsconfig.json__template__ +0 -32
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/tsconfig.spec.json__template__ +0 -14
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/vite.config.ts__template__ +0 -69
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-dependencies.js +0 -15
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-dependencies.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-eslint.js +0 -58
- package/src/lib/nx-plugin/src/generators/app/lib/add-eslint.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-vite-plugin.js +0 -47
- package/src/lib/nx-plugin/src/generators/app/lib/add-vite-plugin.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/lib/initialize-analog-workspace.js +0 -110
- package/src/lib/nx-plugin/src/generators/app/lib/initialize-analog-workspace.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/versions/dependencies.js +0 -56
- package/src/lib/nx-plugin/src/generators/app/versions/dependencies.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/versions/dev-dependencies.js +0 -72
- package/src/lib/nx-plugin/src/generators/app/versions/dev-dependencies.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/versions/nx-dependencies.js +0 -46
- package/src/lib/nx-plugin/src/generators/app/versions/nx-dependencies.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/versions/nx_17_X/versions.js +0 -37
- package/src/lib/nx-plugin/src/generators/app/versions/nx_17_X/versions.js.map +0 -1
- package/src/lib/nx-plugin/src/generators/app/versions.js +0 -43
- package/src/lib/nx-plugin/src/generators/app/versions.js.map +0 -1
- package/src/lib/nx-plugin/src/index.d.ts +0 -0
- package/src/lib/nx-plugin/src/index.js.map +0 -1
- package/src/lib/options.js +0 -1
package/src/lib/options.d.ts
CHANGED
|
@@ -1,89 +1,170 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
declare module
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import type { PrerenderRoute } from "nitro/types";
|
|
2
|
+
import type { SitemapConfig, SitemapEntry, SitemapExcludeRule, SitemapPriority, SitemapRouteDefinition, SitemapRouteInput, SitemapRouteSource, SitemapTransform, PrerenderContentDir, PrerenderContentFile, PrerenderSitemapConfig, PrerenderRouteConfig } from "./nitro/types.js";
|
|
3
|
+
import type { ContentPluginOptions } from "./content-plugin.js";
|
|
4
|
+
import type { DebugOption } from "./utils/debug.js";
|
|
5
|
+
declare module "nitro/types" {
|
|
6
|
+
interface NitroRouteConfig {
|
|
7
|
+
ssr?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Disable progressive streaming SSR for matching routes (falls back to a
|
|
10
|
+
* buffered render). Only meaningful when `experimental.streaming` is on.
|
|
11
|
+
*/
|
|
12
|
+
streaming?: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface NitroRouteRules {
|
|
15
|
+
ssr?: boolean;
|
|
16
|
+
streaming?: boolean;
|
|
17
|
+
}
|
|
12
18
|
}
|
|
13
19
|
export interface PrerenderOptions {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Add additional routes to prerender through crawling page links.
|
|
22
|
+
*/
|
|
23
|
+
discover?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* List of routes to prerender resolved statically or dynamically.
|
|
26
|
+
*/
|
|
27
|
+
routes?: (string | PrerenderContentDir | PrerenderRouteConfig)[] | (() => Promise<(string | PrerenderContentDir | PrerenderRouteConfig | undefined)[]>);
|
|
28
|
+
sitemap?: SitemapConfig;
|
|
29
|
+
/** List of functions that run for each route after pre-rendering is complete. */
|
|
30
|
+
postRenderingHooks?: ((routes: PrerenderRoute) => Promise<void>)[];
|
|
31
|
+
}
|
|
32
|
+
export interface I18nOptions {
|
|
33
|
+
/**
|
|
34
|
+
* The default/source locale for the application.
|
|
35
|
+
*/
|
|
36
|
+
defaultLocale: string;
|
|
37
|
+
/**
|
|
38
|
+
* List of supported locale identifiers (e.g. ['en', 'fr', 'de']).
|
|
39
|
+
*/
|
|
40
|
+
locales: string[];
|
|
41
|
+
/**
|
|
42
|
+
* Extract i18n messages from the build output.
|
|
43
|
+
* When enabled, writes a translation source file after the client build.
|
|
44
|
+
*/
|
|
45
|
+
extract?: {
|
|
46
|
+
/**
|
|
47
|
+
* Output format for extracted messages.
|
|
48
|
+
* @default 'json'
|
|
49
|
+
*/
|
|
50
|
+
format?: "json" | "xliff" | "xliff2" | "xmb";
|
|
51
|
+
/**
|
|
52
|
+
* Output file path for extracted messages, relative to project root.
|
|
53
|
+
* @default 'src/i18n/messages.{format extension}'
|
|
54
|
+
*/
|
|
55
|
+
outFile?: string;
|
|
56
|
+
};
|
|
25
57
|
}
|
|
26
58
|
export interface Options {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
59
|
+
ssr?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Prerender the static pages without producing the server output.
|
|
62
|
+
*/
|
|
63
|
+
static?: boolean;
|
|
64
|
+
prerender?: PrerenderOptions;
|
|
65
|
+
entryServer?: string;
|
|
66
|
+
apiPrefix?: string;
|
|
67
|
+
index?: string;
|
|
68
|
+
workspaceRoot?: string;
|
|
69
|
+
content?: ContentPluginOptions;
|
|
70
|
+
/**
|
|
71
|
+
* Enable debug logging for the `analog:platform:*` and `analog:nitro:*`
|
|
72
|
+
* scopes.
|
|
73
|
+
*
|
|
74
|
+
* - `true` → enables all platform + nitro scopes
|
|
75
|
+
* - `string[]` → enables listed namespaces
|
|
76
|
+
* - `{ scopes?, mode? }` → object form with optional `mode: 'build' | 'dev'`
|
|
77
|
+
* to restrict output to a specific Vite command (omit for both)
|
|
78
|
+
*
|
|
79
|
+
* Angular scopes (`analog:angular:*`) are owned by
|
|
80
|
+
* `@analogjs/vite-plugin-angular` — pass `debug` to `angular()` directly
|
|
81
|
+
* to enable them.
|
|
82
|
+
*
|
|
83
|
+
* Also responds to the `DEBUG` env var (Node.js) or `localStorage.debug`
|
|
84
|
+
* (browser), using the `obug` convention.
|
|
85
|
+
*/
|
|
86
|
+
debug?: DebugOption;
|
|
87
|
+
/**
|
|
88
|
+
* Additional page paths to include
|
|
89
|
+
*/
|
|
90
|
+
additionalPagesDirs?: string[];
|
|
91
|
+
/**
|
|
92
|
+
* Additional page paths to include
|
|
93
|
+
*/
|
|
94
|
+
additionalContentDirs?: string[];
|
|
95
|
+
/**
|
|
96
|
+
* Additional API paths to include
|
|
97
|
+
*/
|
|
98
|
+
additionalAPIDirs?: string[];
|
|
99
|
+
/**
|
|
100
|
+
* Generate routes from the app's route directories.
|
|
101
|
+
*
|
|
102
|
+
* Workspace library route directories are opt-in. Use
|
|
103
|
+
* `discoverLibraryRoutes()` and pass its result to `additionalPagesDirs`,
|
|
104
|
+
* `additionalContentDirs`, and `additionalAPIDirs` when an app should
|
|
105
|
+
* include routes from shared libraries.
|
|
106
|
+
*
|
|
107
|
+
* @default false
|
|
108
|
+
*/
|
|
109
|
+
discoverRoutes?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Configuration for runtime i18n support.
|
|
112
|
+
* When set, enables locale detection on SSR and provides
|
|
113
|
+
* the LOCALE injection token.
|
|
114
|
+
*/
|
|
115
|
+
i18n?: I18nOptions;
|
|
116
|
+
/**
|
|
117
|
+
* Experimental features. These APIs are subject to change.
|
|
118
|
+
*
|
|
119
|
+
* `@analogjs/platform` is the default rollout and orchestration surface for
|
|
120
|
+
* Analog-owned experiments. These flags may delegate to dedicated feature
|
|
121
|
+
* plugins or forward options into lower-level integrations while preserving
|
|
122
|
+
* a single Analog-first authoring surface.
|
|
123
|
+
*/
|
|
124
|
+
experimental?: {
|
|
125
|
+
/**
|
|
126
|
+
* Enable typed route table generation for type-safe navigation.
|
|
127
|
+
*
|
|
128
|
+
* When enabled, `@analogjs/platform` generates a single route module
|
|
129
|
+
* that augments `AnalogRouteTable` with typed params and query for each
|
|
130
|
+
* file-based route. JSON-LD manifest generation is configured on the same
|
|
131
|
+
* object so both codegen features share one generated file.
|
|
132
|
+
*
|
|
133
|
+
* - `true` — generates `src/routeTree.gen.ts` with `routeJsonLdManifest`
|
|
134
|
+
* - `TypedRouterOptions` — customize output path or disable just the
|
|
135
|
+
* JSON-LD manifest piece
|
|
136
|
+
*
|
|
137
|
+
* Unlocks type-safe usage of:
|
|
138
|
+
* - `routePath()` — build route link objects for `[routerLink]`
|
|
139
|
+
* - `injectNavigate()` — typed navigation
|
|
140
|
+
* - `injectParams(from)` — typed params signal
|
|
141
|
+
* - `injectQuery(from)` — typed query signal
|
|
142
|
+
*
|
|
143
|
+
* Inspired by TanStack Router's `routeTree.gen.ts` codegen.
|
|
144
|
+
*/
|
|
145
|
+
typedRouter?: boolean | TypedRouterOptions;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
export interface TypedRouterOptions {
|
|
149
|
+
/**
|
|
150
|
+
* Output path for the single generated route module,
|
|
151
|
+
* relative to the app root.
|
|
152
|
+
*
|
|
153
|
+
* @default 'src/routeTree.gen.ts'
|
|
154
|
+
*/
|
|
155
|
+
outFile?: string;
|
|
156
|
+
/**
|
|
157
|
+
* Include generated `routeJsonLdManifest` data in the generated route file.
|
|
158
|
+
*
|
|
159
|
+
* @default true
|
|
160
|
+
*/
|
|
161
|
+
jsonLdManifest?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Fail production builds after regenerating a stale checked-in route file.
|
|
164
|
+
* Development and watch mode continue to update the file automatically.
|
|
165
|
+
*
|
|
166
|
+
* @default true
|
|
167
|
+
*/
|
|
168
|
+
verifyOnBuild?: boolean;
|
|
88
169
|
}
|
|
89
|
-
export { PrerenderContentDir, PrerenderContentFile };
|
|
170
|
+
export type { PrerenderContentDir, PrerenderContentFile, PrerenderSitemapConfig, SitemapConfig, SitemapEntry, SitemapExcludeRule, SitemapPriority, SitemapRouteDefinition, SitemapRouteInput, SitemapRouteSource, SitemapTransform };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Plugin } from
|
|
2
|
-
import { Options } from
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
|
+
import { Options } from "./options.js";
|
|
3
3
|
export declare function platformPlugin(opts?: Options): Plugin[];
|
|
@@ -1,66 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { ssrBuildPlugin } from
|
|
5
|
-
import { contentPlugin } from
|
|
6
|
-
import { clearClientPageEndpointsPlugin } from
|
|
7
|
-
import { depsPlugin } from
|
|
8
|
-
import { injectHTMLPlugin } from
|
|
9
|
-
import { serverModePlugin } from
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { activateDeferredDebug, applyDebugOption, debugPlatform } from "./utils/debug.js";
|
|
2
|
+
import { routerPlugin } from "./router-plugin.js";
|
|
3
|
+
import { libraryPagesPlugin } from "./library-pages-plugin.js";
|
|
4
|
+
import { ssrBuildPlugin } from "./ssr/ssr-build-plugin.js";
|
|
5
|
+
import { contentPlugin } from "./content-plugin.js";
|
|
6
|
+
import { clearClientPageEndpointsPlugin } from "./clear-client-page-endpoint.js";
|
|
7
|
+
import { depsPlugin } from "./deps-plugin.js";
|
|
8
|
+
import { injectHTMLPlugin } from "./ssr/inject-html-plugin.js";
|
|
9
|
+
import { serverModePlugin } from "../server-mode-plugin.js";
|
|
10
|
+
import { routeGenerationPlugin } from "./route-generation-plugin.js";
|
|
11
|
+
import { i18nComponentRegistryPlugin } from "./i18n-component-registry-plugin.js";
|
|
12
|
+
import { analogNitroPlugin } from "./nitro/analog-nitro-plugin.js";
|
|
13
|
+
import "node:module";
|
|
14
|
+
import "node:path";
|
|
15
|
+
//#region packages/platform/src/lib/platform-plugin.ts
|
|
16
|
+
function platformPlugin(opts = {}) {
|
|
17
|
+
applyDebugOption(opts.debug, opts.workspaceRoot);
|
|
18
|
+
const isTest = process.env.NODE_ENV === "test" || !!process.env["VITEST"];
|
|
19
|
+
const { ...platformOptions } = {
|
|
20
|
+
ssr: true,
|
|
21
|
+
...opts
|
|
22
|
+
};
|
|
23
|
+
debugPlatform("experimental options resolved", { typedRouter: platformOptions.experimental?.typedRouter });
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
name: "analogjs-debug-activate",
|
|
27
|
+
config(_, { command }) {
|
|
28
|
+
activateDeferredDebug(command);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
analogNitroPlugin(platformOptions),
|
|
32
|
+
...platformOptions.ssr ? [...ssrBuildPlugin(), ...injectHTMLPlugin()] : [],
|
|
33
|
+
...!isTest ? depsPlugin(platformOptions) : [],
|
|
34
|
+
...routerPlugin(platformOptions),
|
|
35
|
+
...libraryPagesPlugin(platformOptions),
|
|
36
|
+
routeGenerationPlugin(platformOptions),
|
|
37
|
+
...contentPlugin(platformOptions?.content, platformOptions),
|
|
38
|
+
...platformOptions.i18n ? [i18nComponentRegistryPlugin()] : [],
|
|
39
|
+
...serverModePlugin(),
|
|
40
|
+
clearClientPageEndpointsPlugin()
|
|
41
|
+
];
|
|
13
42
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
...opts,
|
|
19
|
-
};
|
|
20
|
-
let nitroOptions = platformOptions?.nitro;
|
|
21
|
-
if (nitroOptions?.routeRules) {
|
|
22
|
-
nitroOptions = {
|
|
23
|
-
...nitroOptions,
|
|
24
|
-
routeRules: Object.keys(nitroOptions.routeRules).reduce((config, curr) => {
|
|
25
|
-
return {
|
|
26
|
-
...config,
|
|
27
|
-
[curr]: {
|
|
28
|
-
...config[curr],
|
|
29
|
-
headers: {
|
|
30
|
-
...config[curr].headers,
|
|
31
|
-
'x-analog-no-ssr': config[curr]?.ssr === false ? 'true' : undefined,
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
}, nitroOptions.routeRules),
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
return [
|
|
39
|
-
...externalPlugins(viteNitroPlugin(platformOptions, nitroOptions)),
|
|
40
|
-
...(platformOptions.ssr
|
|
41
|
-
? [...ssrBuildPlugin(), ...injectHTMLPlugin()]
|
|
42
|
-
: []),
|
|
43
|
-
...(!isTest ? depsPlugin(platformOptions) : []),
|
|
44
|
-
...routerPlugin(platformOptions),
|
|
45
|
-
...contentPlugin(platformOptions?.content, platformOptions),
|
|
46
|
-
...(opts?.vite === false
|
|
47
|
-
? []
|
|
48
|
-
: externalPlugins(angular({
|
|
49
|
-
jit: platformOptions.jit,
|
|
50
|
-
workspaceRoot: platformOptions.workspaceRoot,
|
|
51
|
-
disableTypeChecking: platformOptions.disableTypeChecking ?? false,
|
|
52
|
-
include: [
|
|
53
|
-
...(platformOptions.include ?? []),
|
|
54
|
-
...(platformOptions.additionalPagesDirs ?? []).map((pageDir) => `${pageDir}/**/*.page.ts`),
|
|
55
|
-
],
|
|
56
|
-
additionalContentDirs: platformOptions.additionalContentDirs,
|
|
57
|
-
liveReload: platformOptions.liveReload,
|
|
58
|
-
inlineStylesExtension: platformOptions.inlineStylesExtension,
|
|
59
|
-
fileReplacements: platformOptions.fileReplacements,
|
|
60
|
-
...(opts?.vite ?? {}),
|
|
61
|
-
}))),
|
|
62
|
-
...serverModePlugin(),
|
|
63
|
-
...clearClientPageEndpointsPlugin(),
|
|
64
|
-
];
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGxhdGZvcm0tcGx1Z2luLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvcGxhdGZvcm0vc3JjL2xpYi9wbGF0Zm9ybS1wbHVnaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxlQUFlLE1BQU0sNkJBQTZCLENBQUM7QUFDMUQsT0FBTyxPQUFPLE1BQU0sK0JBQStCLENBQUM7QUFHcEQsT0FB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0FDYixPQUFPLENBQUM7Z0JBQ04sR0FBRyxFQUFFLGVBQWUsQ0FBQyxHQUFHO2dCQUN4QixhQUFhLEVBQUUsZUFBZSxDQUFDLGFBQWE7Z0JBQzVDLG1CQUFtQixFQUFFLGVBQWUsQ0FBQyxtQkFBbUIsSUFBSSxLQUFLO2dCQUNqRSxPQUFPLEVBQUU7b0JBQ1AsR0FBRyxDQUFDLGVBQWUsQ0FBQyxPQUFPLElBQUksRUFBRSxDQUFDO29CQUNsQyxHQUFHLENBQUMsZUFBZSxDQUFDLG1CQUFtQixJQUFJLEVBQUUsQ0FBQyxDQUFDLEdBQUcsQ0FDaEQsQ0FBQyxPQUFPLEVBQUUsRUFBRSxDQUFDLEdBQUcsT0FBTyxlQUFlLENBQ3ZDO2lCQUNGO2dCQUNELHFCQUFxQixFQUFFLGVBQWUsQ0FBQyxxQkFBcUI7Z0JBQzVELFVBQVUsRUFBRSxlQUFlLENBQUMsVUFBVTtnQkFDdEMscUJBQXFCLEVBQUUsZUFBZSxDQUFDLHFCQUFxQjtnQkFDNUQsZ0JBQWdCLEVBQUUsZUFBZSxDQUFDLGdCQUFnQjtnQkFDbEQsR0FBRyxDQUFDLElBQUksRUFBRSxJQUFJLElBQUksRUFBRSxDQUFDO2FBQ3RCLENBQUMsQ0FDSCxDQUFDO1FBQ04sR0FBRyxnQkFBZ0IsRUFBRTtRQUNyQixHQUFHLDhCQUE4QixFQUFFO0tBQ3BDLENBQUM7QUFDSixDQUFDIn0=
|
|
43
|
+
//#endregion
|
|
44
|
+
export { platformPlugin };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=platform-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-plugin.js","names":[],"sources":["../../../src/lib/platform-plugin.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { join } from 'node:path';\nimport { Plugin } from 'vite';\n\nimport { Options } from './options.js';\nimport {\n activateDeferredDebug,\n applyDebugOption,\n debugPlatform,\n} from './utils/debug.js';\nimport { routerPlugin } from './router-plugin.js';\nimport { libraryPagesPlugin } from './library-pages-plugin.js';\nimport { ssrBuildPlugin } from './ssr/ssr-build-plugin.js';\nimport { contentPlugin } from './content-plugin.js';\nimport { clearClientPageEndpointsPlugin } from './clear-client-page-endpoint.js';\nimport { depsPlugin } from './deps-plugin.js';\nimport { injectHTMLPlugin } from './ssr/inject-html-plugin.js';\nimport { serverModePlugin } from '../server-mode-plugin.js';\nimport { routeGenerationPlugin } from './route-generation-plugin.js';\nimport { i18nComponentRegistryPlugin } from './i18n-component-registry-plugin.js';\nimport { analogNitroPlugin } from './nitro/analog-nitro-plugin.js';\n\n/**\n * The installed `@angular/core` major version, resolved from the workspace root\n * (where the app's Angular is installed). Returns `null` when it cannot be\n * detected, in which case streaming is not blocked and the build-time\n * anchor-drift detection is relied on instead.\n */\nfunction getAngularCoreMajor(workspaceRoot: string): number | null {\n try {\n const req = createRequire(join(workspaceRoot, 'noop.js'));\n const { version } = req('@angular/core/package.json') as {\n version: string;\n };\n const major = Number.parseInt(version.split('.')[0], 10);\n return Number.isNaN(major) ? null : major;\n } catch {\n return null;\n }\n}\n\nexport function platformPlugin(opts: Options = {}): Plugin[] {\n applyDebugOption(opts.debug, opts.workspaceRoot);\n\n const isTest = process.env['NODE_ENV'] === 'test' || !!process.env['VITEST'];\n const { ...platformOptions } = {\n ssr: true,\n ...opts,\n };\n\n debugPlatform('experimental options resolved', {\n typedRouter: platformOptions.experimental?.typedRouter,\n });\n\n return [\n {\n name: 'analogjs-debug-activate',\n config(_, { command }) {\n activateDeferredDebug(command);\n },\n },\n analogNitroPlugin(platformOptions),\n ...(platformOptions.ssr\n ? [...ssrBuildPlugin(), ...injectHTMLPlugin()]\n : []),\n ...(!isTest ? depsPlugin(platformOptions) : []),\n ...routerPlugin(platformOptions),\n ...libraryPagesPlugin(platformOptions),\n routeGenerationPlugin(platformOptions),\n ...contentPlugin(platformOptions?.content, platformOptions),\n ...(platformOptions.i18n ? [i18nComponentRegistryPlugin()] : []),\n ...serverModePlugin(),\n clearClientPageEndpointsPlugin(),\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;;AAyCA,SAAgB,eAAe,OAAgB,EAAE,EAAY;AAC3D,kBAAiB,KAAK,OAAO,KAAK,cAAc;CAEhD,MAAM,SAAA,QAAA,IAAA,aAAqC,UAAU,CAAC,CAAC,QAAQ,IAAI;CACnE,MAAM,EAAE,GAAG,oBAAoB;EAC7B,KAAK;EACL,GAAG;EACJ;AAED,eAAc,iCAAiC,EAC7C,aAAa,gBAAgB,cAAc,aAC5C,CAAC;AAEF,QAAO;EACL;GACE,MAAM;GACN,OAAO,GAAG,EAAE,WAAW;AACrB,0BAAsB,QAAQ;;GAEjC;EACD,kBAAkB,gBAAgB;EAClC,GAAI,gBAAgB,MAChB,CAAC,GAAG,gBAAgB,EAAE,GAAG,kBAAkB,CAAC,GAC5C,EAAE;EACN,GAAI,CAAC,SAAS,WAAW,gBAAgB,GAAG,EAAE;EAC9C,GAAG,aAAa,gBAAgB;EAChC,GAAG,mBAAmB,gBAAgB;EACtC,sBAAsB,gBAAgB;EACtC,GAAG,cAAc,iBAAiB,SAAS,gBAAgB;EAC3D,GAAI,gBAAgB,OAAO,CAAC,6BAA6B,CAAC,GAAG,EAAE;EAC/D,GAAG,kBAAkB;EACrB,gCAAgC;EACjC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface RouteFileDiscoveryOptions {
|
|
2
|
+
root: string;
|
|
3
|
+
workspaceRoot: string;
|
|
4
|
+
additionalPagesDirs: string[];
|
|
5
|
+
additionalContentDirs: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface RouteFileDiscovery {
|
|
8
|
+
getRouteFiles(): string[];
|
|
9
|
+
getContentFiles(): string[];
|
|
10
|
+
getDiscoveredFileKind(path: string): "route" | "content" | null;
|
|
11
|
+
updateDiscoveredFile(path: string, event: "add" | "change" | "unlink"): void;
|
|
12
|
+
/**
|
|
13
|
+
* Returns true if the normalized filename was discovered from an app-local
|
|
14
|
+
* glob (under the configured root) rather than from an additional directory.
|
|
15
|
+
*
|
|
16
|
+
* Used by collision priority to prefer app-local routes over shared/external
|
|
17
|
+
* routes based on actual configured roots instead of hard-coded path
|
|
18
|
+
* substrings.
|
|
19
|
+
*/
|
|
20
|
+
isAppLocal(normalizedFilename: string): boolean;
|
|
21
|
+
reset(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare function createRouteFileDiscovery(options: RouteFileDiscoveryOptions): RouteFileDiscovery;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { normalizePath } from "vite";
|
|
3
|
+
import { globSync } from "tinyglobby";
|
|
4
|
+
//#region packages/platform/src/lib/route-file-discovery.ts
|
|
5
|
+
function createRouteFileDiscovery(options) {
|
|
6
|
+
const { root, workspaceRoot, additionalPagesDirs, additionalContentDirs } = options;
|
|
7
|
+
let routeFilesCache = /* @__PURE__ */ new Set();
|
|
8
|
+
let contentFilesCache = /* @__PURE__ */ new Set();
|
|
9
|
+
let appLocalFilesCache = /* @__PURE__ */ new Set();
|
|
10
|
+
let initialized = false;
|
|
11
|
+
const joinDir = (dir) => dir.startsWith(workspaceRoot) ? normalizePath(dir) : dir.startsWith("/") ? normalizePath(`${workspaceRoot}${dir}`) : normalizePath(resolve(workspaceRoot, dir));
|
|
12
|
+
const additionalPagesRoots = additionalPagesDirs.map(joinDir);
|
|
13
|
+
const additionalContentRoots = additionalContentDirs.map(joinDir);
|
|
14
|
+
function normalizePath_(absolutePath) {
|
|
15
|
+
const normalized = normalizePath(absolutePath);
|
|
16
|
+
if (normalized.startsWith(root)) return normalized.slice(root.length);
|
|
17
|
+
if (normalized.startsWith(workspaceRoot)) return normalized.slice(workspaceRoot.length);
|
|
18
|
+
return normalized;
|
|
19
|
+
}
|
|
20
|
+
function isWithinDir(path, dir) {
|
|
21
|
+
return path === dir || path.startsWith(`${dir}/`);
|
|
22
|
+
}
|
|
23
|
+
function getDiscoveredFileKind(path) {
|
|
24
|
+
const normalized = normalizePath(path);
|
|
25
|
+
if (normalized.endsWith(".md") && (normalized.includes("/src/app/routes/") || normalized.includes("/src/app/pages/") || normalized.includes("/src/content/") || additionalContentRoots.some((dir) => isWithinDir(normalized, dir)))) return "content";
|
|
26
|
+
if ((normalized.includes("/app/routes/") || normalized.includes("/src/app/routes/")) && normalized.endsWith(".ts")) return "route";
|
|
27
|
+
if (normalized.endsWith(".page.ts") && (normalized.includes("/src/app/pages/") || additionalPagesRoots.some((dir) => isWithinDir(normalized, dir)))) return "route";
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
function scanRouteFiles() {
|
|
31
|
+
const appLocalGlobs = [
|
|
32
|
+
`${root}/app/routes/**/*.ts`,
|
|
33
|
+
`${root}/src/app/routes/**/*.ts`,
|
|
34
|
+
`${root}/src/app/pages/**/*.page.ts`
|
|
35
|
+
];
|
|
36
|
+
const additionalGlobs = additionalPagesDirs.map((dir) => `${joinDir(dir)}/**/*.page.ts`);
|
|
37
|
+
const appLocal = globSync(appLocalGlobs, {
|
|
38
|
+
dot: true,
|
|
39
|
+
absolute: true
|
|
40
|
+
}).map(normalizePath_);
|
|
41
|
+
const additional = globSync(additionalGlobs, {
|
|
42
|
+
dot: true,
|
|
43
|
+
absolute: true
|
|
44
|
+
}).map(normalizePath_);
|
|
45
|
+
for (const f of appLocal) appLocalFilesCache.add(f);
|
|
46
|
+
return [...appLocal, ...additional];
|
|
47
|
+
}
|
|
48
|
+
function scanContentFiles() {
|
|
49
|
+
const appLocalGlobs = [
|
|
50
|
+
`${root}/src/app/routes/**/*.md`,
|
|
51
|
+
`${root}/src/app/pages/**/*.md`,
|
|
52
|
+
`${root}/src/content/**/*.md`
|
|
53
|
+
];
|
|
54
|
+
const additionalGlobs = additionalContentDirs.map((dir) => `${joinDir(dir)}/**/*.md`);
|
|
55
|
+
const appLocal = globSync(appLocalGlobs, {
|
|
56
|
+
dot: true,
|
|
57
|
+
absolute: true
|
|
58
|
+
}).map(normalizePath_);
|
|
59
|
+
const additional = globSync(additionalGlobs, {
|
|
60
|
+
dot: true,
|
|
61
|
+
absolute: true
|
|
62
|
+
}).map(normalizePath_);
|
|
63
|
+
for (const f of appLocal) appLocalFilesCache.add(f);
|
|
64
|
+
return [...appLocal, ...additional];
|
|
65
|
+
}
|
|
66
|
+
function isAppLocalByPath(absolutePath) {
|
|
67
|
+
return normalizePath(absolutePath).startsWith(root);
|
|
68
|
+
}
|
|
69
|
+
function ensureInitialized() {
|
|
70
|
+
if (initialized) return;
|
|
71
|
+
routeFilesCache = new Set(scanRouteFiles());
|
|
72
|
+
contentFilesCache = new Set(scanContentFiles());
|
|
73
|
+
initialized = true;
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
getRouteFiles() {
|
|
77
|
+
ensureInitialized();
|
|
78
|
+
return [...routeFilesCache].sort();
|
|
79
|
+
},
|
|
80
|
+
getContentFiles() {
|
|
81
|
+
ensureInitialized();
|
|
82
|
+
return [...contentFilesCache].sort();
|
|
83
|
+
},
|
|
84
|
+
getDiscoveredFileKind(path) {
|
|
85
|
+
return getDiscoveredFileKind(path);
|
|
86
|
+
},
|
|
87
|
+
updateDiscoveredFile(path, event) {
|
|
88
|
+
ensureInitialized();
|
|
89
|
+
const kind = getDiscoveredFileKind(path);
|
|
90
|
+
if (!kind) return;
|
|
91
|
+
const normalizedPath = normalizePath_(path);
|
|
92
|
+
const targetCache = kind === "content" ? contentFilesCache : routeFilesCache;
|
|
93
|
+
if (event === "unlink") {
|
|
94
|
+
targetCache.delete(normalizedPath);
|
|
95
|
+
appLocalFilesCache.delete(normalizedPath);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
targetCache.add(normalizedPath);
|
|
99
|
+
if (isAppLocalByPath(path)) appLocalFilesCache.add(normalizedPath);
|
|
100
|
+
},
|
|
101
|
+
isAppLocal(normalizedFilename) {
|
|
102
|
+
ensureInitialized();
|
|
103
|
+
return appLocalFilesCache.has(normalizedFilename);
|
|
104
|
+
},
|
|
105
|
+
reset() {
|
|
106
|
+
initialized = false;
|
|
107
|
+
appLocalFilesCache = /* @__PURE__ */ new Set();
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
export { createRouteFileDiscovery };
|
|
113
|
+
|
|
114
|
+
//# sourceMappingURL=route-file-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-file-discovery.js","names":[],"sources":["../../../src/lib/route-file-discovery.ts"],"sourcesContent":["import { normalizePath } from 'vite';\nimport { resolve } from 'node:path';\nimport { globSync } from 'tinyglobby';\n\nexport interface RouteFileDiscoveryOptions {\n root: string;\n workspaceRoot: string;\n additionalPagesDirs: string[];\n additionalContentDirs: string[];\n}\n\nexport interface RouteFileDiscovery {\n getRouteFiles(): string[];\n getContentFiles(): string[];\n getDiscoveredFileKind(path: string): 'route' | 'content' | null;\n updateDiscoveredFile(path: string, event: 'add' | 'change' | 'unlink'): void;\n /**\n * Returns true if the normalized filename was discovered from an app-local\n * glob (under the configured root) rather than from an additional directory.\n *\n * Used by collision priority to prefer app-local routes over shared/external\n * routes based on actual configured roots instead of hard-coded path\n * substrings.\n */\n isAppLocal(normalizedFilename: string): boolean;\n reset(): void;\n}\n\nexport function createRouteFileDiscovery(\n options: RouteFileDiscoveryOptions,\n): RouteFileDiscovery {\n const { root, workspaceRoot, additionalPagesDirs, additionalContentDirs } =\n options;\n\n let routeFilesCache = new Set<string>();\n let contentFilesCache = new Set<string>();\n let appLocalFilesCache = new Set<string>();\n let initialized = false;\n const joinDir = (dir: string) =>\n dir.startsWith(workspaceRoot)\n ? normalizePath(dir)\n : dir.startsWith('/')\n ? normalizePath(`${workspaceRoot}${dir}`)\n : normalizePath(resolve(workspaceRoot, dir));\n const additionalPagesRoots = additionalPagesDirs.map(joinDir);\n const additionalContentRoots = additionalContentDirs.map(joinDir);\n\n function normalizePath_(absolutePath: string): string {\n const normalized = normalizePath(absolutePath);\n if (normalized.startsWith(root)) {\n return normalized.slice(root.length);\n }\n if (normalized.startsWith(workspaceRoot)) {\n return normalized.slice(workspaceRoot.length);\n }\n return normalized;\n }\n\n function isWithinDir(path: string, dir: string): boolean {\n return path === dir || path.startsWith(`${dir}/`);\n }\n\n function getDiscoveredFileKind(path: string): 'route' | 'content' | null {\n const normalized = normalizePath(path);\n\n if (\n normalized.endsWith('.md') &&\n (normalized.includes('/src/app/routes/') ||\n normalized.includes('/src/app/pages/') ||\n normalized.includes('/src/content/') ||\n additionalContentRoots.some((dir) => isWithinDir(normalized, dir)))\n ) {\n return 'content';\n }\n\n if (\n (normalized.includes('/app/routes/') ||\n normalized.includes('/src/app/routes/')) &&\n normalized.endsWith('.ts')\n ) {\n return 'route';\n }\n\n // Keep the dev watcher aligned with the build-time route scan. In\n // particular, `src/server/routes/**` must stay out of typed route codegen\n // because Nitro API handlers are not client-navigable pages.\n if (\n normalized.endsWith('.page.ts') &&\n (normalized.includes('/src/app/pages/') ||\n additionalPagesRoots.some((dir) => isWithinDir(normalized, dir)))\n ) {\n return 'route';\n }\n\n return null;\n }\n\n function scanRouteFiles(): string[] {\n const appLocalGlobs = [\n `${root}/app/routes/**/*.ts`,\n `${root}/src/app/routes/**/*.ts`,\n `${root}/src/app/pages/**/*.page.ts`,\n ];\n const additionalGlobs = additionalPagesDirs.map(\n (dir) => `${joinDir(dir)}/**/*.page.ts`,\n );\n\n const appLocal = globSync(appLocalGlobs, {\n dot: true,\n absolute: true,\n }).map(normalizePath_);\n\n const additional = globSync(additionalGlobs, {\n dot: true,\n absolute: true,\n }).map(normalizePath_);\n\n for (const f of appLocal) {\n appLocalFilesCache.add(f);\n }\n\n return [...appLocal, ...additional];\n }\n\n function scanContentFiles(): string[] {\n const appLocalGlobs = [\n `${root}/src/app/routes/**/*.md`,\n `${root}/src/app/pages/**/*.md`,\n `${root}/src/content/**/*.md`,\n ];\n const additionalGlobs = additionalContentDirs.map(\n (dir) => `${joinDir(dir)}/**/*.md`,\n );\n\n const appLocal = globSync(appLocalGlobs, {\n dot: true,\n absolute: true,\n }).map(normalizePath_);\n\n const additional = globSync(additionalGlobs, {\n dot: true,\n absolute: true,\n }).map(normalizePath_);\n\n for (const f of appLocal) {\n appLocalFilesCache.add(f);\n }\n\n return [...appLocal, ...additional];\n }\n\n function isAppLocalByPath(absolutePath: string): boolean {\n const normalized = normalizePath(absolutePath);\n return normalized.startsWith(root);\n }\n\n function ensureInitialized(): void {\n if (initialized) {\n return;\n }\n\n routeFilesCache = new Set(scanRouteFiles());\n contentFilesCache = new Set(scanContentFiles());\n initialized = true;\n }\n\n return {\n getRouteFiles(): string[] {\n ensureInitialized();\n return [...routeFilesCache].sort();\n },\n\n getContentFiles(): string[] {\n ensureInitialized();\n return [...contentFilesCache].sort();\n },\n\n getDiscoveredFileKind(path: string): 'route' | 'content' | null {\n return getDiscoveredFileKind(path);\n },\n\n updateDiscoveredFile(\n path: string,\n event: 'add' | 'change' | 'unlink',\n ): void {\n ensureInitialized();\n const kind = getDiscoveredFileKind(path);\n if (!kind) {\n return;\n }\n\n const normalizedPath = normalizePath_(path);\n const targetCache =\n kind === 'content' ? contentFilesCache : routeFilesCache;\n\n if (event === 'unlink') {\n targetCache.delete(normalizedPath);\n appLocalFilesCache.delete(normalizedPath);\n return;\n }\n\n targetCache.add(normalizedPath);\n if (isAppLocalByPath(path)) {\n appLocalFilesCache.add(normalizedPath);\n }\n },\n\n isAppLocal(normalizedFilename: string): boolean {\n ensureInitialized();\n return appLocalFilesCache.has(normalizedFilename);\n },\n\n reset(): void {\n initialized = false;\n appLocalFilesCache = new Set<string>();\n },\n };\n}\n"],"mappings":";;;;AA4BA,SAAgB,yBACd,SACoB;CACpB,MAAM,EAAE,MAAM,eAAe,qBAAqB,0BAChD;CAEF,IAAI,kCAAkB,IAAI,KAAa;CACvC,IAAI,oCAAoB,IAAI,KAAa;CACzC,IAAI,qCAAqB,IAAI,KAAa;CAC1C,IA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3C,OAAI,UAAU,UAAU;AACtB,gBAAY,OAAO,eAAe;AAClC,uBAAmB,OAAO,eAAe;AACzC;;AAGF,eAAY,IAAI,eAAe;AAC/B,OAAI,iBAAiB,KAAK,CACxB,oBAAmB,IAAI,eAAe;;EAI1C,WAAW,oBAAqC;AAC9C,sBAAmB;AACnB,UAAO,mBAAmB,IAAI,mBAAmB;;EAGnD,QAAc;AACZ,iBAAc;AACd,wCAAqB,IAAI,KAAa;;EAEzC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface AnalogRouteIdiomDiagnostic {
|
|
2
|
+
code: string;
|
|
3
|
+
severity: "error" | "warning";
|
|
4
|
+
message: string;
|
|
5
|
+
details?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AnalyzeAnalogRouteFileOptions {
|
|
8
|
+
filename: string;
|
|
9
|
+
code: string;
|
|
10
|
+
routeFiles?: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare function analyzeAnalogRouteFile(options: AnalyzeAnalogRouteFileOptions): AnalogRouteIdiomDiagnostic[];
|
|
13
|
+
export declare function formatAnalogRouteIdiomDiagnostic(diagnostic: AnalogRouteIdiomDiagnostic, filename: string, workspaceRoot: string): string;
|