@analogjs/platform 3.0.0-beta.9 → 3.0.1-beta.1
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 +1 -2
- package/migrations/migrate-to-separated-plugins/migrate-to-separated-plugins.js +14 -12
- 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 +3 -3
- package/migrations/migrate-vitest-builder-aliases/migrate-vitest-builder-aliases.js.map +1 -1
- package/migrations/utils/source-edits.js +1 -2
- package/package.json +14 -11
- package/src/index.js +2 -3
- package/src/lib/analog-integration-plugin.js +1 -2
- package/src/lib/clear-client-page-endpoint.js +2 -3
- package/src/lib/content/marked/index.js +1 -2
- package/src/lib/content/marked/marked-content-highlighter.js +1 -2
- package/src/lib/content/marked/marked-setup.service.js +1 -2
- package/src/lib/content/prism/angular.js +1 -2
- package/src/lib/content/prism/index.js +1 -2
- package/src/lib/content/prism/prism-highlighter.js +1 -2
- package/src/lib/content/shiki/index.js +1 -2
- package/src/lib/content/shiki/shiki-highlighter.js +2 -3
- package/src/lib/content/utils/escape-html.js +1 -2
- package/src/lib/content-plugin.js +5 -3
- package/src/lib/content-plugin.js.map +1 -1
- package/src/lib/deps-plugin.d.ts +1 -1
- package/src/lib/deps-plugin.js +11 -8
- package/src/lib/deps-plugin.js.map +1 -1
- package/src/lib/discover-library-routes.d.ts +3 -3
- package/src/lib/discover-library-routes.js +5 -6
- package/src/lib/discover-library-routes.js.map +1 -1
- package/src/lib/get-page-endpoints.d.ts +25 -0
- package/src/lib/get-page-endpoints.js +28 -0
- package/src/lib/get-page-endpoints.js.map +1 -0
- package/src/lib/inject-server-fn-ids.js +1 -2
- package/src/lib/nitro/analog-nitro-plugin.d.ts +6 -6
- package/src/lib/nitro/analog-nitro-plugin.js +119 -51
- package/src/lib/nitro/analog-nitro-plugin.js.map +1 -1
- package/src/lib/nitro/angular-linker-plugin.d.ts +4 -2
- package/src/lib/nitro/angular-linker-plugin.js +25 -40
- package/src/lib/nitro/angular-linker-plugin.js.map +1 -1
- package/src/lib/nitro/build-sitemap.js +3 -4
- package/src/lib/nitro/build-sitemap.js.map +1 -1
- package/src/lib/nitro/debug.js +1 -2
- package/src/lib/nitro/get-content-files.js +1 -2
- package/src/lib/nitro/get-page-handlers.d.ts +4 -19
- package/src/lib/nitro/get-page-handlers.js +10 -28
- package/src/lib/nitro/get-page-handlers.js.map +1 -1
- package/src/lib/nitro/get-server-fn-handlers.js +1 -2
- package/src/lib/nitro/i18n-prerender.d.ts +2 -1
- package/src/lib/nitro/i18n-prerender.js +11 -9
- package/src/lib/nitro/i18n-prerender.js.map +1 -1
- package/src/lib/nitro/page-endpoints-plugin.js +1 -2
- package/src/lib/nitro/post-rendering-hook.js +1 -2
- package/src/lib/nitro/renderers.js +1 -2
- package/src/lib/nitro/server-fn-endpoints.d.ts +3 -1
- package/src/lib/nitro/server-fn-endpoints.js +15 -7
- package/src/lib/nitro/server-fn-endpoints.js.map +1 -1
- package/src/lib/nx-plugin/_virtual/_rolldown/runtime.js +1 -2
- package/src/lib/nx-plugin/node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/camelCase.js +1 -2
- 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 +1 -2
- 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 -2
- 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/builders/vite/vite-build.js +1 -2
- package/src/lib/nx-plugin/src/builders/vite/vite-build.js.map +1 -1
- package/src/lib/nx-plugin/src/builders/vite-dev-server/dev-server.js +1 -2
- package/src/lib/nx-plugin/src/builders/vite-dev-server/dev-server.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/compat.d.ts +2 -1
- package/src/lib/nx-plugin/src/generators/app/compat.js +5 -3
- package/src/lib/nx-plugin/src/generators/app/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/generator.js +8 -4
- 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 +1 -2
- 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 +1 -2
- 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 +13 -3
- 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 +1 -2
- 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 +1 -2
- 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 -2
- 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 +3 -4
- 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 +1 -2
- package/src/lib/nx-plugin/src/generators/app/lib/update-index-html.js +1 -2
- package/src/lib/nx-plugin/src/generators/app/lib/update-index-html.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/versions/minimum-supported-versions.d.ts +3 -1
- package/src/lib/nx-plugin/src/generators/app/versions/minimum-supported-versions.js +6 -3
- 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 +1 -2
- package/src/lib/nx-plugin/src/generators/app/versions/tailwind-dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/versions/versions.js +1 -2
- package/src/lib/nx-plugin/src/generators/init/compat.d.ts +2 -1
- package/src/lib/nx-plugin/src/generators/init/compat.js +5 -3
- package/src/lib/nx-plugin/src/generators/init/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/init/files/src/server/routes/api/v1/hello.ts__template__ +2 -2
- package/src/lib/nx-plugin/src/generators/init/files/vite.config.ts__template__ +5 -1
- package/src/lib/nx-plugin/src/generators/init/generator.js +1 -2
- 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 +2 -4
- 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 +1 -2
- 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 +1 -2
- 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 +1 -2
- package/src/lib/nx-plugin/src/generators/init/lib/update-index-html.js +1 -2
- 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 +1 -2
- 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 +1 -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 +1 -2
- 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 +1 -2
- 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 +1 -2
- 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.d.ts +2 -1
- package/src/lib/nx-plugin/src/generators/page/compat.js +5 -3
- package/src/lib/nx-plugin/src/generators/page/compat.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/page/generator.js +1 -2
- package/src/lib/nx-plugin/src/generators/page/generator.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/preset/__snapshots__/generator.spec.ts.snap +4 -0
- package/src/lib/nx-plugin/src/generators/preset/generator.js +6 -4
- package/src/lib/nx-plugin/src/generators/preset/generator.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/version-utils.js +1 -2
- package/src/lib/nx-plugin/src/utils/version-utils.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/dependencies.d.ts +1 -1
- package/src/lib/nx-plugin/src/utils/versions/dependencies.js +2 -2
- package/src/lib/nx-plugin/src/utils/versions/dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/utils/versions/dev-dependencies.d.ts +2 -2
- package/src/lib/nx-plugin/src/utils/versions/dev-dependencies.js +9 -5
- 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 +9 -6
- package/src/lib/nx-plugin/src/utils/versions/versions.js +14 -9
- package/src/lib/nx-plugin/src/utils/versions/versions.js.map +1 -1
- package/src/lib/options.d.ts +16 -0
- package/src/lib/platform-plugin.js +3 -2
- package/src/lib/platform-plugin.js.map +1 -1
- package/src/lib/route-file-discovery.js +9 -6
- package/src/lib/route-file-discovery.js.map +1 -1
- package/src/lib/route-idiom-diagnostics.js +24 -10
- package/src/lib/route-idiom-diagnostics.js.map +1 -1
- package/src/lib/route-manifest.d.ts +1 -1
- package/src/lib/route-manifest.js +7 -8
- package/src/lib/route-manifest.js.map +1 -1
- package/src/lib/router-plugin.js +7 -4
- package/src/lib/router-plugin.js.map +1 -1
- package/src/lib/server-fn-client-transform.js +1 -2
- package/src/lib/server-fn-id.js +1 -2
- package/src/lib/server-plugin.d.ts +9 -0
- package/src/lib/server-plugin.js +169 -0
- package/src/lib/server-plugin.js.map +1 -0
- package/src/lib/ssr/defer-streaming-plugin.js +0 -1
- package/src/lib/ssr/inject-html-plugin.js +1 -2
- package/src/lib/ssr/ssr-build-plugin.js +1 -2
- package/src/lib/typed-routes-plugin.js +7 -7
- package/src/lib/typed-routes-plugin.js.map +1 -1
- package/src/lib/utils/debug-harness.js +1 -2
- package/src/lib/utils/debug-log-file.js +1 -2
- package/src/lib/utils/debug.js +1 -2
- package/src/lib/utils/rolldown.js +1 -2
- package/src/server-mode-plugin.js +2 -2
- package/src/server-mode-plugin.js.map +1 -1
|
@@ -1,34 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { globSync } from "tinyglobby";
|
|
4
|
-
//#region packages/platform/src/lib/nitro/get-page-handlers.ts
|
|
1
|
+
import { getPageEndpoints } from "../get-page-endpoints.js";
|
|
2
|
+
// packages/platform/src/lib/nitro/get-page-handlers.ts
|
|
5
3
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Discovers all `.server.ts` files under `app/pages/**` and any additional
|
|
9
|
-
* pages directories, then maps each file to a Nitro route pattern under
|
|
10
|
-
* `/api/_analog/pages/...`.
|
|
11
|
-
*
|
|
12
|
-
* Route transformation examples:
|
|
13
|
-
* - index.server.ts → /api/_analog/pages/index
|
|
14
|
-
* - users/[id].server.ts → /api/_analog/pages/users/:id
|
|
15
|
-
* - products/[...slug].server.ts → /api/_analog/pages/products/**:slug
|
|
16
|
-
* - (auth)/login.server.ts → /api/_analog/pages/-auth-/login
|
|
4
|
+
* Nitro event handlers for server-side page routes: each discovered page
|
|
5
|
+
* endpoint, mounted under `/api/_analog`.
|
|
17
6
|
*/
|
|
18
|
-
function getPageHandlers(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
return {
|
|
25
|
-
handler: endpointFile,
|
|
26
|
-
route: `/api/_analog${normalizePath(endpointFile).replace(/^(.*?)\/pages/, "/pages").replace(/\.server\.ts$/, "").replace(/\[\.{3}(.+)\]/g, "**:$1").replace(/\[\.{3}(\w+)\]/g, "**:$1").replace(/\/\(([^/]+)\)/g, "/-$1-").replace(/\[(\w+)\]/g, ":$1").replace(/\./g, "/")}`,
|
|
27
|
-
lazy: true
|
|
28
|
-
};
|
|
29
|
-
});
|
|
7
|
+
function getPageHandlers(args) {
|
|
8
|
+
return getPageEndpoints(args).map(({ file, route }) => ({
|
|
9
|
+
handler: file,
|
|
10
|
+
route: `/api/_analog${route}`,
|
|
11
|
+
lazy: true
|
|
12
|
+
}));
|
|
30
13
|
}
|
|
31
|
-
//#endregion
|
|
32
14
|
export { getPageHandlers };
|
|
33
15
|
|
|
34
16
|
//# sourceMappingURL=get-page-handlers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-page-handlers.js","names":[],"sources":["../../../../src/lib/nitro/get-page-handlers.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"get-page-handlers.js","names":[],"sources":["../../../../src/lib/nitro/get-page-handlers.ts"],"sourcesContent":["import type { NitroEventHandler } from 'nitro/types';\n\nimport { getPageEndpoints } from '../get-page-endpoints.js';\n\n/**\n * Nitro event handlers for server-side page routes: each discovered page\n * endpoint, mounted under `/api/_analog`.\n */\nexport function getPageHandlers(\n args: Parameters<typeof getPageEndpoints>[0],\n): NitroEventHandler[] {\n return getPageEndpoints(args).map(({ file, route }) => ({\n handler: file,\n route: `/api/_analog${route}`,\n lazy: true,\n }));\n}\n"],"mappings":";;;;;;AAQA,SAAgB,gBACd,MACqB;CACrB,OAAO,iBAAiB,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,aAAa;EACtD,SAAS;EACT,OAAO,eAAe;EACtB,MAAM;CACR,EAAE;AACJ"}
|
|
@@ -3,7 +3,7 @@ import { readFileSync } from "node:fs";
|
|
|
3
3
|
import { normalizePath } from "vite";
|
|
4
4
|
import { globSync } from "tinyglobby";
|
|
5
5
|
import { parseSync } from "oxc-parser";
|
|
6
|
-
|
|
6
|
+
// packages/platform/src/lib/nitro/get-server-fn-handlers.ts
|
|
7
7
|
/**
|
|
8
8
|
* `*.server.ts` files that are matched by the glob but are never server-function
|
|
9
9
|
* hosts, so importing them for registration side-effects would be wrong.
|
|
@@ -60,7 +60,6 @@ function definesServerFn(file) {
|
|
|
60
60
|
if (localNames.size === 0) localNames.add("serverFn");
|
|
61
61
|
return program.body.some((node) => node.type === "ExportNamedDeclaration" && node.declaration?.type === "VariableDeclaration" && node.declaration.declarations.some((declarator) => declarator.id?.type === "Identifier" && declarator.init?.type === "CallExpression" && declarator.init.callee?.type === "Identifier" && localNames.has(declarator.init.callee.name)));
|
|
62
62
|
}
|
|
63
|
-
//#endregion
|
|
64
63
|
export { getServerFnHandlers };
|
|
65
64
|
|
|
66
65
|
//# sourceMappingURL=get-server-fn-handlers.js.map
|
|
@@ -8,8 +8,9 @@ import type { I18nPrerenderOptions } from "./types.js";
|
|
|
8
8
|
*
|
|
9
9
|
* The default locale's routes are included both with and without the prefix
|
|
10
10
|
* so that `/about` and `/en/about` both render.
|
|
11
|
+
* Routes that already have a configured locale prefix are kept as-is.
|
|
11
12
|
*/
|
|
12
|
-
export declare function expandRoutesWithLocales(routes: string[], i18n: I18nPrerenderOptions): string[];
|
|
13
|
+
export declare function expandRoutesWithLocales(routes: string[], i18n: I18nPrerenderOptions, apiPrefix?: string): string[];
|
|
13
14
|
/**
|
|
14
15
|
* Creates a post-rendering hook that injects the `lang` attribute
|
|
15
16
|
* into the `<html>` tag of prerendered pages based on the route's
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/platform/src/lib/nitro/i18n-prerender.ts
|
|
2
2
|
/**
|
|
3
3
|
* Expands a list of routes to include locale-prefixed variants.
|
|
4
4
|
*
|
|
@@ -7,22 +7,25 @@
|
|
|
7
7
|
*
|
|
8
8
|
* The default locale's routes are included both with and without the prefix
|
|
9
9
|
* so that `/about` and `/en/about` both render.
|
|
10
|
+
* Routes that already have a configured locale prefix are kept as-is.
|
|
10
11
|
*/
|
|
11
|
-
function expandRoutesWithLocales(routes, i18n) {
|
|
12
|
-
const expanded =
|
|
12
|
+
function expandRoutesWithLocales(routes, i18n, apiPrefix = "api") {
|
|
13
|
+
const expanded = /* @__PURE__ */ new Set();
|
|
14
|
+
const apiRoute = `/${apiPrefix.replace(/^\/+|\/+$/g, "")}`;
|
|
13
15
|
for (const route of routes) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
const firstSegment = route.split("/").filter(Boolean)[0];
|
|
17
|
+
if (route.includes("/_analog/") || route === apiRoute || route.startsWith(`${apiRoute}/`) || i18n.locales.includes(firstSegment)) {
|
|
18
|
+
expanded.add(route);
|
|
16
19
|
continue;
|
|
17
20
|
}
|
|
18
21
|
for (const locale of i18n.locales) {
|
|
19
22
|
const prefix = `/${locale}`;
|
|
20
23
|
const localizedRoute = route === "/" ? prefix : `${prefix}${route}`;
|
|
21
|
-
expanded.
|
|
24
|
+
expanded.add(localizedRoute);
|
|
22
25
|
}
|
|
23
|
-
|
|
26
|
+
expanded.add(route);
|
|
24
27
|
}
|
|
25
|
-
return expanded;
|
|
28
|
+
return [...expanded];
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
31
|
* Creates a post-rendering hook that injects the `lang` attribute
|
|
@@ -55,7 +58,6 @@ function setHtmlLang(html, locale) {
|
|
|
55
58
|
if (/<html[^>]*\slang\s*=\s*["'][^"']*["']/i.test(html)) return html.replace(/(<html[^>]*\s)lang\s*=\s*["'][^"']*["']/i, `$1lang="${locale}"`);
|
|
56
59
|
return html.replace(/<html/i, `<html lang="${locale}"`);
|
|
57
60
|
}
|
|
58
|
-
//#endregion
|
|
59
61
|
export { createI18nPostRenderingHook, detectLocaleFromRoute, expandRoutesWithLocales, setHtmlLang };
|
|
60
62
|
|
|
61
63
|
//# 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
|
|
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 * Routes that already have a configured locale prefix are kept as-is.\n */\nexport function expandRoutesWithLocales(\n routes: string[],\n i18n: I18nPrerenderOptions,\n apiPrefix = 'api',\n): string[] {\n const expanded = new Set<string>();\n const apiRoute = `/${apiPrefix.replace(/^\\/+|\\/+$/g, '')}`;\n\n for (const route of routes) {\n // Skip locale expansion for internal analog endpoints, API routes and\n // explicitly localized routes.\n // The bare API route (e.g. `/api`) is skipped too, which would otherwise\n // get locale-prefixed and produce phantom routes like `/en/api`.\n const firstSegment = route.split('/').filter(Boolean)[0];\n if (\n route.includes('/_analog/') ||\n route === apiRoute ||\n route.startsWith(`${apiRoute}/`) ||\n i18n.locales.includes(firstSegment)\n ) {\n expanded.add(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.add(localizedRoute);\n }\n\n expanded.add(route);\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":";;;;;;;;;;;AAaA,SAAgB,wBACd,QACA,MACA,YAAY,OACF;CACV,MAAM,2BAAW,IAAI,IAAY;CACjC,MAAM,WAAW,IAAI,UAAU,QAAQ,cAAc,EAAE;CAEvD,KAAK,MAAM,SAAS,QAAQ;EAK1B,MAAM,eAAe,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC;EACtD,IACE,MAAM,SAAS,WAAW,KAC1B,UAAU,YACV,MAAM,WAAW,GAAG,SAAS,EAAE,KAC/B,KAAK,QAAQ,SAAS,YAAY,GAClC;GACA,SAAS,IAAI,KAAK;GAClB;EACF;EAEA,KAAK,MAAM,UAAU,KAAK,SAAS;GACjC,MAAM,SAAS,IAAI;GACnB,MAAM,iBAAiB,UAAU,MAAM,SAAS,GAAG,SAAS;GAC5D,SAAS,IAAI,cAAc;EAC7B;EAEA,SAAS,IAAI,KAAK;CACpB;CAEA,OAAO,CAAC,GAAG,QAAQ;AACrB;;;;;;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,7 +1,7 @@
|
|
|
1
1
|
import { SERVER_FETCH_FACTORY_SNIPPET } from "./renderers.js";
|
|
2
2
|
import { normalizePath } from "vite";
|
|
3
3
|
import { parseSync } from "oxc-parser";
|
|
4
|
-
|
|
4
|
+
// packages/platform/src/lib/nitro/page-endpoints-plugin.ts
|
|
5
5
|
function pageEndpointsPlugin() {
|
|
6
6
|
return {
|
|
7
7
|
name: "analogjs-platform-rollup-page-endpoint",
|
|
@@ -66,7 +66,6 @@ function pageEndpointsPlugin() {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
//#endregion
|
|
70
69
|
export { pageEndpointsPlugin };
|
|
71
70
|
|
|
72
71
|
//# sourceMappingURL=page-endpoints-plugin.js.map
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/platform/src/lib/nitro/post-rendering-hook.ts
|
|
2
2
|
function addPostRenderingHooks(nitro, hooks) {
|
|
3
3
|
for (const hook of hooks) nitro.hooks.hook("prerender:generate", async (route) => {
|
|
4
4
|
await hook(route);
|
|
5
5
|
});
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { addPostRenderingHooks };
|
|
9
8
|
|
|
10
9
|
//# sourceMappingURL=post-rendering-hook.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/platform/src/lib/nitro/renderers.ts
|
|
2
2
|
/**
|
|
3
3
|
* Code snippet emitted into virtual modules to create a request-scoped
|
|
4
4
|
* fetch using ofetch's `createFetch` + h3's `fetchWithEvent`.
|
|
@@ -16,7 +16,6 @@ var SERVER_FETCH_FACTORY_SNIPPET = `
|
|
|
16
16
|
return fetchWithEvent(event, url, init);
|
|
17
17
|
}
|
|
18
18
|
});`;
|
|
19
|
-
//#endregion
|
|
20
19
|
export { SERVER_FETCH_FACTORY_SNIPPET };
|
|
21
20
|
|
|
22
21
|
//# sourceMappingURL=renderers.js.map
|
|
@@ -29,6 +29,8 @@ export type BuildServerFnDispatchModuleArgs = {
|
|
|
29
29
|
* app configured. When absent, handlers run with only `providedIn: 'root'`.
|
|
30
30
|
*/
|
|
31
31
|
appConfigModule?: string;
|
|
32
|
+
/** The app's root directory, where `zone.js` is resolved from. */
|
|
33
|
+
root: string;
|
|
32
34
|
};
|
|
33
35
|
/**
|
|
34
36
|
* Generates the source of the Nitro dispatch handler.
|
|
@@ -38,4 +40,4 @@ export type BuildServerFnDispatchModuleArgs = {
|
|
|
38
40
|
* each request looks up the function by id and runs it via `dispatchServerFn` —
|
|
39
41
|
* the same call path the validation harnesses exercise.
|
|
40
42
|
*/
|
|
41
|
-
export declare function buildServerFnDispatchModule({ modules, appConfigModule }: BuildServerFnDispatchModuleArgs): string;
|
|
43
|
+
export declare function buildServerFnDispatchModule({ modules, appConfigModule, root }: BuildServerFnDispatchModuleArgs): string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { dirname, join } from "node:path";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
1
3
|
import { normalizePath } from "vite";
|
|
2
|
-
|
|
4
|
+
// packages/platform/src/lib/nitro/server-fn-endpoints.ts
|
|
3
5
|
/**
|
|
4
6
|
* Nitro virtual-module id for the generated server-function dispatch handler.
|
|
5
7
|
* Referenced from `nitroConfig.handlers` and provided via `nitroConfig.virtual`.
|
|
@@ -31,16 +33,17 @@ function getServerFnDispatchHandler() {
|
|
|
31
33
|
* each request looks up the function by id and runs it via `dispatchServerFn` —
|
|
32
34
|
* the same call path the validation harnesses exercise.
|
|
33
35
|
*/
|
|
34
|
-
function buildServerFnDispatchModule({ modules, appConfigModule }) {
|
|
36
|
+
function buildServerFnDispatchModule({ modules, appConfigModule, root }) {
|
|
37
|
+
const registrationImports = modules.map((m) => `import ${JSON.stringify(normalizePath(m.file))};`).join("\n");
|
|
38
|
+
const appConfig = appConfigModule ? `import { config as serverFnAppConfig } from ${JSON.stringify(normalizePath(appConfigModule))};` : `const serverFnAppConfig = { providers: [] };`;
|
|
35
39
|
return `import '@angular/compiler';
|
|
36
|
-
import 'zone.js/node';
|
|
37
|
-
import '@angular/platform-server/init';
|
|
40
|
+
${hasZoneJs(root) ? `import 'zone.js/node';\n` : ""}import '@angular/platform-server/init';
|
|
38
41
|
import { createServerFnAppInjector, createServerFnEventHandler } from '@analogjs/router/server';
|
|
39
42
|
|
|
40
43
|
// Discovered server-function modules (registration side-effects).
|
|
41
|
-
${
|
|
44
|
+
${registrationImports}
|
|
42
45
|
|
|
43
|
-
${
|
|
46
|
+
${appConfig}
|
|
44
47
|
|
|
45
48
|
// Bootstrapped once from the app's own server config, so a handler resolves the
|
|
46
49
|
// same DI as an SSR render (\`providedIn: 'root'\` and listed providers alike).
|
|
@@ -51,7 +54,12 @@ export default createServerFnEventHandler(
|
|
|
51
54
|
);
|
|
52
55
|
`;
|
|
53
56
|
}
|
|
54
|
-
|
|
57
|
+
function hasZoneJs(root) {
|
|
58
|
+
for (let dir = root;; dir = dirname(dir)) {
|
|
59
|
+
if (existsSync(join(dir, "node_modules/zone.js/package.json"))) return true;
|
|
60
|
+
if (dirname(dir) === dir) return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
55
63
|
export { SERVER_FN_DISPATCH_ROUTE, SERVER_FN_DISPATCH_VIRTUAL, buildServerFnDispatchModule, getServerFnDispatchHandler };
|
|
56
64
|
|
|
57
65
|
//# 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
|
|
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 { existsSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\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 /** The app's root directory, where `zone.js` is resolved from. */\n root: 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 root,\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` (when installed; zoneless apps may omit it) and the server\n // platform init match the SSR entry, so bootstrapping the app injector below\n // 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 const zoneImport = hasZoneJs(root) ? `import 'zone.js/node';\\n` : '';\n\n return `import '@angular/compiler';\n${zoneImport}import '@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\nfunction hasZoneJs(root: string): boolean {\n for (let dir = root; ; dir = dirname(dir)) {\n if (existsSync(join(dir, 'node_modules/zone.js/package.json'))) {\n return true;\n }\n if (dirname(dir) === dir) {\n return false;\n }\n }\n}\n"],"mappings":";;;;;;;;AAWA,IAAa,6BAA6B;;AAG1C,IAAa,2BAA2B;;;;;;;;;;AAcxC,SAAgB,6BAAgD;CAC9D,OAAO;EACL,OAAO;EACP,SAAS;EACT,MAAM;CACR;AACF;;;;;;;;;AAwBA,SAAgB,4BAA4B,EAC1C,SACA,iBACA,QAC0C;CAC1C,MAAM,sBAAsB,QACzB,KAAK,MAAM,UAAU,KAAK,UAAU,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAC9D,KAAK,IAAI;CAKZ,MAAM,YAAY,kBACd,+CAA+C,KAAK,UAClD,cAAc,eAAe,CAC/B,EAAE,KACF;CAeJ,OAAO;EAFY,UAAU,IAAI,IAAI,6BAA6B,GAGvD;;;;EAIX,oBAAoB;;EAEpB,UAAU;;;;;;;;;;AAUZ;AAEA,SAAS,UAAU,MAAuB;CACxC,KAAK,IAAI,MAAM,OAAQ,MAAM,QAAQ,GAAG,GAAG;EACzC,IAAI,WAAW,KAAK,KAAK,mCAAmC,CAAC,GAC3D,OAAO;EAET,IAAI,QAAQ,GAAG,MAAM,KACnB,OAAO;CAEX;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -19,5 +19,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
19
19
|
value: mod,
|
|
20
20
|
enumerable: true
|
|
21
21
|
}) : target, mod));
|
|
22
|
-
//#endregion
|
|
23
22
|
exports.__toESM = __toESM;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
const require_capitalize = require("./capitalize.js");
|
|
2
2
|
const require_words = require("./words.js");
|
|
3
|
-
|
|
3
|
+
// node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/camelCase.mjs
|
|
4
4
|
function camelCase(str) {
|
|
5
5
|
const words$1 = require_words.words(str);
|
|
6
6
|
if (words$1.length === 0) return "";
|
|
7
7
|
const [first, ...rest] = words$1;
|
|
8
8
|
return `${first.toLowerCase()}${rest.map((word) => require_capitalize.capitalize(word)).join("")}`;
|
|
9
9
|
}
|
|
10
|
-
//#endregion
|
|
11
10
|
exports.camelCase = camelCase;
|
|
12
11
|
|
|
13
12
|
//# sourceMappingURL=camelCase.js.map
|
|
@@ -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"],"
|
|
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"],"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,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/capitalize.mjs
|
|
2
2
|
function capitalize(str) {
|
|
3
3
|
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
4
4
|
}
|
|
5
|
-
//#endregion
|
|
6
5
|
exports.capitalize = capitalize;
|
|
7
6
|
|
|
8
7
|
//# sourceMappingURL=capitalize.js.map
|
|
@@ -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"],"
|
|
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"],"ignoreList":[0],"mappings":";AAAA,SAAS,WAAW,KAAK;CACrB,OAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,YAAY;AACnE"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/words.mjs
|
|
2
2
|
var CASE_SPLIT_PATTERN = /\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;
|
|
3
3
|
function words(str) {
|
|
4
4
|
return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
|
|
5
5
|
}
|
|
6
|
-
//#endregion
|
|
7
6
|
exports.CASE_SPLIT_PATTERN = CASE_SPLIT_PATTERN;
|
|
8
7
|
exports.words = words;
|
|
9
8
|
|
|
@@ -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"],"
|
|
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"],"ignoreList":[0],"mappings":";AAAA,IAAM,qBAAqB;AAC3B,SAAS,MAAM,KAAK;CAChB,OAAO,MAAM,KAAK,IAAI,MAAM,kBAAkB,KAAK,CAAC,CAAC;AACzD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
|
|
2
2
|
let _analogjs_vite_plugin_angular_builders_vite = require("@analogjs/vite-plugin-angular/builders/vite");
|
|
3
3
|
_analogjs_vite_plugin_angular_builders_vite = require_runtime.__toESM(_analogjs_vite_plugin_angular_builders_vite);
|
|
4
|
-
|
|
4
|
+
// packages/nx-plugin/src/builders/vite/vite-build.ts
|
|
5
5
|
/**
|
|
6
6
|
* Thin shim that re-exports the Angular Devkit Architect build builder
|
|
7
7
|
* shipped by `@analogjs/vite-plugin-angular`. Architect resolves the
|
|
@@ -12,7 +12,6 @@ _analogjs_vite_plugin_angular_builders_vite = require_runtime.__toESM(_analogjs_
|
|
|
12
12
|
* pattern for surfacing `@storybook/angular`'s builders.
|
|
13
13
|
*/
|
|
14
14
|
var vite_build_default = _analogjs_vite_plugin_angular_builders_vite.default;
|
|
15
|
-
//#endregion
|
|
16
15
|
module.exports = vite_build_default;
|
|
17
16
|
|
|
18
17
|
//# sourceMappingURL=vite-build.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-build.js","names":[],"sources":["../../../../../../../../nx-plugin/src/builders/vite/vite-build.ts"],"sourcesContent":["/**\n * Thin shim that re-exports the Angular Devkit Architect build builder\n * shipped by `@analogjs/vite-plugin-angular`. Architect resolves the\n * implementation from the local `builders.json` entry without traversing a\n * cross-package string redirect, so the user-facing `@analogjs/platform:vite`\n * identifier stays stable while the real implementation continues to live in\n * `@analogjs/vite-plugin-angular`. Mirrors `@analogjs/storybook-angular`'s\n * pattern for surfacing `@storybook/angular`'s builders.\n */\nimport viteBuilder from '@analogjs/vite-plugin-angular/builders/vite';\n\nexport default viteBuilder;\n"],"mappings":";;;;;;;;;;;;;AAWA,IAAA,
|
|
1
|
+
{"version":3,"file":"vite-build.js","names":["viteBuilder"],"sources":["../../../../../../../../nx-plugin/src/builders/vite/vite-build.ts"],"sourcesContent":["/**\n * Thin shim that re-exports the Angular Devkit Architect build builder\n * shipped by `@analogjs/vite-plugin-angular`. Architect resolves the\n * implementation from the local `builders.json` entry without traversing a\n * cross-package string redirect, so the user-facing `@analogjs/platform:vite`\n * identifier stays stable while the real implementation continues to live in\n * `@analogjs/vite-plugin-angular`. Mirrors `@analogjs/storybook-angular`'s\n * pattern for surfacing `@storybook/angular`'s builders.\n */\nimport viteBuilder from '@analogjs/vite-plugin-angular/builders/vite';\n\nexport default viteBuilder;\n"],"mappings":";;;;;;;;;;;;;AAWA,IAAA,qBAAeA,4CAAAA"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
|
|
2
2
|
let _analogjs_vite_plugin_angular_builders_vite_dev_server = require("@analogjs/vite-plugin-angular/builders/vite-dev-server");
|
|
3
3
|
_analogjs_vite_plugin_angular_builders_vite_dev_server = require_runtime.__toESM(_analogjs_vite_plugin_angular_builders_vite_dev_server);
|
|
4
|
-
|
|
4
|
+
// packages/nx-plugin/src/builders/vite-dev-server/dev-server.ts
|
|
5
5
|
/**
|
|
6
6
|
* Thin shim that re-exports the Angular Devkit Architect dev-server builder
|
|
7
7
|
* shipped by `@analogjs/vite-plugin-angular`. See `../vite/vite-build.ts` for
|
|
8
8
|
* the rationale; mirrors `@analogjs/storybook-angular`'s pattern.
|
|
9
9
|
*/
|
|
10
10
|
var dev_server_default = _analogjs_vite_plugin_angular_builders_vite_dev_server.default;
|
|
11
|
-
//#endregion
|
|
12
11
|
module.exports = dev_server_default;
|
|
13
12
|
|
|
14
13
|
//# sourceMappingURL=dev-server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server.js","names":[],"sources":["../../../../../../../../nx-plugin/src/builders/vite-dev-server/dev-server.ts"],"sourcesContent":["/**\n * Thin shim that re-exports the Angular Devkit Architect dev-server builder\n * shipped by `@analogjs/vite-plugin-angular`. See `../vite/vite-build.ts` for\n * the rationale; mirrors `@analogjs/storybook-angular`'s pattern.\n */\nimport devServerBuilder from '@analogjs/vite-plugin-angular/builders/vite-dev-server';\n\nexport default devServerBuilder;\n"],"mappings":";;;;;;;;;AAOA,IAAA,
|
|
1
|
+
{"version":3,"file":"dev-server.js","names":["devServerBuilder"],"sources":["../../../../../../../../nx-plugin/src/builders/vite-dev-server/dev-server.ts"],"sourcesContent":["/**\n * Thin shim that re-exports the Angular Devkit Architect dev-server builder\n * shipped by `@analogjs/vite-plugin-angular`. See `../vite/vite-build.ts` for\n * the rationale; mirrors `@analogjs/storybook-angular`'s pattern.\n */\nimport devServerBuilder from '@analogjs/vite-plugin-angular/builders/vite-dev-server';\n\nexport default devServerBuilder;\n"],"mappings":";;;;;;;;;AAOA,IAAA,qBAAeA,uDAAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { convertNxGenerator } from "@nx/devkit";
|
|
2
|
+
import generator from "./generator";
|
|
2
3
|
/**
|
|
3
4
|
* Angular CLI schematic wrapper for the Analog application generator.
|
|
4
5
|
* Referenced by `generators.json#schematics.application.factory` so that
|
|
5
6
|
* `ng generate @analogjs/platform:application` resolves through the
|
|
6
7
|
* Angular schematics engine (which uses named exports, not default).
|
|
7
8
|
*/
|
|
8
|
-
export declare
|
|
9
|
+
export declare function applicationSchematic(options: Parameters<typeof generator>[1]): ReturnType<ReturnType<typeof convertNxGenerator>>;
|
|
9
10
|
export default applicationSchematic;
|
|
@@ -3,15 +3,17 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_src_generators_app_generator = require("./generator.js");
|
|
6
|
-
|
|
6
|
+
let _nx_devkit = require("@nx/devkit");
|
|
7
|
+
// packages/nx-plugin/src/generators/app/compat.ts
|
|
7
8
|
/**
|
|
8
9
|
* Angular CLI schematic wrapper for the Analog application generator.
|
|
9
10
|
* Referenced by `generators.json#schematics.application.factory` so that
|
|
10
11
|
* `ng generate @analogjs/platform:application` resolves through the
|
|
11
12
|
* Angular schematics engine (which uses named exports, not default).
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
function applicationSchematic(options) {
|
|
15
|
+
return (0, _nx_devkit.convertNxGenerator)(require_src_generators_app_generator)(options);
|
|
16
|
+
}
|
|
15
17
|
exports.applicationSchematic = applicationSchematic;
|
|
16
18
|
exports.default = applicationSchematic;
|
|
17
19
|
|
|
@@ -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
|
|
1
|
+
{"version":3,"file":"compat.js","names":["convertNxGenerator","generator"],"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 function applicationSchematic(\n options: Parameters<typeof generator>[1],\n): ReturnType<ReturnType<typeof convertNxGenerator>> {\n return convertNxGenerator(generator)(options);\n}\nexport default applicationSchematic;\n"],"mappings":";;;;;;;;;;;;;AASA,SAAgB,qBACd,SACmD;CACnD,QAAA,GAAOA,WAAAA,mBAAAA,CAAmBC,oCAAS,CAAC,CAAC,OAAO;AAC9C"}
|
|
@@ -9,10 +9,11 @@ const require_add_tailwind_config = require("./lib/add-tailwind-config.js");
|
|
|
9
9
|
const require_cleanup_files = require("./lib/cleanup-files.js");
|
|
10
10
|
const require_add_analog_project_config = require("./lib/add-analog-project-config.js");
|
|
11
11
|
const require_update_index_html = require("./lib/update-index-html.js");
|
|
12
|
+
const require_versions = require("../../utils/versions/versions.js");
|
|
12
13
|
let _nx_devkit = require("@nx/devkit");
|
|
13
14
|
let _nx_devkit_ngcli_adapter = require("@nx/devkit/ngcli-adapter");
|
|
14
15
|
let semver = require("semver");
|
|
15
|
-
|
|
16
|
+
// packages/nx-plugin/src/generators/app/generator.ts
|
|
16
17
|
function normalizeOptions(tree, options) {
|
|
17
18
|
const isNx = tree.exists("/nx.json");
|
|
18
19
|
const appsDir = isNx ? (0, _nx_devkit.getWorkspaceLayout)(tree).appsDir : "projects";
|
|
@@ -41,7 +42,10 @@ function normalizeOptions(tree, options) {
|
|
|
41
42
|
async function appGenerator(tree, options) {
|
|
42
43
|
const nxVersion = require_version_utils.getInstalledPackageVersion(tree, "nx");
|
|
43
44
|
if (nxVersion && require_minimum_supported_versions.belowMinimumSupportedNxVersion(nxVersion)) throw new Error(_nx_devkit.stripIndents`Nx v${require_minimum_supported_versions.MINIMUM_SUPPORTED_NX_VERSION} or newer is required to install Analog`);
|
|
44
|
-
if (options.linter === "oxlint"
|
|
45
|
+
if (options.linter === "oxlint") {
|
|
46
|
+
if (!nxVersion) throw new Error(_nx_devkit.stripIndents`The oxlint linter is only supported in Nx workspaces`);
|
|
47
|
+
if (require_minimum_supported_versions.belowMinimumSupportedOxlintNxVersion(nxVersion)) throw new Error(_nx_devkit.stripIndents`Nx v${require_minimum_supported_versions.MINIMUM_SUPPORTED_OXLINT_NX_VERSION} or newer is required to use the oxlint linter`);
|
|
48
|
+
}
|
|
45
49
|
const normalizedOptions = normalizeOptions(tree, options);
|
|
46
50
|
if (nxVersion) await require_add_angular_app.addAngularApp(tree, normalizedOptions);
|
|
47
51
|
else {
|
|
@@ -62,10 +66,11 @@ async function appGenerator(tree, options) {
|
|
|
62
66
|
require_add_files.addFiles(tree, normalizedOptions, majorAngularVersion);
|
|
63
67
|
(0, _nx_devkit.addDependenciesToPackageJson)(tree, {
|
|
64
68
|
"front-matter": "^4.0.2",
|
|
69
|
+
h3: require_versions.H3,
|
|
65
70
|
marked: "^18.0.0",
|
|
66
71
|
mermaid: "^10.2.4",
|
|
67
72
|
prismjs: "^1.29.0"
|
|
68
|
-
}, {});
|
|
73
|
+
}, { "@analogjs/vite-plugin-nitro": require_versions.ANALOG_JS_VITE_PLUGIN_NITRO });
|
|
69
74
|
(0, _nx_devkit.updateJson)(tree, "/package.json", (json) => {
|
|
70
75
|
json.dependencies["@angular/platform-server"] = `~${angularVersion}`;
|
|
71
76
|
json.overrides = {
|
|
@@ -85,7 +90,6 @@ async function appGenerator(tree, options) {
|
|
|
85
90
|
(0, _nx_devkit.installPackagesTask)(tree);
|
|
86
91
|
};
|
|
87
92
|
}
|
|
88
|
-
//#endregion
|
|
89
93
|
module.exports = appGenerator;
|
|
90
94
|
|
|
91
95
|
//# sourceMappingURL=generator.js.map
|
|
@@ -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'
|
|
1
|
+
{"version":3,"file":"generator.js","names":["getWorkspaceLayout","names","determineOffsetFromRoot","getInstalledPackageVersion","belowMinimumSupportedNxVersion","MINIMUM_SUPPORTED_NX_VERSION","belowMinimumSupportedOxlintNxVersion","MINIMUM_SUPPORTED_OXLINT_NX_VERSION","addAngularApp","wrapAngularDevkitSchematic","setupAnalogGenerator","coerce","major","H3","ANALOG_JS_VITE_PLUGIN_NITRO","addTailwindConfig","formatFiles"],"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 belowMinimumSupportedOxlintNxVersion,\n MINIMUM_SUPPORTED_NX_VERSION,\n MINIMUM_SUPPORTED_OXLINT_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';\nimport { ANALOG_JS_VITE_PLUGIN_NITRO, H3 } from '../../utils/versions/versions';\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') {\n if (!nxVersion) {\n throw new Error(\n stripIndents`The oxlint linter is only supported in Nx workspaces`,\n );\n }\n if (belowMinimumSupportedOxlintNxVersion(nxVersion)) {\n throw new Error(\n stripIndents`Nx v${MINIMUM_SUPPORTED_OXLINT_NX_VERSION} or newer is required to use the oxlint linter`,\n );\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 h3: H3,\n marked: '^18.0.0',\n mermaid: '^10.2.4',\n prismjs: '^1.29.0',\n },\n { '@analogjs/vite-plugin-nitro': ANALOG_JS_VITE_PLUGIN_NITRO },\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":";;;;;;;;;;;;;;;;AA4CA,SAAS,iBACP,MACA,SACmB;CACnB,MAAM,OAAO,KAAK,OAAO,UAAU;CACnC,MAAM,UAAU,QAAA,GAAOA,WAAAA,mBAAAA,CAAmB,IAAI,CAAC,CAAC,UAAU;CAC1D,MAAM,YAAA,GAAWC,WAAAA,MAAAA,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,GAAiBC,WAAAA,eAAAA,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,YAAYC,sBAAAA,2BAA2B,MAAM,IAAI;CAEvD,IAAI,aAAaC,mCAAAA,+BAA+B,SAAS,GACvD,MAAM,IAAI,MACR,WAAA,YAAY,OAAOC,mCAAAA,6BAA6B,wCAClD;CAGF,IAAI,QAAQ,WAAW,UAAU;EAC/B,IAAI,CAAC,WACH,MAAM,IAAI,MACR,WAAA,YAAY,sDACd;EAEF,IAAIC,mCAAAA,qCAAqC,SAAS,GAChD,MAAM,IAAI,MACR,WAAA,YAAY,OAAOC,mCAAAA,oCAAoC,+CACzD;CAEJ;CAEA,MAAM,oBAAoB,iBAAiB,MAAM,OAAO;CAExD,IAAI,WACF,MAAMC,wBAAAA,cAAc,MAAM,iBAAiB;MACtC;EAKL,OAAA,GAJ4BC,yBAAAA,2BAAAA,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,MAAMC,sCAAqB,MAAM;EAC/B,SAAS,kBAAkB;EAC3B,QAAQ;CACV,CAAC;CAED,MAAM,iBAAiBP,sBAAAA,2BAA2B,MAAM,eAAe;CACvE,MAAM,yBAAA,GAAwBQ,OAAAA,OAAAA,CAAO,kBAAkB,EAAE;CACzD,IAAI,CAAC,uBACH,MAAM,IAAI,MAAM,gDAAgD;CAElE,MAAM,uBAAA,GAAsBC,OAAAA,MAAAA,CAAM,qBAAqB;CACvD,kBAAA,SAAS,MAAM,mBAAmB,mBAAmB;CACrD,CAAA,GAAA,WAAA,6BAAA,CACE,MACA;EACE,gBAAgB;EAChB,IAAIC,iBAAAA;EACJ,QAAQ;EACR,SAAS;EACT,SAAS;CACX,GACA,EAAE,+BAA+BC,iBAAAA,4BAA4B,CAC/D;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,MAAMC,4BAAAA,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,GAAMC,WAAAA,YAAAA,CAAY,IAAI;CAGxB,aAAa;EACX,CAAA,GAAA,WAAA,oBAAA,CAAoB,IAAI;CAC1B;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let node_path = require("node:path");
|
|
2
2
|
let node_fs = require("node:fs");
|
|
3
|
-
|
|
3
|
+
// packages/nx-plugin/src/generators/app/lib/add-agent-context.ts
|
|
4
4
|
var AGENT_CONTEXT_FILES = ["AGENTS.md", "CLAUDE.md"];
|
|
5
5
|
function addAgentContext(tree, projectRoot) {
|
|
6
6
|
for (const fileName of AGENT_CONTEXT_FILES) {
|
|
@@ -9,7 +9,6 @@ function addAgentContext(tree, projectRoot) {
|
|
|
9
9
|
tree.write(filePath, (0, node_fs.readFileSync)((0, node_path.join)(__dirname, "..", "files", "agents", fileName), "utf-8"));
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
//#endregion
|
|
13
12
|
exports.addAgentContext = addAgentContext;
|
|
14
13
|
|
|
15
14
|
//# sourceMappingURL=add-agent-context.js.map
|
|
@@ -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":";;;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,
|
|
1
|
+
{"version":3,"file":"add-agent-context.js","names":["readFileSync","join"],"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,GACAA,QAAAA,aAAAA,EAAAA,GAAaC,UAAAA,KAAAA,CAAK,WAAW,MAAM,SAAS,UAAU,QAAQ,GAAG,OAAO,CAC1E;CACF;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
let _nx_devkit = require("@nx/devkit");
|
|
2
|
-
|
|
2
|
+
// packages/nx-plugin/src/generators/app/lib/add-analog-project-config.ts
|
|
3
3
|
function addAnalogProjectConfig(tree, projectRoot, projectName, parsedTags, name, appsDir, nxPackageNamespace) {
|
|
4
4
|
const isStandalone = appsDir === ".";
|
|
5
5
|
const isNx = tree.exists("/nx.json");
|
|
@@ -71,7 +71,6 @@ function addAnalogProjectConfig(tree, projectRoot, projectName, parsedTags, name
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
//#endregion
|
|
75
74
|
exports.addAnalogProjectConfig = addAnalogProjectConfig;
|
|
76
75
|
|
|
77
76
|
//# sourceMappingURL=add-analog-project-config.js.map
|