@analogjs/platform 3.0.0-alpha.99 → 3.0.0-beta.2
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/migrate-setup-testbed-browser-mode/migrate-setup-testbed-browser-mode.js +8 -6
- package/migrations/migrate-setup-testbed-browser-mode/migrate-setup-testbed-browser-mode.js.map +1 -1
- package/migrations/migrate-to-separated-plugins/migrate-to-separated-plugins.js.map +1 -1
- package/migrations/migrate-vitest-builder-aliases/migrate-vitest-builder-aliases.js.map +1 -1
- package/migrations/utils/source-edits.js.map +1 -1
- package/package.json +2 -2
- package/src/lib/analog-integration-plugin.js.map +1 -1
- package/src/lib/clear-client-page-endpoint.js.map +1 -1
- package/src/lib/content/marked/index.js.map +1 -1
- package/src/lib/content/marked/marked-content-highlighter.js.map +1 -1
- package/src/lib/content/marked/marked-setup.service.js.map +1 -1
- package/src/lib/content/prism/angular.js.map +1 -1
- package/src/lib/content/prism/index.js +1 -1
- package/src/lib/content/prism/index.js.map +1 -1
- package/src/lib/content/prism/prism-highlighter.js.map +1 -1
- package/src/lib/content/shiki/index.js +6 -4
- package/src/lib/content/shiki/index.js.map +1 -1
- package/src/lib/content/shiki/shiki-highlighter.js.map +1 -1
- package/src/lib/content/utils/escape-html.js.map +1 -1
- package/src/lib/content-plugin.js +18 -16
- package/src/lib/content-plugin.js.map +1 -1
- package/src/lib/deps-plugin.js.map +1 -1
- package/src/lib/discover-library-routes.js.map +1 -1
- package/src/lib/inject-server-fn-ids.js.map +1 -1
- package/src/lib/nitro/analog-nitro-plugin.js +8 -4
- package/src/lib/nitro/analog-nitro-plugin.js.map +1 -1
- package/src/lib/nitro/angular-linker-plugin.js +2 -1
- package/src/lib/nitro/angular-linker-plugin.js.map +1 -1
- package/src/lib/nitro/build-sitemap.js.map +1 -1
- package/src/lib/nitro/debug.js +8 -4
- package/src/lib/nitro/debug.js.map +1 -1
- package/src/lib/nitro/get-content-files.js +2 -1
- package/src/lib/nitro/get-content-files.js.map +1 -1
- package/src/lib/nitro/get-page-handlers.js +2 -1
- package/src/lib/nitro/get-page-handlers.js.map +1 -1
- package/src/lib/nitro/get-server-fn-handlers.js.map +1 -1
- package/src/lib/nitro/i18n-prerender.js +1 -1
- package/src/lib/nitro/i18n-prerender.js.map +1 -1
- package/src/lib/nitro/page-endpoints-plugin.js.map +1 -1
- package/src/lib/nitro/post-rendering-hook.js.map +1 -1
- package/src/lib/nitro/server-fn-endpoints.js +1 -1
- package/src/lib/nitro/server-fn-endpoints.js.map +1 -1
- package/src/lib/nx-plugin/_virtual/_rolldown/runtime.js +1 -1
- package/src/lib/nx-plugin/node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/camelCase.js.map +1 -1
- package/src/lib/nx-plugin/node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/capitalize.js.map +1 -1
- package/src/lib/nx-plugin/node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/words.js +1 -0
- package/src/lib/nx-plugin/node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/words.js.map +1 -1
- package/src/lib/nx-plugin/src/executors/vite-dev-server/compat.js +0 -1
- 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/vite-dev-server.impl.js +0 -1
- package/src/lib/nx-plugin/src/executors/vite-dev-server/vite-dev-server.impl.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/compat.js +0 -1
- package/src/lib/nx-plugin/src/generators/app/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/generator.js +0 -1
- 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.js +0 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-agent-context.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-project-config.js +48 -47
- 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.js +0 -1
- 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-files.js +0 -1
- 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.js +0 -1
- 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.js +1 -1
- 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.js +0 -1
- 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/cleanup-files.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/update-index-html.js +0 -1
- 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.js +0 -1
- 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/tailwind-dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/compat.js +0 -1
- package/src/lib/nx-plugin/src/generators/init/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/generator.js +0 -1
- 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.js +0 -1
- 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.js +0 -1
- 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.js +0 -1
- 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.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-index-html.js +0 -1
- 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.js +0 -1
- 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.js +2 -2
- 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.js +0 -1
- 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.js +0 -1
- 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.js +0 -1
- package/src/lib/nx-plugin/src/generators/init/lib/update-test-tsconfig.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/page/compat.js +0 -1
- package/src/lib/nx-plugin/src/generators/page/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/page/generator.js +2 -2
- package/src/lib/nx-plugin/src/generators/page/generator.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/preset/generator.js +0 -1
- package/src/lib/nx-plugin/src/generators/preset/generator.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/version-utils.js +0 -1
- package/src/lib/nx-plugin/src/utils/version-utils.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/dependencies.js +0 -1
- package/src/lib/nx-plugin/src/utils/versions/dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/dev-dependencies.js +2 -2
- package/src/lib/nx-plugin/src/utils/versions/dev-dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/versions.d.ts +5 -5
- package/src/lib/nx-plugin/src/utils/versions/versions.js +5 -5
- package/src/lib/nx-plugin/src/utils/versions/versions.js.map +1 -1
- package/src/lib/platform-plugin.js.map +1 -1
- package/src/lib/route-file-discovery.js.map +1 -1
- package/src/lib/route-idiom-diagnostics.js +2 -1
- package/src/lib/route-idiom-diagnostics.js.map +1 -1
- package/src/lib/route-manifest.js +1 -1
- package/src/lib/route-manifest.js.map +1 -1
- package/src/lib/router-plugin.js +18 -2
- package/src/lib/router-plugin.js.map +1 -1
- package/src/lib/server-fn-client-transform.js.map +1 -1
- package/src/lib/server-fn-id.js.map +1 -1
- package/src/lib/ssr/defer-streaming-plugin.js.map +1 -1
- package/src/lib/ssr/inject-html-plugin.js.map +1 -1
- package/src/lib/ssr/ssr-build-plugin.js.map +1 -1
- package/src/lib/typed-routes-plugin.js.map +1 -1
- package/src/lib/utils/debug-harness.js.map +1 -1
- package/src/lib/utils/debug-log-file.js +2 -1
- package/src/lib/utils/debug-log-file.js.map +1 -1
- package/src/lib/utils/debug.js +7 -4
- package/src/lib/utils/debug.js.map +1 -1
- package/src/lib/utils/rolldown.js.map +1 -1
- package/src/server-mode-plugin.js.map +1 -1
|
@@ -16,7 +16,8 @@ import { globSync } from "tinyglobby";
|
|
|
16
16
|
* - (auth)/login.server.ts → /api/_analog/pages/-auth-/login
|
|
17
17
|
*/
|
|
18
18
|
function getPageHandlers({ workspaceRoot, sourceRoot, rootDir, additionalPagesDirs }) {
|
|
19
|
-
|
|
19
|
+
const root = normalizePath(resolve(workspaceRoot, rootDir));
|
|
20
|
+
return globSync([`${root}/${sourceRoot}/app/pages/**/*.server.ts`, ...(additionalPagesDirs || []).map((dir) => `${workspaceRoot}${dir}/**/*.server.ts`)], {
|
|
20
21
|
dot: true,
|
|
21
22
|
absolute: true
|
|
22
23
|
}).map((endpointFile) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-page-handlers.js","names":[],"sources":["../../../../src/lib/nitro/get-page-handlers.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { globSync } from 'tinyglobby';\n\nimport type { NitroEventHandler } from 'nitro/types';\nimport { normalizePath } from 'vite';\n\ntype GetHandlersArgs = {\n workspaceRoot: string;\n sourceRoot: string;\n rootDir: string;\n additionalPagesDirs?: string[];\n};\n\n/**\n * Discovers and generates Nitro event handlers for server-side page routes.\n *\n * Discovers all `.server.ts` files under `app/pages/**` and any additional\n * pages directories, then maps each file to a Nitro route pattern under\n * `/api/_analog/pages/...`.\n *\n * Route transformation examples:\n * - index.server.ts → /api/_analog/pages/index\n * - users/[id].server.ts → /api/_analog/pages/users/:id\n * - products/[...slug].server.ts → /api/_analog/pages/products/**:slug\n * - (auth)/login.server.ts → /api/_analog/pages/-auth-/login\n */\nexport function getPageHandlers({\n workspaceRoot,\n sourceRoot,\n rootDir,\n additionalPagesDirs,\n}: GetHandlersArgs): NitroEventHandler[] {\n const root = normalizePath(resolve(workspaceRoot, rootDir));\n\n const endpointFiles: string[] = globSync(\n [\n `${root}/${sourceRoot}/app/pages/**/*.server.ts`,\n ...(additionalPagesDirs || []).map(\n (dir) => `${workspaceRoot}${dir}/**/*.server.ts`,\n ),\n ],\n { dot: true, absolute: true },\n );\n\n const handlers: NitroEventHandler[] = endpointFiles.map((endpointFile) => {\n const normalized = normalizePath(endpointFile);\n const route = normalized\n .replace(/^(.*?)\\/pages/, '/pages')\n .replace(/\\.server\\.ts$/, '')\n .replace(/\\[\\.{3}(.+)\\]/g, '**:$1')\n .replace(/\\[\\.{3}(\\w+)\\]/g, '**:$1')\n // Strip Angular Router group syntax `(group)` from any segment, not\n // just trailing ones. Routes like `(auth)/login.server.ts` need to\n // become `/-auth-/login`, otherwise the literal parens leak through\n // and the handler is mounted under an invalid Nitro path.\n .replace(/\\/\\(([^/]+)\\)/g, '/-$1-')\n .replace(/\\[(\\w+)\\]/g, ':$1')\n .replace(/\\./g, '/');\n\n return {\n handler: endpointFile,\n route: `/api/_analog${route}`,\n lazy: true,\n };\n });\n\n return handlers;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA0BA,SAAgB,gBAAgB,EAC9B,eACA,YACA,SACA,uBACuC;
|
|
1
|
+
{"version":3,"file":"get-page-handlers.js","names":[],"sources":["../../../../src/lib/nitro/get-page-handlers.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { globSync } from 'tinyglobby';\n\nimport type { NitroEventHandler } from 'nitro/types';\nimport { normalizePath } from 'vite';\n\ntype GetHandlersArgs = {\n workspaceRoot: string;\n sourceRoot: string;\n rootDir: string;\n additionalPagesDirs?: string[];\n};\n\n/**\n * Discovers and generates Nitro event handlers for server-side page routes.\n *\n * Discovers all `.server.ts` files under `app/pages/**` and any additional\n * pages directories, then maps each file to a Nitro route pattern under\n * `/api/_analog/pages/...`.\n *\n * Route transformation examples:\n * - index.server.ts → /api/_analog/pages/index\n * - users/[id].server.ts → /api/_analog/pages/users/:id\n * - products/[...slug].server.ts → /api/_analog/pages/products/**:slug\n * - (auth)/login.server.ts → /api/_analog/pages/-auth-/login\n */\nexport function getPageHandlers({\n workspaceRoot,\n sourceRoot,\n rootDir,\n additionalPagesDirs,\n}: GetHandlersArgs): NitroEventHandler[] {\n const root = normalizePath(resolve(workspaceRoot, rootDir));\n\n const endpointFiles: string[] = globSync(\n [\n `${root}/${sourceRoot}/app/pages/**/*.server.ts`,\n ...(additionalPagesDirs || []).map(\n (dir) => `${workspaceRoot}${dir}/**/*.server.ts`,\n ),\n ],\n { dot: true, absolute: true },\n );\n\n const handlers: NitroEventHandler[] = endpointFiles.map((endpointFile) => {\n const normalized = normalizePath(endpointFile);\n const route = normalized\n .replace(/^(.*?)\\/pages/, '/pages')\n .replace(/\\.server\\.ts$/, '')\n .replace(/\\[\\.{3}(.+)\\]/g, '**:$1')\n .replace(/\\[\\.{3}(\\w+)\\]/g, '**:$1')\n // Strip Angular Router group syntax `(group)` from any segment, not\n // just trailing ones. Routes like `(auth)/login.server.ts` need to\n // become `/-auth-/login`, otherwise the literal parens leak through\n // and the handler is mounted under an invalid Nitro path.\n .replace(/\\/\\(([^/]+)\\)/g, '/-$1-')\n .replace(/\\[(\\w+)\\]/g, ':$1')\n .replace(/\\./g, '/');\n\n return {\n handler: endpointFile,\n route: `/api/_analog${route}`,\n lazy: true,\n };\n });\n\n return handlers;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA0BA,SAAgB,gBAAgB,EAC9B,eACA,YACA,SACA,uBACuC;CACvC,MAAM,OAAO,cAAc,QAAQ,eAAe,OAAO,CAAC;CAkC1D,OAhCgC,SAC9B,CACE,GAAG,KAAK,GAAG,WAAW,4BACtB,IAAI,uBAAuB,CAAC,EAAA,CAAG,KAC5B,QAAQ,GAAG,gBAAgB,IAAI,gBAClC,CACF,GACA;EAAE,KAAK;EAAM,UAAU;CAAK,CAGQ,CAAA,CAAc,KAAK,iBAAiB;EAexE,OAAO;GACL,SAAS;GACT,OAAO,eAhBU,cAAc,YACnB,CAAA,CACX,QAAQ,iBAAiB,QAAQ,CAAC,CAClC,QAAQ,iBAAiB,EAAE,CAAC,CAC5B,QAAQ,kBAAkB,OAAO,CAAC,CAClC,QAAQ,mBAAmB,OAAO,CAAC,CAKnC,QAAQ,kBAAkB,OAAO,CAAC,CAClC,QAAQ,cAAc,KAAK,CAAC,CAC5B,QAAQ,OAAO,GAIM;GACtB,MAAM;EACR;CACF,CAEO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-server-fn-handlers.js","names":[],"sources":["../../../../src/lib/nitro/get-server-fn-handlers.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { parseSync } from 'oxc-parser';\nimport { resolve } from 'node:path';\nimport { globSync } from 'tinyglobby';\n\nimport { normalizePath } from 'vite';\n\nexport type GetServerFnHandlersArgs = {\n workspaceRoot: string;\n sourceRoot: string;\n rootDir: string;\n additionalServerFnDirs?: string[];\n};\n\nexport type ServerFnHandlerModule = {\n /** Absolute, normalized path to a discovered `*.server.ts` module. */\n file: string;\n};\n\n/**\n * `*.server.ts` files that are matched by the glob but are never server-function\n * hosts, so importing them for registration side-effects would be wrong.\n *\n * The SSR entries (`main.server.ts`, `main-cf.server.ts`, …) sit at the top of\n * the source root and bootstrap the whole Angular application; importing one\n * would pull the entire app into the dispatch bundle. They are matched by\n * directory rather than by name so a page named `main.server.ts` still counts.\n */\nconst EXCLUDED_SERVER_FILES: RegExp[] = [/\\/app\\.config\\.server\\.ts$/];\n\n/**\n * Discovers the `*.server.ts` modules that may define server functions.\n *\n * Unlike page endpoints (one Nitro handler per file), server functions all\n * share a single `/_analog/fn/:id` dispatch route. The discovered modules are\n * imported for their registration side-effects — each `serverFn(...)` call\n * registers itself into the server-side registry at import time — after which\n * dispatch looks up the requested function by id.\n *\n * Scope is `<projectRoot>/<sourceRoot>/**\\/*.server.ts` because the RFC allows a\n * server function to live in any `.server.ts` module, including existing page\n * server files. Only modules defining a server function that the client\n * transform can rewrite participate.\n * Angular SSR config (`app.config.server.ts`) is excluded — it is not a route or\n * function module and must not be pulled into the dispatch bundle.\n *\n * @returns discovered modules, de-duplicated and sorted for deterministic output\n */\nexport function getServerFnHandlers({\n workspaceRoot,\n sourceRoot,\n rootDir,\n additionalServerFnDirs,\n}: GetServerFnHandlersArgs): ServerFnHandlerModule[] {\n const root = normalizePath(resolve(workspaceRoot, rootDir));\n\n const files = globSync(\n [\n `${root}/${sourceRoot}/**/*.server.ts`,\n ...(additionalServerFnDirs || []).map(\n (dir) => `${workspaceRoot}${dir}/**/*.server.ts`,\n ),\n ],\n { dot: true, absolute: true },\n ).map((file) => normalizePath(file));\n\n const sourceRootDir = `${root}/${sourceRoot}/`;\n const seen = new Set<string>();\n return files\n .filter((file) => !EXCLUDED_SERVER_FILES.some((re) => re.test(file)))\n .filter(\n (file) =>\n !file.startsWith(sourceRootDir) ||\n file.slice(sourceRootDir.length).includes('/'),\n )\n .filter((file) => (seen.has(file) ? false : (seen.add(file), true)))\n .sort()\n .filter(definesServerFn)\n .map((file) => ({ file }));\n}\n\n/**\n * Match the client scrub's supported server-function declaration shape. The\n * scrub deliberately falls back to the conventional `serverFn` name when the\n * function is re-exported through a local barrel, so discovery must make the\n * same choice or the browser receives a proxy without a dispatch route.\n */\nfunction definesServerFn(file: string): boolean {\n const code = readFileSync(file, 'utf8');\n if (!code.includes('serverFn')) return false;\n\n const { program } = parseSync(file, code);\n const localNames = new Set<string>();\n for (const node of program.body) {\n if (\n node.type !== 'ImportDeclaration' ||\n node.source.value !== '@analogjs/router/server'\n ) {\n continue;\n }\n for (const specifier of node.specifiers) {\n if (\n specifier.type === 'ImportSpecifier' &&\n (specifier.imported.type === 'Identifier'\n ? specifier.imported.name\n : specifier.imported.value) === 'serverFn'\n ) {\n localNames.add(specifier.local.name);\n }\n }\n }\n if (localNames.size === 0) localNames.add('serverFn');\n\n return program.body.some(\n (node) =>\n node.type === 'ExportNamedDeclaration' &&\n node.declaration?.type === 'VariableDeclaration' &&\n node.declaration.declarations.some(\n (declarator) =>\n declarator.id?.type === 'Identifier' &&\n declarator.init?.type === 'CallExpression' &&\n declarator.init.callee?.type === 'Identifier' &&\n localNames.has(declarator.init.callee.name),\n ),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4BA,IAAM,wBAAkC,CAAC,
|
|
1
|
+
{"version":3,"file":"get-server-fn-handlers.js","names":[],"sources":["../../../../src/lib/nitro/get-server-fn-handlers.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { parseSync } from 'oxc-parser';\nimport { resolve } from 'node:path';\nimport { globSync } from 'tinyglobby';\n\nimport { normalizePath } from 'vite';\n\nexport type GetServerFnHandlersArgs = {\n workspaceRoot: string;\n sourceRoot: string;\n rootDir: string;\n additionalServerFnDirs?: string[];\n};\n\nexport type ServerFnHandlerModule = {\n /** Absolute, normalized path to a discovered `*.server.ts` module. */\n file: string;\n};\n\n/**\n * `*.server.ts` files that are matched by the glob but are never server-function\n * hosts, so importing them for registration side-effects would be wrong.\n *\n * The SSR entries (`main.server.ts`, `main-cf.server.ts`, …) sit at the top of\n * the source root and bootstrap the whole Angular application; importing one\n * would pull the entire app into the dispatch bundle. They are matched by\n * directory rather than by name so a page named `main.server.ts` still counts.\n */\nconst EXCLUDED_SERVER_FILES: RegExp[] = [/\\/app\\.config\\.server\\.ts$/];\n\n/**\n * Discovers the `*.server.ts` modules that may define server functions.\n *\n * Unlike page endpoints (one Nitro handler per file), server functions all\n * share a single `/_analog/fn/:id` dispatch route. The discovered modules are\n * imported for their registration side-effects — each `serverFn(...)` call\n * registers itself into the server-side registry at import time — after which\n * dispatch looks up the requested function by id.\n *\n * Scope is `<projectRoot>/<sourceRoot>/**\\/*.server.ts` because the RFC allows a\n * server function to live in any `.server.ts` module, including existing page\n * server files. Only modules defining a server function that the client\n * transform can rewrite participate.\n * Angular SSR config (`app.config.server.ts`) is excluded — it is not a route or\n * function module and must not be pulled into the dispatch bundle.\n *\n * @returns discovered modules, de-duplicated and sorted for deterministic output\n */\nexport function getServerFnHandlers({\n workspaceRoot,\n sourceRoot,\n rootDir,\n additionalServerFnDirs,\n}: GetServerFnHandlersArgs): ServerFnHandlerModule[] {\n const root = normalizePath(resolve(workspaceRoot, rootDir));\n\n const files = globSync(\n [\n `${root}/${sourceRoot}/**/*.server.ts`,\n ...(additionalServerFnDirs || []).map(\n (dir) => `${workspaceRoot}${dir}/**/*.server.ts`,\n ),\n ],\n { dot: true, absolute: true },\n ).map((file) => normalizePath(file));\n\n const sourceRootDir = `${root}/${sourceRoot}/`;\n const seen = new Set<string>();\n return files\n .filter((file) => !EXCLUDED_SERVER_FILES.some((re) => re.test(file)))\n .filter(\n (file) =>\n !file.startsWith(sourceRootDir) ||\n file.slice(sourceRootDir.length).includes('/'),\n )\n .filter((file) => (seen.has(file) ? false : (seen.add(file), true)))\n .sort()\n .filter(definesServerFn)\n .map((file) => ({ file }));\n}\n\n/**\n * Match the client scrub's supported server-function declaration shape. The\n * scrub deliberately falls back to the conventional `serverFn` name when the\n * function is re-exported through a local barrel, so discovery must make the\n * same choice or the browser receives a proxy without a dispatch route.\n */\nfunction definesServerFn(file: string): boolean {\n const code = readFileSync(file, 'utf8');\n if (!code.includes('serverFn')) return false;\n\n const { program } = parseSync(file, code);\n const localNames = new Set<string>();\n for (const node of program.body) {\n if (\n node.type !== 'ImportDeclaration' ||\n node.source.value !== '@analogjs/router/server'\n ) {\n continue;\n }\n for (const specifier of node.specifiers) {\n if (\n specifier.type === 'ImportSpecifier' &&\n (specifier.imported.type === 'Identifier'\n ? specifier.imported.name\n : specifier.imported.value) === 'serverFn'\n ) {\n localNames.add(specifier.local.name);\n }\n }\n }\n if (localNames.size === 0) localNames.add('serverFn');\n\n return program.body.some(\n (node) =>\n node.type === 'ExportNamedDeclaration' &&\n node.declaration?.type === 'VariableDeclaration' &&\n node.declaration.declarations.some(\n (declarator) =>\n declarator.id?.type === 'Identifier' &&\n declarator.init?.type === 'CallExpression' &&\n declarator.init.callee?.type === 'Identifier' &&\n localNames.has(declarator.init.callee.name),\n ),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4BA,IAAM,wBAAkC,CAAC,4BAA4B;;;;;;;;;;;;;;;;;;;AAoBrE,SAAgB,oBAAoB,EAClC,eACA,YACA,SACA,0BACmD;CACnD,MAAM,OAAO,cAAc,QAAQ,eAAe,OAAO,CAAC;CAE1D,MAAM,QAAQ,SACZ,CACE,GAAG,KAAK,GAAG,WAAW,kBACtB,IAAI,0BAA0B,CAAC,EAAA,CAAG,KAC/B,QAAQ,GAAG,gBAAgB,IAAI,gBAClC,CACF,GACA;EAAE,KAAK;EAAM,UAAU;CAAK,CAC9B,CAAC,CAAC,KAAK,SAAS,cAAc,IAAI,CAAC;CAEnC,MAAM,gBAAgB,GAAG,KAAK,GAAG,WAAW;CAC5C,MAAM,uBAAO,IAAI,IAAY;CAC7B,OAAO,MACJ,QAAQ,SAAS,CAAC,sBAAsB,MAAM,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,CACpE,QACE,SACC,CAAC,KAAK,WAAW,aAAa,KAC9B,KAAK,MAAM,cAAc,MAAM,CAAC,CAAC,SAAS,GAAG,CACjD,CAAC,CACA,QAAQ,SAAU,KAAK,IAAI,IAAI,IAAI,SAAS,KAAK,IAAI,IAAI,GAAG,KAAM,CAAC,CACnE,KAAK,CAAC,CACN,OAAO,eAAe,CAAC,CACvB,KAAK,UAAU,EAAE,KAAK,EAAE;AAC7B;;;;;;;AAQA,SAAS,gBAAgB,MAAuB;CAC9C,MAAM,OAAO,aAAa,MAAM,MAAM;CACtC,IAAI,CAAC,KAAK,SAAS,UAAU,GAAG,OAAO;CAEvC,MAAM,EAAE,YAAY,UAAU,MAAM,IAAI;CACxC,MAAM,6BAAa,IAAI,IAAY;CACnC,KAAK,MAAM,QAAQ,QAAQ,MAAM;EAC/B,IACE,KAAK,SAAS,uBACd,KAAK,OAAO,UAAU,2BAEtB;EAEF,KAAK,MAAM,aAAa,KAAK,YAC3B,IACE,UAAU,SAAS,sBAClB,UAAU,SAAS,SAAS,eACzB,UAAU,SAAS,OACnB,UAAU,SAAS,WAAW,YAElC,WAAW,IAAI,UAAU,MAAM,IAAI;CAGzC;CACA,IAAI,WAAW,SAAS,GAAG,WAAW,IAAI,UAAU;CAEpD,OAAO,QAAQ,KAAK,MACjB,SACC,KAAK,SAAS,4BACd,KAAK,aAAa,SAAS,yBAC3B,KAAK,YAAY,aAAa,MAC3B,eACC,WAAW,IAAI,SAAS,gBACxB,WAAW,MAAM,SAAS,oBAC1B,WAAW,KAAK,QAAQ,SAAS,gBACjC,WAAW,IAAI,WAAW,KAAK,OAAO,IAAI,CAC9C,CACJ;AACF"}
|
|
@@ -56,6 +56,6 @@ function setHtmlLang(html, locale) {
|
|
|
56
56
|
return html.replace(/<html/i, `<html lang="${locale}"`);
|
|
57
57
|
}
|
|
58
58
|
//#endregion
|
|
59
|
-
export { createI18nPostRenderingHook, expandRoutesWithLocales };
|
|
59
|
+
export { createI18nPostRenderingHook, detectLocaleFromRoute, expandRoutesWithLocales, setHtmlLang };
|
|
60
60
|
|
|
61
61
|
//# sourceMappingURL=i18n-prerender.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n-prerender.js","names":[],"sources":["../../../../src/lib/nitro/i18n-prerender.ts"],"sourcesContent":["import type { PrerenderRoute } from 'nitro/types';\nimport type { I18nPrerenderOptions } from './types.js';\n\n/**\n * Expands a list of routes to include locale-prefixed variants.\n *\n * For each route and each locale, generates a prefixed route:\n * '/' + locale + route\n *\n * The default locale's routes are included both with and without the prefix\n * so that `/about` and `/en/about` both render.\n */\nexport function expandRoutesWithLocales(\n routes: string[],\n i18n: I18nPrerenderOptions,\n): string[] {\n const expanded: string[] = [];\n\n for (const route of routes) {\n // Skip locale expansion for internal analog endpoints and API routes.\n // `startsWith('/api/')` alone misses the bare `/api` path, which\n // would otherwise get locale-prefixed and produce phantom routes like\n // `/en/api`.\n if (\n route.includes('/_analog/') ||\n route === '/api' ||\n route.startsWith('/api/')\n ) {\n expanded.push(route);\n continue;\n }\n\n for (const locale of i18n.locales) {\n const prefix = `/${locale}`;\n const localizedRoute = route === '/' ? prefix : `${prefix}${route}`;\n expanded.push(localizedRoute);\n }\n\n if (!expanded.includes(route)) {\n expanded.push(route);\n }\n }\n\n return expanded;\n}\n\n/**\n * Creates a post-rendering hook that injects the `lang` attribute\n * into the `<html>` tag of prerendered pages based on the route's\n * locale prefix.\n */\nexport function createI18nPostRenderingHook(\n i18n: I18nPrerenderOptions,\n): (route: PrerenderRoute) => Promise<void> {\n return async (route: PrerenderRoute) => {\n if (!route.contents || typeof route.contents !== 'string') {\n return;\n }\n\n const locale = detectLocaleFromRoute(route.route, i18n);\n if (!locale) {\n return;\n }\n\n route.contents = setHtmlLang(route.contents, locale);\n };\n}\n\n/**\n * Detects the locale from a prerendered route path by checking\n * the first path segment against the configured locales.\n */\nexport function detectLocaleFromRoute(\n route: string,\n i18n: I18nPrerenderOptions,\n): string {\n const segments = route.split('/').filter(Boolean);\n const firstSegment = segments[0];\n\n if (firstSegment && i18n.locales.includes(firstSegment)) {\n return firstSegment;\n }\n\n return i18n.defaultLocale;\n}\n\n/**\n * Sets the `lang` attribute on the `<html>` tag in an HTML string.\n * If a `lang` attribute already exists, it is replaced.\n * If no `lang` attribute exists, it is added.\n */\nexport function setHtmlLang(html: string, locale: string): string {\n if (/<html[^>]*\\slang\\s*=\\s*[\"'][^\"']*[\"']/i.test(html)) {\n return html.replace(\n /(<html[^>]*\\s)lang\\s*=\\s*[\"'][^\"']*[\"']/i,\n `$1lang=\"${locale}\"`,\n );\n }\n\n return html.replace(/<html/i, `<html lang=\"${locale}\"`);\n}\n"],"mappings":";;;;;;;;;;AAYA,SAAgB,wBACd,QACA,MACU;CACV,MAAM,WAAqB,
|
|
1
|
+
{"version":3,"file":"i18n-prerender.js","names":[],"sources":["../../../../src/lib/nitro/i18n-prerender.ts"],"sourcesContent":["import type { PrerenderRoute } from 'nitro/types';\nimport type { I18nPrerenderOptions } from './types.js';\n\n/**\n * Expands a list of routes to include locale-prefixed variants.\n *\n * For each route and each locale, generates a prefixed route:\n * '/' + locale + route\n *\n * The default locale's routes are included both with and without the prefix\n * so that `/about` and `/en/about` both render.\n */\nexport function expandRoutesWithLocales(\n routes: string[],\n i18n: I18nPrerenderOptions,\n): string[] {\n const expanded: string[] = [];\n\n for (const route of routes) {\n // Skip locale expansion for internal analog endpoints and API routes.\n // `startsWith('/api/')` alone misses the bare `/api` path, which\n // would otherwise get locale-prefixed and produce phantom routes like\n // `/en/api`.\n if (\n route.includes('/_analog/') ||\n route === '/api' ||\n route.startsWith('/api/')\n ) {\n expanded.push(route);\n continue;\n }\n\n for (const locale of i18n.locales) {\n const prefix = `/${locale}`;\n const localizedRoute = route === '/' ? prefix : `${prefix}${route}`;\n expanded.push(localizedRoute);\n }\n\n if (!expanded.includes(route)) {\n expanded.push(route);\n }\n }\n\n return expanded;\n}\n\n/**\n * Creates a post-rendering hook that injects the `lang` attribute\n * into the `<html>` tag of prerendered pages based on the route's\n * locale prefix.\n */\nexport function createI18nPostRenderingHook(\n i18n: I18nPrerenderOptions,\n): (route: PrerenderRoute) => Promise<void> {\n return async (route: PrerenderRoute) => {\n if (!route.contents || typeof route.contents !== 'string') {\n return;\n }\n\n const locale = detectLocaleFromRoute(route.route, i18n);\n if (!locale) {\n return;\n }\n\n route.contents = setHtmlLang(route.contents, locale);\n };\n}\n\n/**\n * Detects the locale from a prerendered route path by checking\n * the first path segment against the configured locales.\n */\nexport function detectLocaleFromRoute(\n route: string,\n i18n: I18nPrerenderOptions,\n): string {\n const segments = route.split('/').filter(Boolean);\n const firstSegment = segments[0];\n\n if (firstSegment && i18n.locales.includes(firstSegment)) {\n return firstSegment;\n }\n\n return i18n.defaultLocale;\n}\n\n/**\n * Sets the `lang` attribute on the `<html>` tag in an HTML string.\n * If a `lang` attribute already exists, it is replaced.\n * If no `lang` attribute exists, it is added.\n */\nexport function setHtmlLang(html: string, locale: string): string {\n if (/<html[^>]*\\slang\\s*=\\s*[\"'][^\"']*[\"']/i.test(html)) {\n return html.replace(\n /(<html[^>]*\\s)lang\\s*=\\s*[\"'][^\"']*[\"']/i,\n `$1lang=\"${locale}\"`,\n );\n }\n\n return html.replace(/<html/i, `<html lang=\"${locale}\"`);\n}\n"],"mappings":";;;;;;;;;;AAYA,SAAgB,wBACd,QACA,MACU;CACV,MAAM,WAAqB,CAAC;CAE5B,KAAK,MAAM,SAAS,QAAQ;EAK1B,IACE,MAAM,SAAS,WAAW,KAC1B,UAAU,UACV,MAAM,WAAW,OAAO,GACxB;GACA,SAAS,KAAK,KAAK;GACnB;EACF;EAEA,KAAK,MAAM,UAAU,KAAK,SAAS;GACjC,MAAM,SAAS,IAAI;GACnB,MAAM,iBAAiB,UAAU,MAAM,SAAS,GAAG,SAAS;GAC5D,SAAS,KAAK,cAAc;EAC9B;EAEA,IAAI,CAAC,SAAS,SAAS,KAAK,GAC1B,SAAS,KAAK,KAAK;CAEvB;CAEA,OAAO;AACT;;;;;;AAOA,SAAgB,4BACd,MAC0C;CAC1C,OAAO,OAAO,UAA0B;EACtC,IAAI,CAAC,MAAM,YAAY,OAAO,MAAM,aAAa,UAC/C;EAGF,MAAM,SAAS,sBAAsB,MAAM,OAAO,IAAI;EACtD,IAAI,CAAC,QACH;EAGF,MAAM,WAAW,YAAY,MAAM,UAAU,MAAM;CACrD;AACF;;;;;AAMA,SAAgB,sBACd,OACA,MACQ;CAER,MAAM,eADW,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,OACpB,CAAA,CAAS;CAE9B,IAAI,gBAAgB,KAAK,QAAQ,SAAS,YAAY,GACpD,OAAO;CAGT,OAAO,KAAK;AACd;;;;;;AAOA,SAAgB,YAAY,MAAc,QAAwB;CAChE,IAAI,yCAAyC,KAAK,IAAI,GACpD,OAAO,KAAK,QACV,4CACA,WAAW,OAAO,EACpB;CAGF,OAAO,KAAK,QAAQ,UAAU,eAAe,OAAO,EAAE;AACxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-endpoints-plugin.js","names":[],"sources":["../../../../src/lib/nitro/page-endpoints-plugin.ts"],"sourcesContent":["import { parseSync } from 'oxc-parser';\nimport { normalizePath } from 'vite';\nimport { SERVER_FETCH_FACTORY_SNIPPET } from './renderers.js';\n\nexport function pageEndpointsPlugin() {\n return {\n name: 'analogjs-platform-rollup-page-endpoint',\n async transform(\n _code: string,\n id: string,\n ): Promise<{ code: string; map: null } | undefined> {\n if (normalizePath(id).includes('/pages/') && id.endsWith('.server.ts')) {\n const result = parseSync(id, _code, {\n sourceType: 'module',\n lang: 'ts',\n });\n\n const fileExports: string[] = result.module.staticExports.flatMap((e) =>\n e.entries\n .filter((entry) => entry.exportName.name !== null)\n .map((entry) => entry.exportName.name as string),\n );\n\n // In h3 v2 / Nitro v3, event.node is undefined during prerendering\n // (which uses the fetch-based pipeline, not Node.js http), and\n // event.context is undefined for sub-handler dispatches that\n // didn't go through the router params layer. We use optional\n // chaining on both so page endpoints work in Node.js server,\n // fetch-based prerender, and internal `fetchWithEvent` paths.\n //\n // Page loaders expect Nitro-style `$fetch` semantics (parsed data plus\n // internal relative-route support), so we construct a request-local\n // fetch using `createFetch` from ofetch + `fetchWithEvent` from h3.\n const code = `\n import { defineHandler, fetchWithEvent } from 'nitro/h3';\n import { createFetch } from 'ofetch';\n\n ${\n fileExports.includes('load')\n ? _code\n : `\n ${_code}\n export const load = () => {\n return {};\n }`\n }\n\n ${\n fileExports.includes('action')\n ? ''\n : `\n export const action = () => {\n return {};\n }\n `\n }\n\n export default defineHandler(async(event) => {\n ${SERVER_FETCH_FACTORY_SNIPPET}\n\n if (event.method === 'GET') {\n try {\n return await load({\n params: event.context?.params,\n req: event.node?.req,\n res: event.node?.res,\n fetch: serverFetch,\n event\n });\n } catch(e) {\n console.error(\\` An error occurred: \\${e}\\`)\n throw e;\n }\n } else {\n try {\n return await action({\n params: event.context?.params,\n req: event.node?.req,\n res: event.node?.res,\n fetch: serverFetch,\n event\n });\n } catch(e) {\n console.error(\\` An error occurred: \\${e}\\`)\n throw e;\n }\n }\n });\n `;\n\n return {\n code,\n map: null,\n };\n }\n\n return;\n },\n };\n}\n"],"mappings":";;;;AAIA,SAAgB,sBAAsB;
|
|
1
|
+
{"version":3,"file":"page-endpoints-plugin.js","names":[],"sources":["../../../../src/lib/nitro/page-endpoints-plugin.ts"],"sourcesContent":["import { parseSync } from 'oxc-parser';\nimport { normalizePath } from 'vite';\nimport { SERVER_FETCH_FACTORY_SNIPPET } from './renderers.js';\n\nexport function pageEndpointsPlugin() {\n return {\n name: 'analogjs-platform-rollup-page-endpoint',\n async transform(\n _code: string,\n id: string,\n ): Promise<{ code: string; map: null } | undefined> {\n if (normalizePath(id).includes('/pages/') && id.endsWith('.server.ts')) {\n const result = parseSync(id, _code, {\n sourceType: 'module',\n lang: 'ts',\n });\n\n const fileExports: string[] = result.module.staticExports.flatMap((e) =>\n e.entries\n .filter((entry) => entry.exportName.name !== null)\n .map((entry) => entry.exportName.name as string),\n );\n\n // In h3 v2 / Nitro v3, event.node is undefined during prerendering\n // (which uses the fetch-based pipeline, not Node.js http), and\n // event.context is undefined for sub-handler dispatches that\n // didn't go through the router params layer. We use optional\n // chaining on both so page endpoints work in Node.js server,\n // fetch-based prerender, and internal `fetchWithEvent` paths.\n //\n // Page loaders expect Nitro-style `$fetch` semantics (parsed data plus\n // internal relative-route support), so we construct a request-local\n // fetch using `createFetch` from ofetch + `fetchWithEvent` from h3.\n const code = `\n import { defineHandler, fetchWithEvent } from 'nitro/h3';\n import { createFetch } from 'ofetch';\n\n ${\n fileExports.includes('load')\n ? _code\n : `\n ${_code}\n export const load = () => {\n return {};\n }`\n }\n\n ${\n fileExports.includes('action')\n ? ''\n : `\n export const action = () => {\n return {};\n }\n `\n }\n\n export default defineHandler(async(event) => {\n ${SERVER_FETCH_FACTORY_SNIPPET}\n\n if (event.method === 'GET') {\n try {\n return await load({\n params: event.context?.params,\n req: event.node?.req,\n res: event.node?.res,\n fetch: serverFetch,\n event\n });\n } catch(e) {\n console.error(\\` An error occurred: \\${e}\\`)\n throw e;\n }\n } else {\n try {\n return await action({\n params: event.context?.params,\n req: event.node?.req,\n res: event.node?.res,\n fetch: serverFetch,\n event\n });\n } catch(e) {\n console.error(\\` An error occurred: \\${e}\\`)\n throw e;\n }\n }\n });\n `;\n\n return {\n code,\n map: null,\n };\n }\n\n return;\n },\n };\n}\n"],"mappings":";;;;AAIA,SAAgB,sBAAsB;CACpC,OAAO;EACL,MAAM;EACN,MAAM,UACJ,OACA,IACkD;GAClD,IAAI,cAAc,EAAE,CAAC,CAAC,SAAS,SAAS,KAAK,GAAG,SAAS,YAAY,GAAG;IAMtE,MAAM,cALS,UAAU,IAAI,OAAO;KAClC,YAAY;KACZ,MAAM;IACR,CAE8B,CAAA,CAAO,OAAO,cAAc,SAAS,MACjE,EAAE,QACC,QAAQ,UAAU,MAAM,WAAW,SAAS,IAAI,CAAC,CACjD,KAAK,UAAU,MAAM,WAAW,IAAc,CACnD;IAqEA,OAAO;KACL,MAAA;;;;cArDI,YAAY,SAAS,MAAM,IACvB,QACA;kBACA,MAAM;;;mBAIX;;cAGC,YAAY,SAAS,QAAQ,IACzB,KACA;;;;gBAKL;;;gBAGG,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkCnC,KAAK;IACP;GACF;EAGF;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-rendering-hook.js","names":[],"sources":["../../../../src/lib/nitro/post-rendering-hook.ts"],"sourcesContent":["import type { Nitro, PrerenderRoute } from 'nitro/types';\n\nexport function addPostRenderingHooks(\n nitro: Nitro,\n hooks: ((pr: PrerenderRoute) => Promise<void> | void)[],\n): void {\n for (const hook of hooks) {\n nitro.hooks.hook('prerender:generate', async (route: PrerenderRoute) => {\n await hook(route);\n });\n }\n}\n"],"mappings":";AAEA,SAAgB,sBACd,OACA,OACM;
|
|
1
|
+
{"version":3,"file":"post-rendering-hook.js","names":[],"sources":["../../../../src/lib/nitro/post-rendering-hook.ts"],"sourcesContent":["import type { Nitro, PrerenderRoute } from 'nitro/types';\n\nexport function addPostRenderingHooks(\n nitro: Nitro,\n hooks: ((pr: PrerenderRoute) => Promise<void> | void)[],\n): void {\n for (const hook of hooks) {\n nitro.hooks.hook('prerender:generate', async (route: PrerenderRoute) => {\n await hook(route);\n });\n }\n}\n"],"mappings":";AAEA,SAAgB,sBACd,OACA,OACM;CACN,KAAK,MAAM,QAAQ,OACjB,MAAM,MAAM,KAAK,sBAAsB,OAAO,UAA0B;EACtE,MAAM,KAAK,KAAK;CAClB,CAAC;AAEL"}
|
|
@@ -52,6 +52,6 @@ export default createServerFnEventHandler(
|
|
|
52
52
|
`;
|
|
53
53
|
}
|
|
54
54
|
//#endregion
|
|
55
|
-
export { SERVER_FN_DISPATCH_VIRTUAL, buildServerFnDispatchModule, getServerFnDispatchHandler };
|
|
55
|
+
export { SERVER_FN_DISPATCH_ROUTE, SERVER_FN_DISPATCH_VIRTUAL, buildServerFnDispatchModule, getServerFnDispatchHandler };
|
|
56
56
|
|
|
57
57
|
//# sourceMappingURL=server-fn-endpoints.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-fn-endpoints.js","names":[],"sources":["../../../../src/lib/nitro/server-fn-endpoints.ts"],"sourcesContent":["import type { NitroEventHandler } from 'nitro/types';\nimport { normalizePath } from 'vite';\n\nimport type { ServerFnHandlerModule } from './get-server-fn-handlers.js';\n\n/**\n * Nitro virtual-module id for the generated server-function dispatch handler.\n * Referenced from `nitroConfig.handlers` and provided via `nitroConfig.virtual`.\n */\nexport const SERVER_FN_DISPATCH_VIRTUAL = '#ANALOG_SERVER_FN_DISPATCH';\n\n/** The single transport route all server functions dispatch through. */\nexport const SERVER_FN_DISPATCH_ROUTE = '/_analog/fn/:id';\n\n/** URL prefix of that route, for matching requests before the id is known. */\nexport const SERVER_FN_DISPATCH_PREFIX = '/_analog/fn/';\n\n/**\n * The Nitro handler registration for the server-function dispatch route.\n * Unlike page endpoints (one handler per file), every server function shares\n * this one `/_analog/fn/:id` route; the id selects the function at runtime.\n *\n * The route is fixed and NOT `/api`-prefixed: client proxies always call the\n * absolute `/_analog/fn/:id` URL, so an `/api` prefix (as page endpoints use)\n * would leave the handler unreachable in apps that have an API directory.\n */\nexport function getServerFnDispatchHandler(): NitroEventHandler {\n return {\n route: SERVER_FN_DISPATCH_ROUTE,\n handler: SERVER_FN_DISPATCH_VIRTUAL,\n lazy: true,\n };\n}\n\nexport type BuildServerFnDispatchModuleArgs = {\n /** Discovered `*.server.ts` modules, imported for registration side-effects. */\n modules: ServerFnHandlerModule[];\n /**\n * Absolute path to the app's server config module (`app.config.server.ts`),\n * which exports the `ApplicationConfig` (as `config`) that `main.server.ts`\n * renders with. Handlers bootstrap against it, so they see the same DI the\n * app configured. When absent, handlers run with only `providedIn: 'root'`.\n */\n appConfigModule?: string;\n};\n\n/**\n * Generates the source of the Nitro dispatch handler.\n *\n * The handler imports every discovered `*.server.ts` module so each\n * `serverFn(...)` registers itself, imports the app's server config, then on\n * each request looks up the function by id and runs it via `dispatchServerFn` —\n * the same call path the validation harnesses exercise.\n */\nexport function buildServerFnDispatchModule({\n modules,\n appConfigModule,\n}: BuildServerFnDispatchModuleArgs): string {\n const registrationImports = modules\n .map((m) => `import ${JSON.stringify(normalizePath(m.file))};`)\n .join('\\n');\n\n // Bootstrap against the app's own server config so a handler resolves exactly\n // the services, tokens, and interceptors the app configured — one config, no\n // second provider list. Fall back to an empty config when the app has none.\n const appConfig = appConfigModule\n ? `import { config as serverFnAppConfig } from ${JSON.stringify(\n normalizePath(appConfigModule),\n )};`\n : `const serverFnAppConfig = { providers: [] };`;\n\n // `@analogjs/router/server` is a partially-compiled Angular library, and this\n // module is bundled by Nitro rather than by the app's Angular pipeline, so the\n // linker never runs over it. Loading the compiler gives it the JIT fallback.\n // `zone.js` and the server platform init match the SSR entry, so bootstrapping\n // the app injector below runs in the same environment a render would.\n //\n // The transport itself — id decoding, the malformed-body contract, dispatch,\n // and response writing — lives in `createServerFnEventHandler`, so this module\n // is only wiring: bootstrap the app injector from the app's server config, and\n // hand it to that handler.\n return `import '@angular/compiler';\nimport 'zone.js/node';\nimport '@angular/platform-server/init';\nimport { createServerFnAppInjector, createServerFnEventHandler } from '@analogjs/router/server';\n\n// Discovered server-function modules (registration side-effects).\n${registrationImports}\n\n${appConfig}\n\n// Bootstrapped once from the app's own server config, so a handler resolves the\n// same DI as an SSR render (\\`providedIn: 'root'\\` and listed providers alike).\n// No component is bootstrapped, so nothing renders and the router never\n// navigates. Only REQUEST/RESPONSE are rebuilt per call.\nexport default createServerFnEventHandler(\n createServerFnAppInjector(serverFnAppConfig),\n);\n`;\n}\n"],"mappings":";;;;;;AASA,IAAa,6BAA6B;;AAG1C,IAAa,2BAA2B;;;;;;;;;;AAcxC,SAAgB,6BAAgD;
|
|
1
|
+
{"version":3,"file":"server-fn-endpoints.js","names":[],"sources":["../../../../src/lib/nitro/server-fn-endpoints.ts"],"sourcesContent":["import type { NitroEventHandler } from 'nitro/types';\nimport { normalizePath } from 'vite';\n\nimport type { ServerFnHandlerModule } from './get-server-fn-handlers.js';\n\n/**\n * Nitro virtual-module id for the generated server-function dispatch handler.\n * Referenced from `nitroConfig.handlers` and provided via `nitroConfig.virtual`.\n */\nexport const SERVER_FN_DISPATCH_VIRTUAL = '#ANALOG_SERVER_FN_DISPATCH';\n\n/** The single transport route all server functions dispatch through. */\nexport const SERVER_FN_DISPATCH_ROUTE = '/_analog/fn/:id';\n\n/** URL prefix of that route, for matching requests before the id is known. */\nexport const SERVER_FN_DISPATCH_PREFIX = '/_analog/fn/';\n\n/**\n * The Nitro handler registration for the server-function dispatch route.\n * Unlike page endpoints (one handler per file), every server function shares\n * this one `/_analog/fn/:id` route; the id selects the function at runtime.\n *\n * The route is fixed and NOT `/api`-prefixed: client proxies always call the\n * absolute `/_analog/fn/:id` URL, so an `/api` prefix (as page endpoints use)\n * would leave the handler unreachable in apps that have an API directory.\n */\nexport function getServerFnDispatchHandler(): NitroEventHandler {\n return {\n route: SERVER_FN_DISPATCH_ROUTE,\n handler: SERVER_FN_DISPATCH_VIRTUAL,\n lazy: true,\n };\n}\n\nexport type BuildServerFnDispatchModuleArgs = {\n /** Discovered `*.server.ts` modules, imported for registration side-effects. */\n modules: ServerFnHandlerModule[];\n /**\n * Absolute path to the app's server config module (`app.config.server.ts`),\n * which exports the `ApplicationConfig` (as `config`) that `main.server.ts`\n * renders with. Handlers bootstrap against it, so they see the same DI the\n * app configured. When absent, handlers run with only `providedIn: 'root'`.\n */\n appConfigModule?: string;\n};\n\n/**\n * Generates the source of the Nitro dispatch handler.\n *\n * The handler imports every discovered `*.server.ts` module so each\n * `serverFn(...)` registers itself, imports the app's server config, then on\n * each request looks up the function by id and runs it via `dispatchServerFn` —\n * the same call path the validation harnesses exercise.\n */\nexport function buildServerFnDispatchModule({\n modules,\n appConfigModule,\n}: BuildServerFnDispatchModuleArgs): string {\n const registrationImports = modules\n .map((m) => `import ${JSON.stringify(normalizePath(m.file))};`)\n .join('\\n');\n\n // Bootstrap against the app's own server config so a handler resolves exactly\n // the services, tokens, and interceptors the app configured — one config, no\n // second provider list. Fall back to an empty config when the app has none.\n const appConfig = appConfigModule\n ? `import { config as serverFnAppConfig } from ${JSON.stringify(\n normalizePath(appConfigModule),\n )};`\n : `const serverFnAppConfig = { providers: [] };`;\n\n // `@analogjs/router/server` is a partially-compiled Angular library, and this\n // module is bundled by Nitro rather than by the app's Angular pipeline, so the\n // linker never runs over it. Loading the compiler gives it the JIT fallback.\n // `zone.js` and the server platform init match the SSR entry, so bootstrapping\n // the app injector below runs in the same environment a render would.\n //\n // The transport itself — id decoding, the malformed-body contract, dispatch,\n // and response writing — lives in `createServerFnEventHandler`, so this module\n // is only wiring: bootstrap the app injector from the app's server config, and\n // hand it to that handler.\n return `import '@angular/compiler';\nimport 'zone.js/node';\nimport '@angular/platform-server/init';\nimport { createServerFnAppInjector, createServerFnEventHandler } from '@analogjs/router/server';\n\n// Discovered server-function modules (registration side-effects).\n${registrationImports}\n\n${appConfig}\n\n// Bootstrapped once from the app's own server config, so a handler resolves the\n// same DI as an SSR render (\\`providedIn: 'root'\\` and listed providers alike).\n// No component is bootstrapped, so nothing renders and the router never\n// navigates. Only REQUEST/RESPONSE are rebuilt per call.\nexport default createServerFnEventHandler(\n createServerFnAppInjector(serverFnAppConfig),\n);\n`;\n}\n"],"mappings":";;;;;;AASA,IAAa,6BAA6B;;AAG1C,IAAa,2BAA2B;;;;;;;;;;AAcxC,SAAgB,6BAAgD;CAC9D,OAAO;EACL,OAAO;EACP,SAAS;EACT,MAAM;CACR;AACF;;;;;;;;;AAsBA,SAAgB,4BAA4B,EAC1C,SACA,mBAC0C;CAwB1C,OAAO;;;;;;EAvBqB,QACzB,KAAK,MAAM,UAAU,KAAK,UAAU,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAC9D,KAAK,IA2BR,EAAoB;;EAtBF,kBACd,+CAA+C,KAAK,UAClD,cAAc,eAAe,CAC/B,EAAE,KACF,+CAoBM;;;;;;;;;;AAUZ"}
|
|
@@ -15,7 +15,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
}
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
19
19
|
value: mod,
|
|
20
20
|
enumerable: true
|
|
21
21
|
}) : target, mod));
|
|
@@ -1 +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,
|
|
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,GAAG;CACzB,IAAI,QAAQ,WAAW,GACnB,OAAO;CAEX,MAAM,CAAC,OAAO,GAAG,QAAQ;CACzB,OAAO,GAAG,MAAM,YAAY,IAAI,KAAK,KAAI,SAAQC,mBAAAA,WAAW,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE;AAC9E"}
|
|
@@ -1 +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;
|
|
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;CACrB,OAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,YAAY;AACnE"}
|
|
@@ -1 +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;
|
|
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;CAChB,OAAO,MAAM,KAAK,IAAI,MAAM,kBAAkB,KAAK,CAAC,CAAC;AACzD"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require("../../../_virtual/_rolldown/runtime.js");
|
|
2
1
|
const require_src_executors_vite_dev_server_vite_dev_server_impl = require("./vite-dev-server.impl.js");
|
|
3
2
|
//#region packages/nx-plugin/src/executors/vite-dev-server/compat.ts
|
|
4
3
|
var compat = (0, require("@nx/devkit").convertNxExecutor)(require_src_executors_vite_dev_server_vite_dev_server_impl);
|
|
@@ -1 +1 @@
|
|
|
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":"
|
|
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,uBAA+C,CAAA,CAAA,kBAAA,CACnD,0DACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-dev-server.impl.js","names":[],"sources":["../../../../../../../../nx-plugin/src/executors/vite-dev-server/vite-dev-server.impl.ts"],"sourcesContent":["import { viteDevServerExecutor } from '@nx/vite/executors';\n\nexport default viteDevServerExecutor;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"vite-dev-server.impl.js","names":[],"sources":["../../../../../../../../nx-plugin/src/executors/vite-dev-server/vite-dev-server.impl.ts"],"sourcesContent":["import { viteDevServerExecutor } from '@nx/vite/executors';\n\nexport default viteDevServerExecutor;\n"],"mappings":";AAEA,IAAA,2DAAe,CAAA,CAAA"}
|
|
@@ -2,7 +2,6 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
require("../../../_virtual/_rolldown/runtime.js");
|
|
6
5
|
const require_src_generators_app_generator = require("./generator.js");
|
|
7
6
|
//#region packages/nx-plugin/src/generators/app/compat.ts
|
|
8
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat.js","names":[],"sources":["../../../../../../../../nx-plugin/src/generators/app/compat.ts"],"sourcesContent":["import { convertNxGenerator } from '@nx/devkit';\nimport generator from './generator';\n\n/**\n * Angular CLI schematic wrapper for the Analog application generator.\n * Referenced by `generators.json#schematics.application.factory` so that\n * `ng generate @analogjs/platform:application` resolves through the\n * Angular schematics engine (which uses named exports, not default).\n */\nexport const applicationSchematic: ReturnType<typeof convertNxGenerator> =\n convertNxGenerator(generator) as ReturnType<typeof convertNxGenerator>;\nexport default applicationSchematic;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"compat.js","names":[],"sources":["../../../../../../../../nx-plugin/src/generators/app/compat.ts"],"sourcesContent":["import { convertNxGenerator } from '@nx/devkit';\nimport generator from './generator';\n\n/**\n * Angular CLI schematic wrapper for the Analog application generator.\n * Referenced by `generators.json#schematics.application.factory` so that\n * `ng generate @analogjs/platform:application` resolves through the\n * Angular schematics engine (which uses named exports, not default).\n */\nexport const applicationSchematic: ReturnType<typeof convertNxGenerator> =\n convertNxGenerator(generator) as ReturnType<typeof convertNxGenerator>;\nexport default applicationSchematic;\n"],"mappings":";;;;;;;;;;;;AASA,IAAa,wBAAA,uBACX,CAAA,CAAA,mBAAA,CAAmB,oCAAS"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require("../../../_virtual/_rolldown/runtime.js");
|
|
2
1
|
const require_version_utils = require("../../utils/version-utils.js");
|
|
3
2
|
const require_add_home_page = require("./lib/add-home-page.js");
|
|
4
3
|
const require_minimum_supported_versions = require("./versions/minimum-supported-versions.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","names":[],"sources":["../../../../../../../../nx-plugin/src/generators/app/generator.ts"],"sourcesContent":["import {\n formatFiles,\n getWorkspaceLayout,\n installPackagesTask,\n names,\n offsetFromRoot as determineOffsetFromRoot,\n stripIndents,\n Tree,\n addDependenciesToPackageJson,\n updateJson,\n} from '@nx/devkit';\nimport { wrapAngularDevkitSchematic } from '@nx/devkit/ngcli-adapter';\nimport { AnalogNxApplicationGeneratorOptions } from './schema';\nimport { major, coerce } from 'semver';\nimport { getInstalledPackageVersion } from '../../utils/version-utils';\nimport { addHomePage } from './lib/add-home-page';\nimport {\n belowMinimumSupportedNxVersion,\n MINIMUM_SUPPORTED_NX_VERSION,\n} from './versions/minimum-supported-versions';\nimport { addAngularApp } from './lib/add-angular-app';\nimport setupAnalogGenerator from '../init/generator';\nimport { addFiles } from './lib/add-files';\nimport { addAgentContext } from './lib/add-agent-context';\nimport { addTailwindConfig } from './lib/add-tailwind-config';\nimport { cleanupFiles } from './lib/cleanup-files';\nimport { addAnalogProjectConfig } from './lib/add-analog-project-config';\nimport { updateIndex } from './lib/update-index-html';\n\nexport interface NormalizedOptions\n extends AnalogNxApplicationGeneratorOptions, ReturnType<typeof names> {\n projectName: string;\n projectRoot: string;\n projectDirectory: string;\n parsedTags: string[];\n offsetFromRoot: string;\n appsDir: string;\n nxPackageNamespace: string;\n isNx: boolean;\n}\n\nfunction normalizeOptions(\n tree: Tree,\n options: AnalogNxApplicationGeneratorOptions,\n): NormalizedOptions {\n const isNx = tree.exists('/nx.json');\n const appsDir = isNx ? getWorkspaceLayout(tree).appsDir : 'projects';\n const allNames = names(options.analogAppName);\n const projectDirectory = allNames.fileName;\n const projectName = projectDirectory.replace(new RegExp('/', 'g'), '-');\n const projectRoot = `${appsDir}/${projectDirectory}`;\n const parsedTags = options.tags\n ? options.tags.split(',').map((s) => s.trim())\n : [];\n const offsetFromRoot = determineOffsetFromRoot(projectRoot);\n const nxPackageNamespace = '@nx';\n const addTailwind = options.addTailwind ?? true;\n\n return {\n ...options,\n ...allNames,\n projectName,\n projectRoot,\n projectDirectory,\n parsedTags,\n offsetFromRoot,\n appsDir,\n nxPackageNamespace,\n addTailwind,\n isNx,\n };\n}\n\nasync function appGenerator(\n tree: Tree,\n options: AnalogNxApplicationGeneratorOptions,\n): Promise<() => void> {\n const nxVersion = getInstalledPackageVersion(tree, 'nx');\n\n if (nxVersion && belowMinimumSupportedNxVersion(nxVersion)) {\n throw new Error(\n stripIndents`Nx v${MINIMUM_SUPPORTED_NX_VERSION} or newer is required to install Analog`,\n );\n }\n\n if (options.linter === 'oxlint' && !nxVersion) {\n throw new Error(\n stripIndents`The oxlint linter is only supported in Nx workspaces`,\n );\n }\n\n const normalizedOptions = normalizeOptions(tree, options);\n\n if (nxVersion) {\n await addAngularApp(tree, normalizedOptions);\n } else {\n const angularAppSchematic = wrapAngularDevkitSchematic(\n '@schematics/angular',\n 'application',\n );\n await angularAppSchematic(tree, {\n projectRoot: normalizedOptions.projectRoot,\n name: normalizedOptions.analogAppName,\n });\n addAnalogProjectConfig(\n tree,\n normalizedOptions.projectRoot,\n normalizedOptions.projectName,\n normalizedOptions.parsedTags,\n normalizedOptions.name,\n normalizedOptions.appsDir,\n normalizedOptions.nxPackageNamespace,\n );\n }\n\n await setupAnalogGenerator(tree, {\n project: normalizedOptions.analogAppName,\n vitest: true,\n });\n\n const angularVersion = getInstalledPackageVersion(tree, '@angular/core');\n const coercedAngularVersion = coerce(angularVersion ?? '');\n if (!coercedAngularVersion) {\n throw new Error('Could not determine installed Angular version.');\n }\n const majorAngularVersion = major(coercedAngularVersion);\n addFiles(tree, normalizedOptions, majorAngularVersion);\n addDependenciesToPackageJson(\n tree,\n {\n 'front-matter': '^4.0.2',\n marked: '^18.0.0',\n mermaid: '^10.2.4',\n prismjs: '^1.29.0',\n },\n {},\n );\n\n updateJson<{\n dependencies: Record<string, string>;\n overrides?: Record<string, unknown>;\n }>(tree, '/package.json', (json) => {\n json.dependencies['@angular/platform-server'] = `~${angularVersion}`;\n json.overrides = {\n ...json.overrides,\n vite: '$vite',\n vitest: '$vitest',\n };\n\n return json;\n });\n\n updateIndex(tree, normalizedOptions.analogAppName);\n\n if (normalizedOptions.addTailwind) {\n await addTailwindConfig(tree, normalizedOptions.projectName);\n }\n\n addHomePage(tree, normalizedOptions, majorAngularVersion);\n\n if (!normalizedOptions.skipAgentContext) {\n addAgentContext(tree, normalizedOptions.projectRoot);\n }\n\n cleanupFiles(tree, normalizedOptions);\n\n if (!normalizedOptions.skipFormat) {\n await formatFiles(tree);\n }\n\n return () => {\n installPackagesTask(tree);\n };\n}\n\nexport default appGenerator;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"generator.js","names":[],"sources":["../../../../../../../../nx-plugin/src/generators/app/generator.ts"],"sourcesContent":["import {\n formatFiles,\n getWorkspaceLayout,\n installPackagesTask,\n names,\n offsetFromRoot as determineOffsetFromRoot,\n stripIndents,\n Tree,\n addDependenciesToPackageJson,\n updateJson,\n} from '@nx/devkit';\nimport { wrapAngularDevkitSchematic } from '@nx/devkit/ngcli-adapter';\nimport { AnalogNxApplicationGeneratorOptions } from './schema';\nimport { major, coerce } from 'semver';\nimport { getInstalledPackageVersion } from '../../utils/version-utils';\nimport { addHomePage } from './lib/add-home-page';\nimport {\n belowMinimumSupportedNxVersion,\n MINIMUM_SUPPORTED_NX_VERSION,\n} from './versions/minimum-supported-versions';\nimport { addAngularApp } from './lib/add-angular-app';\nimport setupAnalogGenerator from '../init/generator';\nimport { addFiles } from './lib/add-files';\nimport { addAgentContext } from './lib/add-agent-context';\nimport { addTailwindConfig } from './lib/add-tailwind-config';\nimport { cleanupFiles } from './lib/cleanup-files';\nimport { addAnalogProjectConfig } from './lib/add-analog-project-config';\nimport { updateIndex } from './lib/update-index-html';\n\nexport interface NormalizedOptions\n extends AnalogNxApplicationGeneratorOptions, ReturnType<typeof names> {\n projectName: string;\n projectRoot: string;\n projectDirectory: string;\n parsedTags: string[];\n offsetFromRoot: string;\n appsDir: string;\n nxPackageNamespace: string;\n isNx: boolean;\n}\n\nfunction normalizeOptions(\n tree: Tree,\n options: AnalogNxApplicationGeneratorOptions,\n): NormalizedOptions {\n const isNx = tree.exists('/nx.json');\n const appsDir = isNx ? getWorkspaceLayout(tree).appsDir : 'projects';\n const allNames = names(options.analogAppName);\n const projectDirectory = allNames.fileName;\n const projectName = projectDirectory.replace(new RegExp('/', 'g'), '-');\n const projectRoot = `${appsDir}/${projectDirectory}`;\n const parsedTags = options.tags\n ? options.tags.split(',').map((s) => s.trim())\n : [];\n const offsetFromRoot = determineOffsetFromRoot(projectRoot);\n const nxPackageNamespace = '@nx';\n const addTailwind = options.addTailwind ?? true;\n\n return {\n ...options,\n ...allNames,\n projectName,\n projectRoot,\n projectDirectory,\n parsedTags,\n offsetFromRoot,\n appsDir,\n nxPackageNamespace,\n addTailwind,\n isNx,\n };\n}\n\nasync function appGenerator(\n tree: Tree,\n options: AnalogNxApplicationGeneratorOptions,\n): Promise<() => void> {\n const nxVersion = getInstalledPackageVersion(tree, 'nx');\n\n if (nxVersion && belowMinimumSupportedNxVersion(nxVersion)) {\n throw new Error(\n stripIndents`Nx v${MINIMUM_SUPPORTED_NX_VERSION} or newer is required to install Analog`,\n );\n }\n\n if (options.linter === 'oxlint' && !nxVersion) {\n throw new Error(\n stripIndents`The oxlint linter is only supported in Nx workspaces`,\n );\n }\n\n const normalizedOptions = normalizeOptions(tree, options);\n\n if (nxVersion) {\n await addAngularApp(tree, normalizedOptions);\n } else {\n const angularAppSchematic = wrapAngularDevkitSchematic(\n '@schematics/angular',\n 'application',\n );\n await angularAppSchematic(tree, {\n projectRoot: normalizedOptions.projectRoot,\n name: normalizedOptions.analogAppName,\n });\n addAnalogProjectConfig(\n tree,\n normalizedOptions.projectRoot,\n normalizedOptions.projectName,\n normalizedOptions.parsedTags,\n normalizedOptions.name,\n normalizedOptions.appsDir,\n normalizedOptions.nxPackageNamespace,\n );\n }\n\n await setupAnalogGenerator(tree, {\n project: normalizedOptions.analogAppName,\n vitest: true,\n });\n\n const angularVersion = getInstalledPackageVersion(tree, '@angular/core');\n const coercedAngularVersion = coerce(angularVersion ?? '');\n if (!coercedAngularVersion) {\n throw new Error('Could not determine installed Angular version.');\n }\n const majorAngularVersion = major(coercedAngularVersion);\n addFiles(tree, normalizedOptions, majorAngularVersion);\n addDependenciesToPackageJson(\n tree,\n {\n 'front-matter': '^4.0.2',\n marked: '^18.0.0',\n mermaid: '^10.2.4',\n prismjs: '^1.29.0',\n },\n {},\n );\n\n updateJson<{\n dependencies: Record<string, string>;\n overrides?: Record<string, unknown>;\n }>(tree, '/package.json', (json) => {\n json.dependencies['@angular/platform-server'] = `~${angularVersion}`;\n json.overrides = {\n ...json.overrides,\n vite: '$vite',\n vitest: '$vitest',\n };\n\n return json;\n });\n\n updateIndex(tree, normalizedOptions.analogAppName);\n\n if (normalizedOptions.addTailwind) {\n await addTailwindConfig(tree, normalizedOptions.projectName);\n }\n\n addHomePage(tree, normalizedOptions, majorAngularVersion);\n\n if (!normalizedOptions.skipAgentContext) {\n addAgentContext(tree, normalizedOptions.projectRoot);\n }\n\n cleanupFiles(tree, normalizedOptions);\n\n if (!normalizedOptions.skipFormat) {\n await formatFiles(tree);\n }\n\n return () => {\n installPackagesTask(tree);\n };\n}\n\nexport default appGenerator;\n"],"mappings":";;;;;;;;;;;;;;;AAyCA,SAAS,iBACP,MACA,SACmB;CACnB,MAAM,OAAO,KAAK,OAAO,UAAU;CACnC,MAAM,UAAU,QAAA,GAAO,WAAA,mBAAA,CAAmB,IAAI,CAAC,CAAC,UAAU;CAC1D,MAAM,YAAA,GAAW,WAAA,MAAA,CAAM,QAAQ,aAAa;CAC5C,MAAM,mBAAmB,SAAS;CAClC,MAAM,cAAc,iBAAiB,wBAAQ,IAAI,OAAO,KAAK,GAAG,GAAG,GAAG;CACtE,MAAM,cAAc,GAAG,QAAQ,GAAG;CAClC,MAAM,aAAa,QAAQ,OACvB,QAAQ,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,MAAM,EAAE,KAAK,CAAC,IAC3C,CAAC;CACL,MAAM,kBAAA,GAAiB,WAAA,eAAA,CAAwB,WAAW;CAC1D,MAAM,qBAAqB;CAC3B,MAAM,cAAc,QAAQ,eAAe;CAE3C,OAAO;EACL,GAAG;EACH,GAAG;EACH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;AAEA,eAAe,aACb,MACA,SACqB;CACrB,MAAM,YAAY,sBAAA,2BAA2B,MAAM,IAAI;CAEvD,IAAI,aAAa,mCAAA,+BAA+B,SAAS,GACvD,MAAM,IAAI,MACR,WAAA,YAAY,OAAO,mCAAA,6BAA6B,wCAClD;CAGF,IAAI,QAAQ,WAAW,YAAY,CAAC,WAClC,MAAM,IAAI,MACR,WAAA,YAAY,sDACd;CAGF,MAAM,oBAAoB,iBAAiB,MAAM,OAAO;CAExD,IAAI,WACF,MAAM,wBAAA,cAAc,MAAM,iBAAiB;MACtC;EAKL,OAAA,GAJ4B,yBAAA,2BAAA,CAC1B,uBACA,aAEI,CAAA,CAAoB,MAAM;GAC9B,aAAa,kBAAkB;GAC/B,MAAM,kBAAkB;EAC1B,CAAC;EACD,kCAAA,uBACE,MACA,kBAAkB,aAClB,kBAAkB,aAClB,kBAAkB,YAClB,kBAAkB,MAClB,kBAAkB,SAClB,kBAAkB,kBACpB;CACF;CAEA,MAAM,sCAAqB,MAAM;EAC/B,SAAS,kBAAkB;EAC3B,QAAQ;CACV,CAAC;CAED,MAAM,iBAAiB,sBAAA,2BAA2B,MAAM,eAAe;CACvE,MAAM,yBAAA,GAAwB,OAAA,OAAA,CAAO,kBAAkB,EAAE;CACzD,IAAI,CAAC,uBACH,MAAM,IAAI,MAAM,gDAAgD;CAElE,MAAM,uBAAA,GAAsB,OAAA,MAAA,CAAM,qBAAqB;CACvD,kBAAA,SAAS,MAAM,mBAAmB,mBAAmB;CACrD,CAAA,GAAA,WAAA,6BAAA,CACE,MACA;EACE,gBAAgB;EAChB,QAAQ;EACR,SAAS;EACT,SAAS;CACX,GACA,CAAC,CACH;CAEA,CAAA,GAAA,WAAA,WAAA,CAGG,MAAM,kBAAkB,SAAS;EAClC,KAAK,aAAa,8BAA8B,IAAI;EACpD,KAAK,YAAY;GACf,GAAG,KAAK;GACR,MAAM;GACN,QAAQ;EACV;EAEA,OAAO;CACT,CAAC;CAED,0BAAA,YAAY,MAAM,kBAAkB,aAAa;CAEjD,IAAI,kBAAkB,aACpB,MAAM,4BAAA,kBAAkB,MAAM,kBAAkB,WAAW;CAG7D,sBAAA,YAAY,MAAM,mBAAmB,mBAAmB;CAExD,IAAI,CAAC,kBAAkB,kBACrB,0BAAA,gBAAgB,MAAM,kBAAkB,WAAW;CAGrD,sBAAA,aAAa,MAAM,iBAAiB;CAEpC,IAAI,CAAC,kBAAkB,YACrB,OAAA,GAAM,WAAA,YAAA,CAAY,IAAI;CAGxB,aAAa;EACX,CAAA,GAAA,WAAA,oBAAA,CAAoB,IAAI;CAC1B;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-agent-context.js","names":[],"sources":["../../../../../../../../../nx-plugin/src/generators/app/lib/add-agent-context.ts"],"sourcesContent":["import { Tree } from '@nx/devkit';\nimport { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nconst AGENT_CONTEXT_FILES = ['AGENTS.md', 'CLAUDE.md'];\n\n// Seeds agent context in the app so AI coding assistants pick up Analog\n// conventions (see node_modules/@analogjs/platform/AGENTS.md).\nexport function addAgentContext(tree: Tree, projectRoot: string) {\n for (const fileName of AGENT_CONTEXT_FILES) {\n const filePath = `${projectRoot}/${fileName}`;\n\n if (tree.exists(filePath)) {\n continue;\n }\n\n tree.write(\n filePath,\n readFileSync(join(__dirname, '..', 'files', 'agents', fileName), 'utf-8'),\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-agent-context.js","names":[],"sources":["../../../../../../../../../nx-plugin/src/generators/app/lib/add-agent-context.ts"],"sourcesContent":["import { Tree } from '@nx/devkit';\nimport { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nconst AGENT_CONTEXT_FILES = ['AGENTS.md', 'CLAUDE.md'];\n\n// Seeds agent context in the app so AI coding assistants pick up Analog\n// conventions (see node_modules/@analogjs/platform/AGENTS.md).\nexport function addAgentContext(tree: Tree, projectRoot: string) {\n for (const fileName of AGENT_CONTEXT_FILES) {\n const filePath = `${projectRoot}/${fileName}`;\n\n if (tree.exists(filePath)) {\n continue;\n }\n\n tree.write(\n filePath,\n readFileSync(join(__dirname, '..', 'files', 'agents', fileName), 'utf-8'),\n );\n }\n}\n"],"mappings":";;;AAIA,IAAM,sBAAsB,CAAC,aAAa,WAAW;AAIrD,SAAgB,gBAAgB,MAAY,aAAqB;CAC/D,KAAK,MAAM,YAAY,qBAAqB;EAC1C,MAAM,WAAW,GAAG,YAAY,GAAG;EAEnC,IAAI,KAAK,OAAO,QAAQ,GACtB;EAGF,KAAK,MACH,WAAA,GACA,QAAA,aAAA,EAAA,GAAa,UAAA,KAAA,CAAK,WAAW,MAAM,SAAS,UAAU,QAAQ,GAAG,OAAO,CAC1E;CACF;AACF"}
|
|
@@ -1,61 +1,62 @@
|
|
|
1
|
-
require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
1
|
let _nx_devkit = require("@nx/devkit");
|
|
3
2
|
//#region packages/nx-plugin/src/generators/app/lib/add-analog-project-config.ts
|
|
4
3
|
function addAnalogProjectConfig(tree, projectRoot, projectName, parsedTags, name, appsDir, nxPackageNamespace) {
|
|
5
4
|
const isStandalone = appsDir === ".";
|
|
6
5
|
const isNx = tree.exists("/nx.json");
|
|
7
6
|
const workspaceAppsDir = isStandalone || !isNx ? "" : `${appsDir}/`;
|
|
8
|
-
if (isNx)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
7
|
+
if (isNx) {
|
|
8
|
+
const projectConfiguration = {
|
|
9
|
+
root: projectRoot,
|
|
10
|
+
projectType: "application",
|
|
11
|
+
sourceRoot: `${projectRoot}/src`,
|
|
12
|
+
tags: parsedTags,
|
|
13
|
+
targets: {
|
|
14
|
+
build: {
|
|
15
|
+
executor: "@analogjs/platform:vite",
|
|
16
|
+
outputs: [
|
|
17
|
+
"{options.outputPath}",
|
|
18
|
+
`{workspaceRoot}/dist/${workspaceAppsDir}${projectName}/.nitro`,
|
|
19
|
+
`{workspaceRoot}/dist/${workspaceAppsDir}${projectName}/ssr`,
|
|
20
|
+
`{workspaceRoot}/dist/${workspaceAppsDir}${projectName}/analog`
|
|
21
|
+
],
|
|
22
|
+
options: {
|
|
23
|
+
main: `${workspaceAppsDir}${projectName}/src/main.ts`,
|
|
24
|
+
configFile: `${workspaceAppsDir}${projectName}/vite.config.ts`,
|
|
25
|
+
outputPath: `dist/${workspaceAppsDir}${projectName}/client`,
|
|
26
|
+
tsConfig: `${workspaceAppsDir}${projectName}/tsconfig.app.json`
|
|
27
|
+
},
|
|
28
|
+
defaultConfiguration: "production",
|
|
29
|
+
configurations: {
|
|
30
|
+
development: { mode: "development" },
|
|
31
|
+
production: {
|
|
32
|
+
sourcemap: false,
|
|
33
|
+
mode: "production"
|
|
34
|
+
}
|
|
34
35
|
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
serve: {
|
|
38
|
-
executor: "@analogjs/platform:vite-dev-server",
|
|
39
|
-
defaultConfiguration: "development",
|
|
40
|
-
options: {
|
|
41
|
-
buildTarget: `${projectName}:build`,
|
|
42
|
-
port: 4200
|
|
43
36
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
serve: {
|
|
38
|
+
executor: "@analogjs/platform:vite-dev-server",
|
|
39
|
+
defaultConfiguration: "development",
|
|
40
|
+
options: {
|
|
41
|
+
buildTarget: `${projectName}:build`,
|
|
42
|
+
port: 4200
|
|
48
43
|
},
|
|
49
|
-
|
|
44
|
+
configurations: {
|
|
45
|
+
development: {
|
|
46
|
+
buildTarget: `${projectName}:build:development`,
|
|
47
|
+
hmr: true
|
|
48
|
+
},
|
|
49
|
+
production: { buildTarget: `${projectName}:build:production` }
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
test: {
|
|
53
|
+
executor: "@analogjs/vitest-angular:test",
|
|
54
|
+
outputs: [`{projectRoot}/coverage`]
|
|
50
55
|
}
|
|
51
|
-
},
|
|
52
|
-
test: {
|
|
53
|
-
executor: "@analogjs/vitest-angular:test",
|
|
54
|
-
outputs: [`{projectRoot}/coverage`]
|
|
55
56
|
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
else {
|
|
57
|
+
};
|
|
58
|
+
(0, _nx_devkit.addProjectConfiguration)(tree, name, projectConfiguration);
|
|
59
|
+
} else {
|
|
59
60
|
const fetched = (0, _nx_devkit.getProjects)(tree).get(projectName);
|
|
60
61
|
if (!fetched) throw new Error(`Project "${projectName}" not found in workspace.`);
|
|
61
62
|
const { targets, $schema, name: _name, generators, "extract-i18n": _, "serve-static": __, ...rest } = fetched;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-analog-project-config.js","names":[],"sources":["../../../../../../../../../nx-plugin/src/generators/app/lib/add-analog-project-config.ts"],"sourcesContent":["import type { ProjectConfiguration, Tree } from '@nx/devkit';\nimport { addProjectConfiguration, getProjects, updateJson } from '@nx/devkit';\n\nexport function addAnalogProjectConfig(\n tree: Tree,\n projectRoot: string,\n projectName: string,\n parsedTags: string[],\n name: string,\n appsDir: string,\n nxPackageNamespace: string,\n): void {\n const isStandalone = appsDir === '.';\n const isNx = tree.exists('/nx.json');\n const workspaceAppsDir = isStandalone || !isNx ? '' : `${appsDir}/`;\n\n if (isNx) {\n const projectConfiguration: ProjectConfiguration = {\n root: projectRoot,\n projectType: 'application',\n sourceRoot: `${projectRoot}/src`,\n tags: parsedTags,\n targets: {\n build: {\n executor: '@analogjs/platform:vite',\n outputs: [\n '{options.outputPath}',\n `{workspaceRoot}/dist/${workspaceAppsDir}${projectName}/.nitro`,\n `{workspaceRoot}/dist/${workspaceAppsDir}${projectName}/ssr`,\n `{workspaceRoot}/dist/${workspaceAppsDir}${projectName}/analog`,\n ],\n options: {\n main: `${workspaceAppsDir}${projectName}/src/main.ts`,\n configFile: `${workspaceAppsDir}${projectName}/vite.config.ts`,\n outputPath: `dist/${workspaceAppsDir}${projectName}/client`,\n tsConfig: `${workspaceAppsDir}${projectName}/tsconfig.app.json`,\n },\n defaultConfiguration: 'production',\n configurations: {\n development: {\n mode: 'development',\n },\n production: {\n sourcemap: false,\n mode: 'production',\n },\n },\n },\n serve: {\n executor: '@analogjs/platform:vite-dev-server',\n defaultConfiguration: 'development',\n options: {\n buildTarget: `${projectName}:build`,\n port: 4200,\n },\n configurations: {\n development: {\n buildTarget: `${projectName}:build:development`,\n hmr: true,\n },\n production: {\n buildTarget: `${projectName}:build:production`,\n },\n },\n },\n test: {\n executor: '@analogjs/vitest-angular:test',\n outputs: [`{projectRoot}/coverage`],\n },\n },\n };\n\n addProjectConfiguration(tree, name, projectConfiguration);\n } else {\n const projects = getProjects(tree);\n const fetched = projects.get(projectName);\n\n if (!fetched) {\n throw new Error(`Project \"${projectName}\" not found in workspace.`);\n }\n\n const {\n targets,\n $schema,\n name: _name,\n generators,\n 'extract-i18n': _,\n 'serve-static': __,\n ...rest\n } = fetched as ProjectConfiguration & Record<string, unknown>;\n\n const {\n 'extract-i18n': _ei,\n 'serve-static': _ss,\n ...architect\n } = targets ?? {};\n\n updateJson(tree, '/angular.json', (json) => {\n json.projects[projectName] = {\n ...rest,\n architect,\n tags: parsedTags,\n };\n\n return json;\n });\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-analog-project-config.js","names":[],"sources":["../../../../../../../../../nx-plugin/src/generators/app/lib/add-analog-project-config.ts"],"sourcesContent":["import type { ProjectConfiguration, Tree } from '@nx/devkit';\nimport { addProjectConfiguration, getProjects, updateJson } from '@nx/devkit';\n\nexport function addAnalogProjectConfig(\n tree: Tree,\n projectRoot: string,\n projectName: string,\n parsedTags: string[],\n name: string,\n appsDir: string,\n nxPackageNamespace: string,\n): void {\n const isStandalone = appsDir === '.';\n const isNx = tree.exists('/nx.json');\n const workspaceAppsDir = isStandalone || !isNx ? '' : `${appsDir}/`;\n\n if (isNx) {\n const projectConfiguration: ProjectConfiguration = {\n root: projectRoot,\n projectType: 'application',\n sourceRoot: `${projectRoot}/src`,\n tags: parsedTags,\n targets: {\n build: {\n executor: '@analogjs/platform:vite',\n outputs: [\n '{options.outputPath}',\n `{workspaceRoot}/dist/${workspaceAppsDir}${projectName}/.nitro`,\n `{workspaceRoot}/dist/${workspaceAppsDir}${projectName}/ssr`,\n `{workspaceRoot}/dist/${workspaceAppsDir}${projectName}/analog`,\n ],\n options: {\n main: `${workspaceAppsDir}${projectName}/src/main.ts`,\n configFile: `${workspaceAppsDir}${projectName}/vite.config.ts`,\n outputPath: `dist/${workspaceAppsDir}${projectName}/client`,\n tsConfig: `${workspaceAppsDir}${projectName}/tsconfig.app.json`,\n },\n defaultConfiguration: 'production',\n configurations: {\n development: {\n mode: 'development',\n },\n production: {\n sourcemap: false,\n mode: 'production',\n },\n },\n },\n serve: {\n executor: '@analogjs/platform:vite-dev-server',\n defaultConfiguration: 'development',\n options: {\n buildTarget: `${projectName}:build`,\n port: 4200,\n },\n configurations: {\n development: {\n buildTarget: `${projectName}:build:development`,\n hmr: true,\n },\n production: {\n buildTarget: `${projectName}:build:production`,\n },\n },\n },\n test: {\n executor: '@analogjs/vitest-angular:test',\n outputs: [`{projectRoot}/coverage`],\n },\n },\n };\n\n addProjectConfiguration(tree, name, projectConfiguration);\n } else {\n const projects = getProjects(tree);\n const fetched = projects.get(projectName);\n\n if (!fetched) {\n throw new Error(`Project \"${projectName}\" not found in workspace.`);\n }\n\n const {\n targets,\n $schema,\n name: _name,\n generators,\n 'extract-i18n': _,\n 'serve-static': __,\n ...rest\n } = fetched as ProjectConfiguration & Record<string, unknown>;\n\n const {\n 'extract-i18n': _ei,\n 'serve-static': _ss,\n ...architect\n } = targets ?? {};\n\n updateJson(tree, '/angular.json', (json) => {\n json.projects[projectName] = {\n ...rest,\n architect,\n tags: parsedTags,\n };\n\n return json;\n });\n }\n}\n"],"mappings":";;AAGA,SAAgB,uBACd,MACA,aACA,aACA,YACA,MACA,SACA,oBACM;CACN,MAAM,eAAe,YAAY;CACjC,MAAM,OAAO,KAAK,OAAO,UAAU;CACnC,MAAM,mBAAmB,gBAAgB,CAAC,OAAO,KAAK,GAAG,QAAQ;CAEjE,IAAI,MAAM;EACR,MAAM,uBAA6C;GACjD,MAAM;GACN,aAAa;GACb,YAAY,GAAG,YAAY;GAC3B,MAAM;GACN,SAAS;IACP,OAAO;KACL,UAAU;KACV,SAAS;MACP;MACA,wBAAwB,mBAAmB,YAAY;MACvD,wBAAwB,mBAAmB,YAAY;MACvD,wBAAwB,mBAAmB,YAAY;KACzD;KACA,SAAS;MACP,MAAM,GAAG,mBAAmB,YAAY;MACxC,YAAY,GAAG,mBAAmB,YAAY;MAC9C,YAAY,QAAQ,mBAAmB,YAAY;MACnD,UAAU,GAAG,mBAAmB,YAAY;KAC9C;KACA,sBAAsB;KACtB,gBAAgB;MACd,aAAa,EACX,MAAM,cACR;MACA,YAAY;OACV,WAAW;OACX,MAAM;MACR;KACF;IACF;IACA,OAAO;KACL,UAAU;KACV,sBAAsB;KACtB,SAAS;MACP,aAAa,GAAG,YAAY;MAC5B,MAAM;KACR;KACA,gBAAgB;MACd,aAAa;OACX,aAAa,GAAG,YAAY;OAC5B,KAAK;MACP;MACA,YAAY,EACV,aAAa,GAAG,YAAY,mBAC9B;KACF;IACF;IACA,MAAM;KACJ,UAAU;KACV,SAAS,CAAC,wBAAwB;IACpC;GACF;EACF;EAEA,CAAA,GAAA,WAAA,wBAAA,CAAwB,MAAM,MAAM,oBAAoB;CAC1D,OAAO;EAEL,MAAM,WAAA,GADW,WAAA,YAAA,CAAY,IACb,CAAA,CAAS,IAAI,WAAW;EAExC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,YAAY,YAAY,0BAA0B;EAGpE,MAAM,EACJ,SACA,SACA,MAAM,OACN,YACA,gBAAgB,GAChB,gBAAgB,IAChB,GAAG,SACD;EAEJ,MAAM,EACJ,gBAAgB,KAChB,gBAAgB,KAChB,GAAG,cACD,WAAW,CAAC;EAEhB,CAAA,GAAA,WAAA,WAAA,CAAW,MAAM,kBAAkB,SAAS;GAC1C,KAAK,SAAS,eAAe;IAC3B,GAAG;IACH;IACA,MAAM;GACR;GAEA,OAAO;EACT,CAAC;CACH;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-angular-app.js","names":[],"sources":["../../../../../../../../../nx-plugin/src/generators/app/lib/add-angular-app.ts"],"sourcesContent":["import { getWorkspaceLayout, Tree } from '@nx/devkit';\nimport { NormalizedOptions } from '../generator';\n\nexport async function addAngularApp(\n tree: Tree,\n options: NormalizedOptions,\n): Promise<void> {\n const isNx = tree.exists('/nx.json');\n const appsDir = isNx ? getWorkspaceLayout(tree).appsDir : 'projects';\n\n const { applicationGenerator } = await import('@nx/angular/generators');\n type ApplicationSchema = Parameters<typeof applicationGenerator>[1];\n const appOptions: ApplicationSchema = {\n name: options.analogAppName,\n directory: `${appsDir}/${options.analogAppName}`,\n linter: !isNx\n ? 'none'\n : (options.linter ??\n (process.env['NODE_ENV'] === 'test' ? 'none' : 'eslint')),\n // Analog sets up its own Vitest configuration in the init generator, so the\n // Angular generator should not scaffold a test runner. Nx 23 also removed\n // the `'vitest'` option in favour of `'vitest-angular'`/`'vitest-analog'`.\n unitTestRunner: 'none' as ApplicationSchema['unitTestRunner'],\n standalone: true,\n ssr: false,\n bundler: 'esbuild',\n skipFormat: true,\n tags: options.tags,\n };\n\n await applicationGenerator(tree, appOptions);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-angular-app.js","names":[],"sources":["../../../../../../../../../nx-plugin/src/generators/app/lib/add-angular-app.ts"],"sourcesContent":["import { getWorkspaceLayout, Tree } from '@nx/devkit';\nimport { NormalizedOptions } from '../generator';\n\nexport async function addAngularApp(\n tree: Tree,\n options: NormalizedOptions,\n): Promise<void> {\n const isNx = tree.exists('/nx.json');\n const appsDir = isNx ? getWorkspaceLayout(tree).appsDir : 'projects';\n\n const { applicationGenerator } = await import('@nx/angular/generators');\n type ApplicationSchema = Parameters<typeof applicationGenerator>[1];\n const appOptions: ApplicationSchema = {\n name: options.analogAppName,\n directory: `${appsDir}/${options.analogAppName}`,\n linter: !isNx\n ? 'none'\n : (options.linter ??\n (process.env['NODE_ENV'] === 'test' ? 'none' : 'eslint')),\n // Analog sets up its own Vitest configuration in the init generator, so the\n // Angular generator should not scaffold a test runner. Nx 23 also removed\n // the `'vitest'` option in favour of `'vitest-angular'`/`'vitest-analog'`.\n unitTestRunner: 'none' as ApplicationSchema['unitTestRunner'],\n standalone: true,\n ssr: false,\n bundler: 'esbuild',\n skipFormat: true,\n tags: options.tags,\n };\n\n await applicationGenerator(tree, appOptions);\n}\n"],"mappings":";;AAGA,eAAsB,cACpB,MACA,SACe;CACf,MAAM,OAAO,KAAK,OAAO,UAAU;CACnC,MAAM,UAAU,QAAA,GAAO,WAAA,mBAAA,CAAmB,IAAI,CAAC,CAAC,UAAU;CAE1D,MAAM,EAAE,yBAAyB,MAAM,OAAO;CAoB9C,MAAM,qBAAqB,MAAM;EAjB/B,MAAM,QAAQ;EACd,WAAW,GAAG,QAAQ,GAAG,QAAQ;EACjC,QAAQ,CAAC,OACL,SACC,QAAQ,WAAA,QAAA,IAAA,aACoB,SAAS,SAAS;EAInD,gBAAgB;EAChB,YAAY;EACZ,KAAK;EACL,SAAS;EACT,YAAY;EACZ,MAAM,QAAQ;CAGiB,CAAU;AAC7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-files.js","names":[],"sources":["../../../../../../../../../nx-plugin/src/generators/app/lib/add-files.ts"],"sourcesContent":["import { generateFiles, Tree } from '@nx/devkit';\nimport { join } from 'node:path';\nimport { NormalizedOptions } from '../generator';\n\nexport function addFiles(\n tree: Tree,\n options: NormalizedOptions,\n majorAngularVersion: number,\n): void {\n const isNx = tree.exists('/nx.json');\n const templateOptions = {\n ...options,\n template: '',\n tsconfig: isNx ? 'tsconfig.base.json' : 'tsconfig.json',\n majorAngularVersion,\n };\n generateFiles(\n tree,\n join(__dirname, '..', 'files', 'template-angular'),\n options.projectRoot,\n templateOptions,\n );\n\n if (!tree.exists('/angular.json') && !tree.exists('/tsconfig.base.json')) {\n generateFiles(\n tree,\n join(__dirname, '..', 'files', 'root'),\n '.',\n templateOptions,\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-files.js","names":[],"sources":["../../../../../../../../../nx-plugin/src/generators/app/lib/add-files.ts"],"sourcesContent":["import { generateFiles, Tree } from '@nx/devkit';\nimport { join } from 'node:path';\nimport { NormalizedOptions } from '../generator';\n\nexport function addFiles(\n tree: Tree,\n options: NormalizedOptions,\n majorAngularVersion: number,\n): void {\n const isNx = tree.exists('/nx.json');\n const templateOptions = {\n ...options,\n template: '',\n tsconfig: isNx ? 'tsconfig.base.json' : 'tsconfig.json',\n majorAngularVersion,\n };\n generateFiles(\n tree,\n join(__dirname, '..', 'files', 'template-angular'),\n options.projectRoot,\n templateOptions,\n );\n\n if (!tree.exists('/angular.json') && !tree.exists('/tsconfig.base.json')) {\n generateFiles(\n tree,\n join(__dirname, '..', 'files', 'root'),\n '.',\n templateOptions,\n );\n }\n}\n"],"mappings":";;;AAIA,SAAgB,SACd,MACA,SACA,qBACM;CACN,MAAM,OAAO,KAAK,OAAO,UAAU;CACnC,MAAM,kBAAkB;EACtB,GAAG;EACH,UAAU;EACV,UAAU,OAAO,uBAAuB;EACxC;CACF;CACA,CAAA,GAAA,WAAA,cAAA,CACE,OAAA,GACA,UAAA,KAAA,CAAK,WAAW,MAAM,SAAS,kBAAkB,GACjD,QAAQ,aACR,eACF;CAEA,IAAI,CAAC,KAAK,OAAO,eAAe,KAAK,CAAC,KAAK,OAAO,qBAAqB,GACrE,CAAA,GAAA,WAAA,cAAA,CACE,OAAA,GACA,UAAA,KAAA,CAAK,WAAW,MAAM,SAAS,MAAM,GACrC,KACA,eACF;AAEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-home-page.js","names":[],"sources":["../../../../../../../../../nx-plugin/src/generators/app/lib/add-home-page.ts"],"sourcesContent":["import { generateFiles, Tree } from '@nx/devkit';\nimport { join } from 'node:path';\nimport { NormalizedOptions } from '../generator';\n\nexport function addHomePage(\n tree: Tree,\n options: NormalizedOptions,\n majorAngularVersion: number,\n): void {\n const templateOptions = {\n ...options,\n template: '',\n majorAngularVersion,\n };\n\n generateFiles(\n tree,\n join(__dirname, '..', 'files', 'index-page'),\n options.projectRoot,\n templateOptions,\n );\n\n const pageDirectory = options.addTailwind ? 'tailwind' : 'css';\n\n generateFiles(\n tree,\n join(__dirname, '..', 'files', 'welcome-components', pageDirectory),\n options.projectRoot,\n templateOptions,\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-home-page.js","names":[],"sources":["../../../../../../../../../nx-plugin/src/generators/app/lib/add-home-page.ts"],"sourcesContent":["import { generateFiles, Tree } from '@nx/devkit';\nimport { join } from 'node:path';\nimport { NormalizedOptions } from '../generator';\n\nexport function addHomePage(\n tree: Tree,\n options: NormalizedOptions,\n majorAngularVersion: number,\n): void {\n const templateOptions = {\n ...options,\n template: '',\n majorAngularVersion,\n };\n\n generateFiles(\n tree,\n join(__dirname, '..', 'files', 'index-page'),\n options.projectRoot,\n templateOptions,\n );\n\n const pageDirectory = options.addTailwind ? 'tailwind' : 'css';\n\n generateFiles(\n tree,\n join(__dirname, '..', 'files', 'welcome-components', pageDirectory),\n options.projectRoot,\n templateOptions,\n );\n}\n"],"mappings":";;;AAIA,SAAgB,YACd,MACA,SACA,qBACM;CACN,MAAM,kBAAkB;EACtB,GAAG;EACH,UAAU;EACV;CACF;CAEA,CAAA,GAAA,WAAA,cAAA,CACE,OAAA,GACA,UAAA,KAAA,CAAK,WAAW,MAAM,SAAS,YAAY,GAC3C,QAAQ,aACR,eACF;CAEA,MAAM,gBAAgB,QAAQ,cAAc,aAAa;CAEzD,CAAA,GAAA,WAAA,cAAA,CACE,OAAA,GACA,UAAA,KAAA,CAAK,WAAW,MAAM,SAAS,sBAAsB,aAAa,GAClE,QAAQ,aACR,eACF;AACF"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require("../../../../_virtual/_rolldown/runtime.js");
|
|
2
1
|
const require_add_tailwind_helpers = require("./add-tailwind-helpers.js");
|
|
3
2
|
let _nx_devkit = require("@nx/devkit");
|
|
4
3
|
//#region packages/nx-plugin/src/generators/app/lib/add-tailwind-config.ts
|
|
@@ -20,5 +19,6 @@ async function setupTailwindGenerator(tree, rawOptions) {
|
|
|
20
19
|
}
|
|
21
20
|
//#endregion
|
|
22
21
|
exports.addTailwindConfig = addTailwindConfig;
|
|
22
|
+
exports.setupTailwindGenerator = setupTailwindGenerator;
|
|
23
23
|
|
|
24
24
|
//# sourceMappingURL=add-tailwind-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-tailwind-config.js","names":[],"sources":["../../../../../../../../../nx-plugin/src/generators/app/lib/add-tailwind-config.ts"],"sourcesContent":["import {\n formatFiles,\n GeneratorCallback,\n readProjectConfiguration,\n Tree,\n} from '@nx/devkit';\nimport {\n addTailwindRequiredPackages,\n detectTailwindInstalledVersion,\n normalizeOptions,\n updateApplicationStyles,\n writeTailwindPostcssConfig,\n} from './add-tailwind-helpers';\n\nexport async function addTailwindConfig(\n tree: Tree,\n projectName: string,\n): Promise<void> {\n await setupTailwindGenerator(tree, {\n project: projectName,\n });\n}\n\nexport interface GeneratorOptions {\n project: string;\n buildTarget?: string;\n skipFormat?: boolean;\n stylesEntryPoint?: string;\n skipPackageJson?: boolean;\n}\n\nexport interface NormalizedGeneratorOptions extends GeneratorOptions {\n buildTarget: string;\n}\n\nexport async function setupTailwindGenerator(\n tree: Tree,\n rawOptions: GeneratorOptions,\n): Promise<GeneratorCallback> {\n const options = normalizeOptions(rawOptions);\n const project = readProjectConfiguration(tree, options.project);\n\n // TODO: use return value for v5+ branching when needed\n detectTailwindInstalledVersion(tree);\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n let installTask: GeneratorCallback = () => {};\n if (!options.skipPackageJson) {\n installTask = addTailwindRequiredPackages(tree);\n }\n\n if (project.projectType === 'application') {\n updateApplicationStyles(tree, options, project);\n writeTailwindPostcssConfig(tree, project);\n }\n\n if (!options.skipFormat) {\n await formatFiles(tree);\n }\n\n return installTask;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-tailwind-config.js","names":[],"sources":["../../../../../../../../../nx-plugin/src/generators/app/lib/add-tailwind-config.ts"],"sourcesContent":["import {\n formatFiles,\n GeneratorCallback,\n readProjectConfiguration,\n Tree,\n} from '@nx/devkit';\nimport {\n addTailwindRequiredPackages,\n detectTailwindInstalledVersion,\n normalizeOptions,\n updateApplicationStyles,\n writeTailwindPostcssConfig,\n} from './add-tailwind-helpers';\n\nexport async function addTailwindConfig(\n tree: Tree,\n projectName: string,\n): Promise<void> {\n await setupTailwindGenerator(tree, {\n project: projectName,\n });\n}\n\nexport interface GeneratorOptions {\n project: string;\n buildTarget?: string;\n skipFormat?: boolean;\n stylesEntryPoint?: string;\n skipPackageJson?: boolean;\n}\n\nexport interface NormalizedGeneratorOptions extends GeneratorOptions {\n buildTarget: string;\n}\n\nexport async function setupTailwindGenerator(\n tree: Tree,\n rawOptions: GeneratorOptions,\n): Promise<GeneratorCallback> {\n const options = normalizeOptions(rawOptions);\n const project = readProjectConfiguration(tree, options.project);\n\n // TODO: use return value for v5+ branching when needed\n detectTailwindInstalledVersion(tree);\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n let installTask: GeneratorCallback = () => {};\n if (!options.skipPackageJson) {\n installTask = addTailwindRequiredPackages(tree);\n }\n\n if (project.projectType === 'application') {\n updateApplicationStyles(tree, options, project);\n writeTailwindPostcssConfig(tree, project);\n }\n\n if (!options.skipFormat) {\n await formatFiles(tree);\n }\n\n return installTask;\n}\n"],"mappings":";;;AAcA,eAAsB,kBACpB,MACA,aACe;CACf,MAAM,uBAAuB,MAAM,EACjC,SAAS,YACX,CAAC;AACH;AAcA,eAAsB,uBACpB,MACA,YAC4B;CAC5B,MAAM,UAAU,6BAAA,iBAAiB,UAAU;CAC3C,MAAM,WAAA,GAAU,WAAA,yBAAA,CAAyB,MAAM,QAAQ,OAAO;CAG9D,6BAAA,+BAA+B,IAAI;CAGnC,IAAI,oBAAuC,CAAC;CAC5C,IAAI,CAAC,QAAQ,iBACX,cAAc,6BAAA,4BAA4B,IAAI;CAGhD,IAAI,QAAQ,gBAAgB,eAAe;EACzC,6BAAA,wBAAwB,MAAM,SAAS,OAAO;EAC9C,6BAAA,2BAA2B,MAAM,OAAO;CAC1C;CAEA,IAAI,CAAC,QAAQ,YACX,OAAA,GAAM,WAAA,YAAA,CAAY,IAAI;CAGxB,OAAO;AACT"}
|