@analogjs/platform 3.0.0-alpha.5 → 3.0.0-alpha.51
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/package.json +29 -19
- package/src/index.d.ts +9 -2
- package/src/index.js +11 -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 +22 -32
- 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 -196
- package/src/lib/content-plugin.js.map +1 -0
- package/src/lib/deps-plugin.d.ts +2 -2
- package/src/lib/deps-plugin.js +80 -82
- package/src/lib/deps-plugin.js.map +1 -0
- package/src/lib/discover-library-routes.d.ts +13 -0
- package/src/lib/discover-library-routes.js +64 -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/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/nx-plugin/builders.json +7 -0
- package/src/lib/nx-plugin/executors.json +5 -0
- 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/executors/vite/compat.d.ts +1 -1
- package/src/lib/nx-plugin/src/executors/vite/compat.js +6 -7
- package/src/lib/nx-plugin/src/executors/vite/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/executors/vite/schema.d.ts +1 -1
- package/src/lib/nx-plugin/src/executors/vite/vite.impl.d.ts +1 -1
- package/src/lib/nx-plugin/src/executors/vite/vite.impl.js +5 -4
- package/src/lib/nx-plugin/src/executors/vite/vite.impl.js.map +1 -1
- 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 +6 -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 +5 -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 +6 -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 +5 -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 +17 -7
- package/src/lib/nx-plugin/src/generators/app/compat.js.map +1 -1
- 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 +78 -92
- package/src/lib/nx-plugin/src/generators/app/generator.js.map +1 -1
- 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 +72 -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 +24 -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 +15 -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 +14 -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 +18 -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 +60 -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 +14 -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/versions/minimum-supported-versions.d.ts +2 -3
- package/src/lib/nx-plugin/src/generators/app/versions/minimum-supported-versions.js +6 -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 +17 -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 +54 -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 +19 -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 +20 -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 +56 -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 +17 -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 +12 -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 +19 -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 +43 -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 +27 -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 +19 -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 +18 -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 +34 -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 +5 -4
- package/src/lib/nx-plugin/src/generators/preset/generator.d.ts +3 -3
- package/src/lib/nx-plugin/src/generators/preset/generator.js +17 -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 +17 -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 +32 -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 +7 -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 +20 -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 +19 -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 +20 -27
- package/src/lib/nx-plugin/src/utils/version-utils.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/dependencies.js +42 -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 +49 -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 +8 -8
- package/src/lib/nx-plugin/src/utils/versions/ng_19_X/versions.js +37 -23
- package/src/lib/nx-plugin/src/utils/versions/ng_19_X/versions.js.map +1 -1
- package/src/lib/options.d.ts +306 -80
- package/src/lib/platform-plugin.d.ts +2 -2
- package/src/lib/platform-plugin.js +91 -62
- 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 +234 -150
- package/src/lib/router-plugin.js.map +1 -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 +31 -2
- package/src/lib/ssr/ssr-build-plugin.js +54 -30
- package/src/lib/ssr/ssr-build-plugin.js.map +1 -0
- package/src/lib/style-pipeline.d.ts +34 -0
- package/src/lib/style-pipeline.js +32 -0
- package/src/lib/style-pipeline.js.map +1 -0
- package/src/lib/style-preprocessor.d.ts +28 -0
- package/src/lib/style-preprocessor.js +35 -0
- package/src/lib/style-preprocessor.js.map +1 -0
- package/src/lib/tailwind-preprocessor.d.ts +23 -0
- package/src/lib/tailwind-preprocessor.js +153 -0
- package/src/lib/tailwind-preprocessor.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 +22 -0
- package/src/lib/utils/debug.js +27 -0
- package/src/lib/utils/debug.js.map +1 -0
- package/src/lib/utils/rolldown.d.ts +3 -0
- package/src/lib/utils/rolldown.js +15 -0
- package/src/lib/utils/rolldown.js.map +1 -0
- package/src/server-mode-plugin.d.ts +6 -6
- package/src/server-mode-plugin.js +16 -18
- package/src/server-mode-plugin.js.map +1 -0
- package/src/style-pipeline.d.ts +1 -0
- package/src/style-pipeline.js +2 -0
- package/src/style-preprocessor.d.ts +1 -0
- package/src/style-preprocessor.js +2 -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/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/ssr/ssr-xhr-plugin.d.ts +0 -2
- package/src/lib/ssr/ssr-xhr-plugin.js +0 -28
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deps-plugin.js","names":[],"sources":["../../../src/lib/deps-plugin.ts"],"sourcesContent":["import { VERSION } from '@angular/compiler-cli';\nimport type { Plugin } from 'vite';\nimport { crawlFrameworkPkgs } from 'vitefu';\n\nimport { Options } from './options.js';\nimport { debugPlatform } from './utils/debug.js';\nimport { getJsTransformConfigKey } from './utils/rolldown.js';\n\nexport function depsPlugin(options?: Options): Plugin[] {\n const workspaceRoot =\n options?.workspaceRoot ?? process.env['NX_WORKSPACE_ROOT'] ?? process.cwd();\n const viteOptions = options?.vite === false ? undefined : options?.vite;\n\n return [\n {\n name: 'analogjs-deps-plugin',\n config() {\n const useAngularCompilationAPI =\n options?.experimental?.useAngularCompilationAPI ??\n viteOptions?.experimental?.useAngularCompilationAPI;\n\n const transformConfig =\n options?.vite === false || useAngularCompilationAPI\n ? {}\n : { exclude: ['**/*.ts', '**/*.js'] };\n debugPlatform('deps transform config', {\n useAngularCompilationAPI: !!useAngularCompilationAPI,\n jsTransformKey: getJsTransformConfigKey(),\n transformExcluded: 'exclude' in transformConfig,\n });\n\n return {\n [getJsTransformConfigKey()]: transformConfig,\n ssr: {\n noExternal: [\n '@analogjs/**',\n 'es-toolkit',\n 'firebase/**',\n 'firebase-admin/**',\n 'rxfire',\n '@ng-web-apis/**',\n '@taiga-ui/**',\n '@tanstack/angular-query-experimental',\n ],\n },\n optimizeDeps: {\n include: [\n '@angular/common',\n '@angular/common/http',\n ...(Number(VERSION.major) > 15\n ? ['@angular/core/rxjs-interop']\n : []),\n 'front-matter',\n ],\n exclude: [\n '@angular/platform-server',\n '@analogjs/content',\n '@analogjs/router',\n '@nx/angular',\n '@nx/vite',\n '@nx/devkit',\n '@nx/js',\n '@nx/devkit',\n '@nx/cypress',\n '@nx/jest',\n '@nx/js',\n '@nx/eslint',\n '@nx/webpack',\n '@nx/web',\n '@nx/workspace',\n '@nx/eslint',\n '@nx/module-federation',\n '@nx/rspack',\n 'webpack',\n 'fsevents',\n 'nx',\n ],\n },\n };\n },\n },\n {\n name: 'analogjs-auto-discover-deps',\n async config(config, { command }) {\n const pkgConfig = await crawlFrameworkPkgs({\n root: workspaceRoot,\n isBuild: command === 'build',\n viteUserConfig: config,\n isSemiFrameworkPkgByJson(pkgJson) {\n return pkgJson['module'] && pkgJson['module'].includes('fesm');\n },\n });\n return pkgConfig;\n },\n },\n ];\n}\n"],"mappings":";;;;;AAQA,SAAgB,WAAW,SAA6B;CACtD,MAAM,gBACJ,SAAS,iBAAiB,QAAQ,IAAI,wBAAwB,QAAQ,KAAK;CAC7E,MAAM,cAAc,SAAS,SAAS,QAAQ,KAAA,IAAY,SAAS;AAEnE,QAAO,CACL;EACE,MAAM;EACN,SAAS;GACP,MAAM,2BACJ,SAAS,cAAc,4BACvB,aAAa,cAAc;GAE7B,MAAM,kBACJ,SAAS,SAAS,SAAS,2BACvB,EAAE,GACF,EAAE,SAAS,CAAC,WAAW,UAAU,EAAE;AACzC,iBAAc,yBAAyB;IACrC,0BAA0B,CAAC,CAAC;IAC5B,gBAAgB,yBAAyB;IACzC,mBAAmB,aAAa;IACjC,CAAC;AAEF,UAAO;KACJ,yBAAyB,GAAG;IAC7B,KAAK,EACH,YAAY;KACV;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACD,EACF;IACD,cAAc;KACZ,SAAS;MACP;MACA;MACA,GAAI,OAAO,QAAQ,MAAM,GAAG,KACxB,CAAC,6BAA6B,GAC9B,EAAE;MACN;MACD;KACD,SAAS;MACP;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACD;KACF;IACF;;EAEJ,EACD;EACE,MAAM;EACN,MAAM,OAAO,QAAQ,EAAE,WAAW;AAShC,UARkB,MAAM,mBAAmB;IACzC,MAAM;IACN,SAAS,YAAY;IACrB,gBAAgB;IAChB,yBAAyB,SAAS;AAChC,YAAO,QAAQ,aAAa,QAAQ,UAAU,SAAS,OAAO;;IAEjE,CAAC;;EAGL,CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface DiscoveredLibraryRoutes {
|
|
2
|
+
additionalPagesDirs: string[];
|
|
3
|
+
additionalContentDirs: string[];
|
|
4
|
+
additionalAPIDirs: string[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Scans workspace libraries directly for conventional route directories
|
|
8
|
+
* (`src/pages`, `src/content`, `src/api`).
|
|
9
|
+
*
|
|
10
|
+
* Returns workspace-relative paths (e.g. `/libs/shared/feature`) suitable
|
|
11
|
+
* for merging into the `additional*Dirs` options.
|
|
12
|
+
*/
|
|
13
|
+
export declare function discoverLibraryRoutes(workspaceRoot: string): DiscoveredLibraryRoutes;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { normalizePath } from "vite";
|
|
2
|
+
import { globSync } from "tinyglobby";
|
|
3
|
+
//#region packages/platform/src/lib/discover-library-routes.ts
|
|
4
|
+
Object.freeze({
|
|
5
|
+
additionalPagesDirs: Object.freeze([]),
|
|
6
|
+
additionalContentDirs: Object.freeze([]),
|
|
7
|
+
additionalAPIDirs: Object.freeze([])
|
|
8
|
+
});
|
|
9
|
+
var discoverableLibRouteDirs = [
|
|
10
|
+
"libs/**/src/pages",
|
|
11
|
+
"libs/**/src/content",
|
|
12
|
+
"libs/**/src/api"
|
|
13
|
+
];
|
|
14
|
+
function toWorkspacePath(path) {
|
|
15
|
+
return normalizePath(path).replace(/\/$/, "");
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Scans workspace libraries directly for conventional route directories
|
|
19
|
+
* (`src/pages`, `src/content`, `src/api`).
|
|
20
|
+
*
|
|
21
|
+
* Returns workspace-relative paths (e.g. `/libs/shared/feature`) suitable
|
|
22
|
+
* for merging into the `additional*Dirs` options.
|
|
23
|
+
*/
|
|
24
|
+
function discoverLibraryRoutes(workspaceRoot) {
|
|
25
|
+
const result = {
|
|
26
|
+
additionalPagesDirs: [],
|
|
27
|
+
additionalContentDirs: [],
|
|
28
|
+
additionalAPIDirs: []
|
|
29
|
+
};
|
|
30
|
+
const normalizedWorkspaceRoot = toWorkspacePath(workspaceRoot);
|
|
31
|
+
const discovered = /* @__PURE__ */ new Map();
|
|
32
|
+
for (const dir of globSync(discoverableLibRouteDirs, {
|
|
33
|
+
cwd: normalizedWorkspaceRoot,
|
|
34
|
+
dot: true,
|
|
35
|
+
onlyDirectories: true
|
|
36
|
+
})) {
|
|
37
|
+
const normalizedDir = toWorkspacePath(dir);
|
|
38
|
+
const workspaceRelativeDir = normalizedDir.startsWith(`${normalizedWorkspaceRoot}/`) ? normalizedDir.slice(normalizedWorkspaceRoot.length + 1) : normalizedDir;
|
|
39
|
+
if (!workspaceRelativeDir.startsWith("libs/")) continue;
|
|
40
|
+
const srcIndex = workspaceRelativeDir.indexOf("/src/");
|
|
41
|
+
if (srcIndex === -1) continue;
|
|
42
|
+
const libRoot = workspaceRelativeDir.slice(0, srcIndex);
|
|
43
|
+
const entry = discovered.get(libRoot) ?? {
|
|
44
|
+
pages: false,
|
|
45
|
+
content: false,
|
|
46
|
+
api: false
|
|
47
|
+
};
|
|
48
|
+
if (workspaceRelativeDir.endsWith("/src/pages")) entry.pages = true;
|
|
49
|
+
if (workspaceRelativeDir.endsWith("/src/content")) entry.content = true;
|
|
50
|
+
if (workspaceRelativeDir.endsWith("/src/api")) entry.api = true;
|
|
51
|
+
discovered.set(libRoot, entry);
|
|
52
|
+
}
|
|
53
|
+
for (const libRoot of [...discovered.keys()].sort()) {
|
|
54
|
+
const entry = discovered.get(libRoot);
|
|
55
|
+
if (entry.pages) result.additionalPagesDirs.push(`/${libRoot}`);
|
|
56
|
+
if (entry.content) result.additionalContentDirs.push(`/${libRoot}/src/content`);
|
|
57
|
+
if (entry.api) result.additionalAPIDirs.push(`/${libRoot}/src/api`);
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { discoverLibraryRoutes };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=discover-library-routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover-library-routes.js","names":[],"sources":["../../../src/lib/discover-library-routes.ts"],"sourcesContent":["import { normalizePath } from 'vite';\nimport { globSync } from 'tinyglobby';\n\nexport interface DiscoveredLibraryRoutes {\n additionalPagesDirs: string[];\n additionalContentDirs: string[];\n additionalAPIDirs: string[];\n}\n\nconst empty: DiscoveredLibraryRoutes = Object.freeze({\n additionalPagesDirs: Object.freeze([] as string[]),\n additionalContentDirs: Object.freeze([] as string[]),\n additionalAPIDirs: Object.freeze([] as string[]),\n});\n\nconst discoverableLibRouteDirs = [\n 'libs/**/src/pages',\n 'libs/**/src/content',\n 'libs/**/src/api',\n] as const;\n\nfunction toWorkspacePath(path: string) {\n return normalizePath(path).replace(/\\/$/, '');\n}\n\n/**\n * Scans workspace libraries directly for conventional route directories\n * (`src/pages`, `src/content`, `src/api`).\n *\n * Returns workspace-relative paths (e.g. `/libs/shared/feature`) suitable\n * for merging into the `additional*Dirs` options.\n */\nexport function discoverLibraryRoutes(\n workspaceRoot: string,\n): DiscoveredLibraryRoutes {\n const result: DiscoveredLibraryRoutes = {\n additionalPagesDirs: [],\n additionalContentDirs: [],\n additionalAPIDirs: [],\n };\n const normalizedWorkspaceRoot = toWorkspacePath(workspaceRoot);\n const discovered = new Map<\n string,\n {\n pages: boolean;\n content: boolean;\n api: boolean;\n }\n >();\n\n for (const dir of globSync(discoverableLibRouteDirs, {\n cwd: normalizedWorkspaceRoot,\n dot: true,\n onlyDirectories: true,\n })) {\n const normalizedDir = toWorkspacePath(dir);\n const workspaceRelativeDir = normalizedDir.startsWith(\n `${normalizedWorkspaceRoot}/`,\n )\n ? normalizedDir.slice(normalizedWorkspaceRoot.length + 1)\n : normalizedDir;\n\n if (!workspaceRelativeDir.startsWith('libs/')) {\n continue;\n }\n\n const srcIndex = workspaceRelativeDir.indexOf('/src/');\n if (srcIndex === -1) {\n continue;\n }\n\n const libRoot = workspaceRelativeDir.slice(0, srcIndex);\n const entry = discovered.get(libRoot) ?? {\n pages: false,\n content: false,\n api: false,\n };\n\n if (workspaceRelativeDir.endsWith('/src/pages')) {\n entry.pages = true;\n }\n\n if (workspaceRelativeDir.endsWith('/src/content')) {\n entry.content = true;\n }\n\n if (workspaceRelativeDir.endsWith('/src/api')) {\n entry.api = true;\n }\n\n discovered.set(libRoot, entry);\n }\n\n for (const libRoot of [...discovered.keys()].sort()) {\n const entry = discovered.get(libRoot)!;\n\n if (entry.pages) {\n result.additionalPagesDirs.push(`/${libRoot}`);\n }\n\n if (entry.content) {\n result.additionalContentDirs.push(`/${libRoot}/src/content`);\n }\n\n if (entry.api) {\n result.additionalAPIDirs.push(`/${libRoot}/src/api`);\n }\n }\n\n return result;\n}\n"],"mappings":";;;AASuC,OAAO,OAAO;CACnD,qBAAqB,OAAO,OAAO,EAAE,CAAa;CAClD,uBAAuB,OAAO,OAAO,EAAE,CAAa;CACpD,mBAAmB,OAAO,OAAO,EAAE,CAAa;CACjD,CAAC;AAEF,IAAM,2BAA2B;CAC/B;CACA;CACA;CACD;AAED,SAAS,gBAAgB,MAAc;AACrC,QAAO,cAAc,KAAK,CAAC,QAAQ,OAAO,GAAG;;;;;;;;;AAU/C,SAAgB,sBACd,eACyB;CACzB,MAAM,SAAkC;EACtC,qBAAqB,EAAE;EACvB,uBAAuB,EAAE;EACzB,mBAAmB,EAAE;EACtB;CACD,MAAM,0BAA0B,gBAAgB,cAAc;CAC9D,MAAM,6BAAa,IAAI,KAOpB;AAEH,MAAK,MAAM,OAAO,SAAS,0BAA0B;EACnD,KAAK;EACL,KAAK;EACL,iBAAiB;EAClB,CAAC,EAAE;EACF,MAAM,gBAAgB,gBAAgB,IAAI;EAC1C,MAAM,uBAAuB,cAAc,WACzC,GAAG,wBAAwB,GAC5B,GACG,cAAc,MAAM,wBAAwB,SAAS,EAAE,GACvD;AAEJ,MAAI,CAAC,qBAAqB,WAAW,QAAQ,CAC3C;EAGF,MAAM,WAAW,qBAAqB,QAAQ,QAAQ;AACtD,MAAI,aAAa,GACf;EAGF,MAAM,UAAU,qBAAqB,MAAM,GAAG,SAAS;EACvD,MAAM,QAAQ,WAAW,IAAI,QAAQ,IAAI;GACvC,OAAO;GACP,SAAS;GACT,KAAK;GACN;AAED,MAAI,qBAAqB,SAAS,aAAa,CAC7C,OAAM,QAAQ;AAGhB,MAAI,qBAAqB,SAAS,eAAe,CAC/C,OAAM,UAAU;AAGlB,MAAI,qBAAqB,SAAS,WAAW,CAC3C,OAAM,MAAM;AAGd,aAAW,IAAI,SAAS,MAAM;;AAGhC,MAAK,MAAM,WAAW,CAAC,GAAG,WAAW,MAAM,CAAC,CAAC,MAAM,EAAE;EACnD,MAAM,QAAQ,WAAW,IAAI,QAAQ;AAErC,MAAI,MAAM,MACR,QAAO,oBAAoB,KAAK,IAAI,UAAU;AAGhD,MAAI,MAAM,QACR,QAAO,sBAAsB,KAAK,IAAI,QAAQ,cAAc;AAG9D,MAAI,MAAM,IACR,QAAO,kBAAkB,KAAK,IAAI,QAAQ,UAAU;;AAIxD,QAAO"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* Vite plugin that instruments compiled Angular component definitions with
|
|
4
|
+
* calls to `registerI18nComponentDef()` from `@analogjs/router`. This
|
|
5
|
+
* populates a process-level registry of component definitions that the
|
|
6
|
+
* server renderer uses to null cached `tView` objects between SSR requests,
|
|
7
|
+
* allowing `$localize` tagged templates in `consts()` to re-evaluate with
|
|
8
|
+
* the freshly loaded translations for each request's locale.
|
|
9
|
+
*
|
|
10
|
+
* The plugin runs in `enforce: 'post'` so that it sees the compiled
|
|
11
|
+
* JavaScript output from the Angular compiler (which contains the
|
|
12
|
+
* `ClassName.ɵcmp = ɵɵdefineComponent({...})` assignments).
|
|
13
|
+
*
|
|
14
|
+
* Only active when the platform's `i18n` option is configured.
|
|
15
|
+
* Only transforms modules loaded for the SSR environment.
|
|
16
|
+
*/
|
|
17
|
+
export declare function i18nComponentRegistryPlugin(): Plugin;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import MagicString from "magic-string";
|
|
2
|
+
//#region packages/platform/src/lib/i18n-component-registry-plugin.ts
|
|
3
|
+
/**
|
|
4
|
+
* Vite plugin that instruments compiled Angular component definitions with
|
|
5
|
+
* calls to `registerI18nComponentDef()` from `@analogjs/router`. This
|
|
6
|
+
* populates a process-level registry of component definitions that the
|
|
7
|
+
* server renderer uses to null cached `tView` objects between SSR requests,
|
|
8
|
+
* allowing `$localize` tagged templates in `consts()` to re-evaluate with
|
|
9
|
+
* the freshly loaded translations for each request's locale.
|
|
10
|
+
*
|
|
11
|
+
* The plugin runs in `enforce: 'post'` so that it sees the compiled
|
|
12
|
+
* JavaScript output from the Angular compiler (which contains the
|
|
13
|
+
* `ClassName.ɵcmp = ɵɵdefineComponent({...})` assignments).
|
|
14
|
+
*
|
|
15
|
+
* Only active when the platform's `i18n` option is configured.
|
|
16
|
+
* Only transforms modules loaded for the SSR environment.
|
|
17
|
+
*/
|
|
18
|
+
function i18nComponentRegistryPlugin() {
|
|
19
|
+
return {
|
|
20
|
+
name: "analogjs-i18n-component-registry",
|
|
21
|
+
enforce: "post",
|
|
22
|
+
transform(code, id, options) {
|
|
23
|
+
if (!options?.ssr) return;
|
|
24
|
+
if (!code.includes(".ɵcmp")) return;
|
|
25
|
+
if (id.includes("node_modules")) return;
|
|
26
|
+
if (!id.match(/\.(ts|js)(\?|$)/)) return;
|
|
27
|
+
const classNames = findComponentClassNames(this.parse(code));
|
|
28
|
+
if (classNames.size === 0) return;
|
|
29
|
+
const registrations = [...classNames].map((name) => `__analog_i18n_reg(${name});`).join("\n");
|
|
30
|
+
const s = new MagicString(code);
|
|
31
|
+
s.prepend(`import { ɵregisterI18nComponentDef as __analog_i18n_reg } from '@analogjs/router';\n`);
|
|
32
|
+
s.append(`\n${registrations}\n`);
|
|
33
|
+
return {
|
|
34
|
+
code: s.toString(),
|
|
35
|
+
map: s.generateMap({
|
|
36
|
+
hires: true,
|
|
37
|
+
source: id,
|
|
38
|
+
includeContent: true
|
|
39
|
+
})
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Walks the AST to find class names whose definitions include a `ɵcmp`
|
|
46
|
+
* static property assignment — the marker Angular uses for compiled
|
|
47
|
+
* component definitions.
|
|
48
|
+
*
|
|
49
|
+
* Handles two codegen styles:
|
|
50
|
+
*
|
|
51
|
+
* Production (tree-shaken):
|
|
52
|
+
* _ClassName.ɵcmp = ɵɵdefineComponent({...})
|
|
53
|
+
* → AssignmentExpression left: MemberExpression(.ɵcmp) object: Identifier
|
|
54
|
+
*
|
|
55
|
+
* Dev mode (class fields):
|
|
56
|
+
* class Foo { static { this.ɵcmp = i0.ɵɵdefineComponent({...}) } }
|
|
57
|
+
* → ClassDeclaration → StaticBlock → AssignmentExpression left: MemberExpression(.ɵcmp) object: ThisExpression
|
|
58
|
+
*/
|
|
59
|
+
function findComponentClassNames(ast) {
|
|
60
|
+
const names = /* @__PURE__ */ new Set();
|
|
61
|
+
walk(ast, (node) => {
|
|
62
|
+
if (node.type === "AssignmentExpression" && isNode(node.left) && node.left.type === "MemberExpression" && isNode(node.left.property) && node.left.property.name === "ɵcmp" && isNode(node.left.object) && node.left.object.type === "Identifier") {
|
|
63
|
+
const name = node.left.object.name;
|
|
64
|
+
if (name !== "this") names.add(name);
|
|
65
|
+
}
|
|
66
|
+
if ((node.type === "ClassDeclaration" || node.type === "ClassExpression") && isNode(node.id) && node.id.name) {
|
|
67
|
+
const className = node.id.name;
|
|
68
|
+
if (classHasCmpDef(node)) names.add(className);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return names;
|
|
72
|
+
}
|
|
73
|
+
function classHasCmpDef(classNode) {
|
|
74
|
+
let found = false;
|
|
75
|
+
walk(classNode, (node) => {
|
|
76
|
+
if (found) return;
|
|
77
|
+
if (node.type === "PropertyDefinition" && node.static === true && isNode(node.key) && node.key.name === "ɵcmp") {
|
|
78
|
+
found = true;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (node.type === "AssignmentExpression" && isNode(node.left) && node.left.type === "MemberExpression" && isNode(node.left.property) && node.left.property.name === "ɵcmp" && isNode(node.left.object) && node.left.object.type === "ThisExpression") found = true;
|
|
82
|
+
});
|
|
83
|
+
return found;
|
|
84
|
+
}
|
|
85
|
+
function isNode(v) {
|
|
86
|
+
return v != null && typeof v === "object" && "type" in v;
|
|
87
|
+
}
|
|
88
|
+
function walk(node, visitor) {
|
|
89
|
+
visitor(node);
|
|
90
|
+
for (const key of Object.keys(node)) {
|
|
91
|
+
const child = node[key];
|
|
92
|
+
if (Array.isArray(child)) {
|
|
93
|
+
for (const item of child) if (isNode(item)) walk(item, visitor);
|
|
94
|
+
} else if (isNode(child)) walk(child, visitor);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { i18nComponentRegistryPlugin };
|
|
99
|
+
|
|
100
|
+
//# sourceMappingURL=i18n-component-registry-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n-component-registry-plugin.js","names":[],"sources":["../../../src/lib/i18n-component-registry-plugin.ts"],"sourcesContent":["import type { Plugin, TransformResult } from 'vite';\nimport MagicString from 'magic-string';\n\n/**\n * Vite plugin that instruments compiled Angular component definitions with\n * calls to `registerI18nComponentDef()` from `@analogjs/router`. This\n * populates a process-level registry of component definitions that the\n * server renderer uses to null cached `tView` objects between SSR requests,\n * allowing `$localize` tagged templates in `consts()` to re-evaluate with\n * the freshly loaded translations for each request's locale.\n *\n * The plugin runs in `enforce: 'post'` so that it sees the compiled\n * JavaScript output from the Angular compiler (which contains the\n * `ClassName.ɵcmp = ɵɵdefineComponent({...})` assignments).\n *\n * Only active when the platform's `i18n` option is configured.\n * Only transforms modules loaded for the SSR environment.\n */\nexport function i18nComponentRegistryPlugin(): Plugin {\n return {\n name: 'analogjs-i18n-component-registry',\n enforce: 'post',\n\n transform(code, id, options): TransformResult | undefined {\n if (!options?.ssr) return;\n if (!code.includes('.ɵcmp')) return;\n if (id.includes('node_modules')) return;\n if (!id.match(/\\.(ts|js)(\\?|$)/)) return;\n\n const ast = this.parse(code) as unknown as AstNode;\n const classNames = findComponentClassNames(ast);\n\n if (classNames.size === 0) return;\n\n const registrations = [...classNames]\n .map((name) => `__analog_i18n_reg(${name});`)\n .join('\\n');\n\n // Use MagicString so the source map stays aligned with the original\n // file — prepended imports and appended registration calls must not\n // shift line numbers for frames that land inside the user's code.\n const s = new MagicString(code);\n s.prepend(\n `import { ɵregisterI18nComponentDef as __analog_i18n_reg } from '@analogjs/router';\\n`,\n );\n s.append(`\\n${registrations}\\n`);\n\n return {\n code: s.toString(),\n map: s.generateMap({\n hires: true,\n source: id,\n includeContent: true,\n }) as TransformResult['map'],\n };\n },\n };\n}\n\n// Minimal ESTree node shape used by the walker.\ninterface AstNode {\n type: string;\n [key: string]: unknown;\n}\n\n/**\n * Walks the AST to find class names whose definitions include a `ɵcmp`\n * static property assignment — the marker Angular uses for compiled\n * component definitions.\n *\n * Handles two codegen styles:\n *\n * Production (tree-shaken):\n * _ClassName.ɵcmp = ɵɵdefineComponent({...})\n * → AssignmentExpression left: MemberExpression(.ɵcmp) object: Identifier\n *\n * Dev mode (class fields):\n * class Foo { static { this.ɵcmp = i0.ɵɵdefineComponent({...}) } }\n * → ClassDeclaration → StaticBlock → AssignmentExpression left: MemberExpression(.ɵcmp) object: ThisExpression\n */\nfunction findComponentClassNames(ast: AstNode): Set<string> {\n const names = new Set<string>();\n\n walk(ast, (node: any) => {\n // Prod: top-level `Identifier.ɵcmp = ...`\n if (\n node.type === 'AssignmentExpression' &&\n isNode(node.left) &&\n node.left.type === 'MemberExpression' &&\n isNode(node.left.property) &&\n (node.left.property as AstNode & { name?: string }).name === 'ɵcmp' &&\n isNode(node.left.object) &&\n node.left.object.type === 'Identifier'\n ) {\n const name = (node.left.object as AstNode & { name: string }).name;\n if (name !== 'this') {\n names.add(name);\n }\n }\n\n // Dev: ClassDeclaration containing `this.ɵcmp = ...` in a static block\n if (\n (node.type === 'ClassDeclaration' || node.type === 'ClassExpression') &&\n isNode(node.id) &&\n (node.id as AstNode & { name?: string }).name\n ) {\n const className = (node.id as AstNode & { name: string }).name;\n if (classHasCmpDef(node)) {\n names.add(className);\n }\n }\n });\n\n return names;\n}\n\nfunction classHasCmpDef(classNode: AstNode): boolean {\n let found = false;\n\n walk(classNode, (node: any) => {\n if (found) return;\n\n // static ɵcmp = ... (PropertyDefinition)\n if (\n node.type === 'PropertyDefinition' &&\n node.static === true &&\n isNode(node.key) &&\n (node.key as AstNode & { name?: string }).name === 'ɵcmp'\n ) {\n found = true;\n return;\n }\n\n // static { this.ɵcmp = ... }\n if (\n node.type === 'AssignmentExpression' &&\n isNode(node.left) &&\n node.left.type === 'MemberExpression' &&\n isNode(node.left.property) &&\n (node.left.property as AstNode & { name?: string }).name === 'ɵcmp' &&\n isNode(node.left.object) &&\n node.left.object.type === 'ThisExpression'\n ) {\n found = true;\n }\n });\n\n return found;\n}\n\nfunction isNode(v: unknown): v is AstNode {\n return v != null && typeof v === 'object' && 'type' in (v as object);\n}\n\nfunction walk(node: AstNode, visitor: (n: AstNode) => void): void {\n visitor(node);\n for (const key of Object.keys(node)) {\n const child = node[key];\n if (Array.isArray(child)) {\n for (const item of child) {\n if (isNode(item)) walk(item, visitor);\n }\n } else if (isNode(child)) {\n walk(child, visitor);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,SAAgB,8BAAsC;AACpD,QAAO;EACL,MAAM;EACN,SAAS;EAET,UAAU,MAAM,IAAI,SAAsC;AACxD,OAAI,CAAC,SAAS,IAAK;AACnB,OAAI,CAAC,KAAK,SAAS,QAAQ,CAAE;AAC7B,OAAI,GAAG,SAAS,eAAe,CAAE;AACjC,OAAI,CAAC,GAAG,MAAM,kBAAkB,CAAE;GAGlC,MAAM,aAAa,wBADP,KAAK,MAAM,KAAK,CACmB;AAE/C,OAAI,WAAW,SAAS,EAAG;GAE3B,MAAM,gBAAgB,CAAC,GAAG,WAAW,CAClC,KAAK,SAAS,qBAAqB,KAAK,IAAI,CAC5C,KAAK,KAAK;GAKb,MAAM,IAAI,IAAI,YAAY,KAAK;AAC/B,KAAE,QACA,uFACD;AACD,KAAE,OAAO,KAAK,cAAc,IAAI;AAEhC,UAAO;IACL,MAAM,EAAE,UAAU;IAClB,KAAK,EAAE,YAAY;KACjB,OAAO;KACP,QAAQ;KACR,gBAAgB;KACjB,CAAC;IACH;;EAEJ;;;;;;;;;;;;;;;;;AAwBH,SAAS,wBAAwB,KAA2B;CAC1D,MAAM,wBAAQ,IAAI,KAAa;AAE/B,MAAK,MAAM,SAAc;AAEvB,MACE,KAAK,SAAS,0BACd,OAAO,KAAK,KAAK,IACjB,KAAK,KAAK,SAAS,sBACnB,OAAO,KAAK,KAAK,SAAS,IACzB,KAAK,KAAK,SAAyC,SAAS,UAC7D,OAAO,KAAK,KAAK,OAAO,IACxB,KAAK,KAAK,OAAO,SAAS,cAC1B;GACA,MAAM,OAAQ,KAAK,KAAK,OAAsC;AAC9D,OAAI,SAAS,OACX,OAAM,IAAI,KAAK;;AAKnB,OACG,KAAK,SAAS,sBAAsB,KAAK,SAAS,sBACnD,OAAO,KAAK,GAAG,IACd,KAAK,GAAmC,MACzC;GACA,MAAM,YAAa,KAAK,GAAkC;AAC1D,OAAI,eAAe,KAAK,CACtB,OAAM,IAAI,UAAU;;GAGxB;AAEF,QAAO;;AAGT,SAAS,eAAe,WAA6B;CACnD,IAAI,QAAQ;AAEZ,MAAK,YAAY,SAAc;AAC7B,MAAI,MAAO;AAGX,MACE,KAAK,SAAS,wBACd,KAAK,WAAW,QAChB,OAAO,KAAK,IAAI,IACf,KAAK,IAAoC,SAAS,QACnD;AACA,WAAQ;AACR;;AAIF,MACE,KAAK,SAAS,0BACd,OAAO,KAAK,KAAK,IACjB,KAAK,KAAK,SAAS,sBACnB,OAAO,KAAK,KAAK,SAAS,IACzB,KAAK,KAAK,SAAyC,SAAS,UAC7D,OAAO,KAAK,KAAK,OAAO,IACxB,KAAK,KAAK,OAAO,SAAS,iBAE1B,SAAQ;GAEV;AAEF,QAAO;;AAGT,SAAS,OAAO,GAA0B;AACxC,QAAO,KAAK,QAAQ,OAAO,MAAM,YAAY,UAAW;;AAG1D,SAAS,KAAK,MAAe,SAAqC;AAChE,SAAQ,KAAK;AACb,MAAK,MAAM,OAAO,OAAO,KAAK,KAAK,EAAE;EACnC,MAAM,QAAQ,KAAK;AACnB,MAAI,MAAM,QAAQ,MAAM;QACjB,MAAM,QAAQ,MACjB,KAAI,OAAO,KAAK,CAAE,MAAK,MAAM,QAAQ;aAE9B,OAAO,MAAM,CACtB,MAAK,OAAO,QAAQ"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
|
+
import { I18nOptions } from "./options.js";
|
|
3
|
+
/**
|
|
4
|
+
* Vite plugin that extracts i18n messages from compiled JavaScript output.
|
|
5
|
+
*
|
|
6
|
+
* After the client build completes, this plugin scans all `.js` files in the
|
|
7
|
+
* output directory for `$localize` tagged template literals and extracts the
|
|
8
|
+
* message IDs and source text. It then writes the extracted messages to a
|
|
9
|
+
* translation source file.
|
|
10
|
+
*
|
|
11
|
+
* Uses `@angular/localize/tools` MessageExtractor when available,
|
|
12
|
+
* falling back to a regex-based extractor.
|
|
13
|
+
*/
|
|
14
|
+
export declare function i18nExtractPlugin(i18nOptions: I18nOptions): Plugin;
|
|
15
|
+
export interface ExtractedMessage {
|
|
16
|
+
id: string;
|
|
17
|
+
text: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Regex-based fallback extractor for when @angular/localize/tools is not available.
|
|
22
|
+
*
|
|
23
|
+
* Parses `$localize` tagged template literals to extract message IDs and text.
|
|
24
|
+
* Handles the common forms:
|
|
25
|
+
* $localize`:@@messageId:text`
|
|
26
|
+
* $localize`:description@@messageId:text`
|
|
27
|
+
* $localize`text`
|
|
28
|
+
*/
|
|
29
|
+
export declare function extractWithRegex(files: string[]): ExtractedMessage[];
|
|
30
|
+
/**
|
|
31
|
+
* Serializes extracted messages into the specified format.
|
|
32
|
+
*/
|
|
33
|
+
export declare function serializeMessages(messages: ExtractedMessage[], format: string, sourceLocale: string): string;
|
|
@@ -0,0 +1,41 @@
|
|
|
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;
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,4 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
+
"builders": {
|
|
3
|
+
"vite-dev-server": "@analogjs/vite-plugin-angular:vite-dev-server",
|
|
4
|
+
"vite": "@analogjs/vite-plugin-angular:vite",
|
|
5
|
+
"vitest": "@analogjs/vitest-angular:test"
|
|
6
|
+
},
|
|
2
7
|
"executors": {
|
|
3
8
|
"vite-dev-server": {
|
|
4
9
|
"implementation": "./src/executors/vite-dev-server/vite-dev-server.impl",
|
|
@@ -33,5 +33,30 @@
|
|
|
33
33
|
"description": "Migrate and configure an Angular SPA to use Analog.",
|
|
34
34
|
"aliases": ["migrate"]
|
|
35
35
|
}
|
|
36
|
+
},
|
|
37
|
+
"schematics": {
|
|
38
|
+
"application": {
|
|
39
|
+
"factory": "./src/generators/app/compat#applicationSchematic",
|
|
40
|
+
"schema": "./src/generators/app/schema.json",
|
|
41
|
+
"description": "Generates an Analog application",
|
|
42
|
+
"aliases": ["app"]
|
|
43
|
+
},
|
|
44
|
+
"page": {
|
|
45
|
+
"factory": "./src/generators/page/compat#pageSchematic",
|
|
46
|
+
"schema": "./src/generators/page/schema.json",
|
|
47
|
+
"description": "Creates a new Analog page in the given or default project.",
|
|
48
|
+
"aliases": ["p"]
|
|
49
|
+
},
|
|
50
|
+
"setup-vitest": {
|
|
51
|
+
"factory": "./src/generators/setup-vitest/compat#setupVitestSchematic",
|
|
52
|
+
"schema": "./src/generators/setup-vitest/schema.json",
|
|
53
|
+
"description": "Setup the Vitest configuration."
|
|
54
|
+
},
|
|
55
|
+
"init": {
|
|
56
|
+
"factory": "./src/generators/init/compat#initSchematic",
|
|
57
|
+
"schema": "./src/generators/init/schema.json",
|
|
58
|
+
"description": "Migrate and configure an Angular SPA to use Analog.",
|
|
59
|
+
"aliases": ["migrate"]
|
|
60
|
+
}
|
|
36
61
|
}
|
|
37
62
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const require_capitalize = require("./capitalize.js");
|
|
2
|
+
const require_words = require("./words.js");
|
|
3
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/camelCase.mjs
|
|
4
|
+
function camelCase(str) {
|
|
5
|
+
const words$1 = require_words.words(str);
|
|
6
|
+
if (words$1.length === 0) return "";
|
|
7
|
+
const [first, ...rest] = words$1;
|
|
8
|
+
return `${first.toLowerCase()}${rest.map((word) => require_capitalize.capitalize(word)).join("")}`;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.camelCase = camelCase;
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=camelCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camelCase.js","names":["words","capitalize"],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/camelCase.mjs"],"sourcesContent":["import { capitalize } from './capitalize.mjs';\nimport { words } from './words.mjs';\n\nfunction camelCase(str) {\n const words$1 = words(str);\n if (words$1.length === 0) {\n return '';\n }\n const [first, ...rest] = words$1;\n return `${first.toLowerCase()}${rest.map(word => capitalize(word)).join('')}`;\n}\n\nexport { camelCase };\n"],"x_google_ignoreList":[0],"mappings":";;;AAGA,SAAS,UAAU,KAAK;CACpB,MAAM,UAAUA,cAAAA,MAAM,IAAI;AAC1B,KAAI,QAAQ,WAAW,EACnB,QAAO;CAEX,MAAM,CAAC,OAAO,GAAG,QAAQ;AACzB,QAAO,GAAG,MAAM,aAAa,GAAG,KAAK,KAAI,SAAQC,mBAAAA,WAAW,KAAK,CAAC,CAAC,KAAK,GAAG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/capitalize.mjs
|
|
2
|
+
function capitalize(str) {
|
|
3
|
+
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
exports.capitalize = capitalize;
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=capitalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capitalize.js","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/capitalize.mjs"],"sourcesContent":["function capitalize(str) {\n return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());\n}\n\nexport { capitalize };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,SAAS,WAAW,KAAK;AACrB,QAAQ,IAAI,OAAO,EAAE,CAAC,aAAa,GAAG,IAAI,MAAM,EAAE,CAAC,aAAa"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/words.mjs
|
|
2
|
+
var CASE_SPLIT_PATTERN = /\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;
|
|
3
|
+
function words(str) {
|
|
4
|
+
return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
exports.words = words;
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=words.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"words.js","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/words.mjs"],"sourcesContent":["const CASE_SPLIT_PATTERN = /\\p{Lu}?\\p{Ll}+|[0-9]+|\\p{Lu}+(?!\\p{Ll})|\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{L}+/gu;\nfunction words(str) {\n return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);\n}\n\nexport { CASE_SPLIT_PATTERN, words };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,IAAM,qBAAqB;AAC3B,SAAS,MAAM,KAAK;AAChB,QAAO,MAAM,KAAK,IAAI,MAAM,mBAAmB,IAAI,EAAE,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.default = compat;
|
|
1
|
+
const require_src_executors_vite_vite_impl = require("./vite.impl.js");
|
|
2
|
+
//#region packages/nx-plugin/src/executors/vite/compat.ts
|
|
3
|
+
var compat = (0, require("@nx/devkit").convertNxExecutor)(require_src_executors_vite_vite_impl);
|
|
4
|
+
//#endregion
|
|
5
|
+
module.exports = compat;
|
|
6
|
+
|
|
8
7
|
//# sourceMappingURL=compat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat.js","
|
|
1
|
+
{"version":3,"file":"compat.js","names":[],"sources":["../../../../../../../../nx-plugin/src/executors/vite/compat.ts"],"sourcesContent":["import { convertNxExecutor } from '@nx/devkit';\n\nimport viteBuildExecutor from './vite.impl';\n\nconst compat: ReturnType<typeof convertNxExecutor> =\n convertNxExecutor(viteBuildExecutor);\nexport default compat;\n"],"mappings":";;AAIA,IAAM,UAAA,yBAAA,mBACc,qCAAkB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { FileReplacement } from '@nx/vite/plugins/rollup-replace-files.plugin';
|
|
2
|
-
export { ViteBuildExecutorOptions } from '@nx/vite/executors';
|
|
2
|
+
export type { ViteBuildExecutorOptions } from '@nx/vite/executors';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { viteBuildExecutor } from
|
|
1
|
+
import { viteBuildExecutor } from "@nx/vite/executors";
|
|
2
2
|
export default viteBuildExecutor;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports
|
|
1
|
+
//#region packages/nx-plugin/src/executors/vite/vite.impl.ts
|
|
2
|
+
var vite_impl_default = require("@nx/vite/executors").viteBuildExecutor;
|
|
3
|
+
//#endregion
|
|
4
|
+
module.exports = vite_impl_default;
|
|
5
|
+
|
|
5
6
|
//# sourceMappingURL=vite.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.impl.js","
|
|
1
|
+
{"version":3,"file":"vite.impl.js","names":[],"sources":["../../../../../../../../nx-plugin/src/executors/vite/vite.impl.ts"],"sourcesContent":["import { viteBuildExecutor } from '@nx/vite/executors';\n\nexport default viteBuildExecutor;\n"],"mappings":";AAEA,IAAA,kDAAe"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.default = compat;
|
|
1
|
+
const require_src_executors_vite_dev_server_vite_dev_server_impl = require("./vite-dev-server.impl.js");
|
|
2
|
+
//#region packages/nx-plugin/src/executors/vite-dev-server/compat.ts
|
|
3
|
+
var compat = (0, require("@nx/devkit").convertNxExecutor)(require_src_executors_vite_dev_server_vite_dev_server_impl);
|
|
4
|
+
//#endregion
|
|
5
|
+
module.exports = compat;
|
|
6
|
+
|
|
8
7
|
//# sourceMappingURL=compat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat.js","
|
|
1
|
+
{"version":3,"file":"compat.js","names":[],"sources":["../../../../../../../../nx-plugin/src/executors/vite-dev-server/compat.ts"],"sourcesContent":["import { convertNxExecutor } from '@nx/devkit';\n\nimport viteDevServerExecutor from './vite-dev-server.impl';\n\nconst compat: ReturnType<typeof convertNxExecutor> = convertNxExecutor(\n viteDevServerExecutor,\n);\nexport default compat;\n"],"mappings":";;AAIA,IAAM,UAAA,yBAAA,mBACJ,2DACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ViteDevServerExecutorOptions } from '@nx/vite/executors';
|
|
1
|
+
export type { ViteDevServerExecutorOptions } from '@nx/vite/executors';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { viteDevServerExecutor } from
|
|
1
|
+
import { viteDevServerExecutor } from "@nx/vite/executors";
|
|
2
2
|
export default viteDevServerExecutor;
|