@antelopejs/dms-frontend 0.3.11 → 0.3.12

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/README.md CHANGED
@@ -100,7 +100,7 @@ generated server read, from the environment or the project's `.env`.
100
100
  need a backend URL through `-b` or `DMS_API_BASE_URL`, and exit 2 without one.
101
101
  `dev` also discovers it from the enclosing antelope project's
102
102
  `.antelope/dev.json`, and exits 1 when there is none to discover.
103
- `verify-source` needs `--layer` instead.
103
+ `verify-source` needs no backend: it runs in the project that installs `@antelopejs/dms`.
104
104
 
105
105
  `prepare` runs anywhere: when it cannot prepare the workspace it warns on
106
106
  stderr and exits 0, so a frontend module's `postinstall` hook never fails an
@@ -463,15 +463,30 @@ Use pnpm for all repository and workspace operations.
463
463
 
464
464
  ## Verify local frontend modules
465
465
 
466
- Use the packaged source verifier to validate an unpublished DMS frontend package against this exact adapter version. Additional modules and local package bindings are repeatable. All supplied frontend packages are copied into the generated workspace and bound with `workspace:*`.
466
+ Use the packaged source verifier to validate unpublished DMS frontend modules against this exact adapter version. Run it from the project:
467
+
468
+ ```bash
469
+ ajs dms verify-source
470
+ ```
471
+
472
+ The modules are verified on top of the DMS core layer, the `frontend-vue` directory of `@antelopejs/dms`. The verifier finds the `@antelopejs/dms` the project installs the way Node does, from the current directory, and names it before it starts: `Verifying against @antelopejs/dms 0.5.5 (installed in this project)`. When the project does not install it, the verifier stops with the command that adds it as a development dependency (`pnpm add -D @antelopejs/dms`, or the equivalent for the project's package manager).
473
+
474
+ Without `--module`, the verifier takes the current directory when it is a frontend module (it contains `dms.frontend.ts`), and its `frontend-vue` directory otherwise. `--module` names other ones and is repeatable, as is `--local-package`, which binds a local build of a package into the generated workspace. All supplied frontend packages are copied into the generated workspace and bound with `workspace:*`.
475
+
476
+ ```bash
477
+ ajs dms verify-source --module ./admin-vue --module ./shop-vue
478
+ ```
479
+
480
+ `--layer` is for the DMS core layer's own development: it verifies an unpublished core layer instead of the installed one, here against a local build of `@antelopejs/dms`:
467
481
 
468
482
  ```bash
469
483
  ajs dms verify-source \
470
484
  --layer /path/to/dms/frontend-vue \
471
- --module /path/to/module/frontend-vue \
472
485
  --local-package @antelopejs/dms=/path/to/dms
473
486
  ```
474
487
 
475
- A supplied package whose declared range excludes this adapter version is refused before anything is installed (see [Declaring the loader releases a module supports](#declaring-the-loader-releases-a-module-supports)). The verifier generates a temporary workspace, installs it, builds client, SSR, and email bundles, checks what the client bundle loads, runs `vue-tsc`, renders eight DMS email templates, and checks that the email bundle excludes browser-only modules. Each check is one line that ends in ✔ or ✖, and the run ends with `Verified <n> modules` and its duration, or with the first failure: a type or Vite error points at the file in the package you passed (`./frontend-vue/app/components/Callout.vue:17:7`), not at its copy in the workspace, and the command exits 1. `--verbose` streams the pnpm, Vite and `vue-tsc` output. The workspace is removed when the run ends. It does not start a backend or publish packages. Repository development can invoke the same runner with `DMS_LAYER_SOURCE` through `pnpm test:real-source`.
488
+ The checks look for what the core layer ships: its lazily loaded chart and rich-text libraries, the pages every DMS serves and its e-mail templates. A `--layer` that holds no core layer, such as a project's own `frontend-vue`, is refused before anything is installed, with exit code 2 and the command that verifies the same folder with `--module` instead.
489
+
490
+ A supplied package whose declared range excludes this adapter version is refused before anything is installed (see [Declaring the loader releases a module supports](#declaring-the-loader-releases-a-module-supports)). The verifier generates a temporary workspace, installs it, builds client, SSR, and email bundles, checks what the client bundle loads, runs `vue-tsc`, renders eight DMS email templates, and checks that the email bundle excludes browser-only modules. Each check is one line that ends in ✔ or ✖, and the run ends with `Verified <n> modules` and its duration, or with the first failure: a type or Vite error points at the file in the package you passed (`./frontend-vue/app/components/Callout.vue:17:7`), not at its copy in the workspace, and the command exits 1. `--verbose` streams the pnpm, Vite and `vue-tsc` output. The workspace is removed when the run ends. It does not start a backend or publish packages. Repository development can invoke the same runner through `pnpm test:real-source`, with `DMS_LAYER_SOURCE` set to a core layer root and `DMS_MODULE_SOURCES` to a JSON array of module roots.
476
491
 
477
492
  Refresh rotation is single-flight within one frontend process. Horizontally scaled deployments must use sticky routing so a browser reaches the same process, or replace this process-local behavior with an external session adapter. It does not provide a distributed rotation guarantee.
@@ -9,8 +9,6 @@ const node_path_1 = require("node:path");
9
9
  const cli_1 = require("@antelopejs/core/cli");
10
10
  const common_1 = require("../common");
11
11
  const verify_source_result_1 = require("../verify-source-result");
12
- const COMMAND_PATH = "ajs dms verify-source";
13
- const LAYER_OPTION = "-l, --layer <path>";
14
12
  function localPackageSeparator(value) {
15
13
  const separator = value.indexOf("=");
16
14
  return separator <= 0 || separator === value.length - 1 ? -1 : separator;
@@ -37,15 +35,10 @@ function directoryProblem(path, label) {
37
35
  return undefined;
38
36
  return { title: `${label} not found: ${path}`, fixes: [verify_source_result_1.LAYER_PATH_FIX] };
39
37
  }
40
- const MISSING_LAYER = {
41
- title: `Required option '${LAYER_OPTION}' not specified`,
42
- reason: `Usage: ${COMMAND_PATH} [options]`,
43
- fixes: [`Run ${COMMAND_PATH} --help for usage`],
44
- };
45
38
  function usageProblems(options) {
46
39
  const problems = [
47
40
  options.layer === undefined
48
- ? MISSING_LAYER
41
+ ? undefined
49
42
  : directoryProblem(options.layer, "Layer path"),
50
43
  ...(options.module ?? []).map((path) => directoryProblem(path, "Module path")),
51
44
  ...(options.localPackage ?? []).map(localPackageProblem),
@@ -71,7 +64,6 @@ function channelClosed(child) {
71
64
  async function runVerifySource(options) {
72
65
  const startedAt = Date.now();
73
66
  assertValidUsage(usageProblems(options));
74
- const layer = options.layer ?? "";
75
67
  const modules = options.module ?? [];
76
68
  const localPackages = parseLocalPackages(options.localPackage ?? []);
77
69
  const runner = (0, node_path_1.join)(__dirname, "..", `verify-source-runner${(0, node_path_1.extname)(__filename)}`);
@@ -83,7 +75,7 @@ async function runVerifySource(options) {
83
75
  stdio: ["inherit", "inherit", "inherit", "ipc"],
84
76
  env: {
85
77
  ...process.env,
86
- DMS_LAYER_SOURCE: (0, node_path_1.resolve)(layer),
78
+ DMS_LAYER_SOURCE: options.layer === undefined ? undefined : (0, node_path_1.resolve)(options.layer),
87
79
  DMS_MODULE_SOURCES: JSON.stringify(modules.map((path) => (0, node_path_1.resolve)(path))),
88
80
  DMS_LOCAL_PACKAGES: JSON.stringify(localPackages),
89
81
  },
@@ -41,20 +41,24 @@ function collectOption(value, values = []) {
41
41
  }
42
42
  const VERIFY_SOURCE_EXAMPLES = [
43
43
  {
44
- description: "A frontend package and a module that uses it",
45
- command: "ajs dms verify-source -l ../dms/frontend-vue -m ./frontend-vue",
44
+ description: "The project's frontend module: the current directory or ./frontend-vue",
45
+ command: "ajs dms verify-source",
46
46
  },
47
47
  {
48
- description: "With a local build of a package it depends on",
49
- command: "ajs dms verify-source -l . --local-package @antelopejs/dms=../dms",
48
+ description: "Frontend modules in other directories",
49
+ command: "ajs dms verify-source -m ./admin-vue -m ./shop-vue",
50
+ },
51
+ {
52
+ description: "An unpublished DMS core layer, with a local build of @antelopejs/dms",
53
+ command: "ajs dms verify-source -l . --local-package @antelopejs/dms=..",
50
54
  },
51
55
  ];
52
56
  function cmdVerifySource() {
53
57
  const command = new commander_1.Command("verify-source")
54
58
  .summary("Build and type-check unpublished frontend sources")
55
- .description("Build and type-check unpublished DMS frontend sources against this loader version, in a temporary workspace removed when the run ends. Starts no backend.")
56
- .option("-l, --layer <path>", "Root of the DMS frontend package to verify (required)")
57
- .option("-m, --module <path>", "Root of another frontend package to verify with it (repeatable)", collectOption)
59
+ .description("Build and type-check unpublished DMS frontend modules against this loader version, on top of the DMS core layer of the @antelopejs/dms installed in the project. Runs in a temporary workspace removed when the run ends, and starts no backend.")
60
+ .option("-l, --layer <path>", "Root of an unpublished DMS core layer to verify instead of the installed one")
61
+ .option("-m, --module <path>", "Root of a frontend module to verify (repeatable); without -l or -m, the current directory or ./frontend-vue", collectOption)
58
62
  .option("--local-package <name=path>", "Bind a local package into the generated workspace (repeatable)", collectOption)
59
63
  .action(async (options) => (await Promise.resolve().then(() => __importStar(require("./verify-source-action")))).runVerifySource(options));
60
64
  return (0, cli_1.withExamples)(command, VERIFY_SOURCE_EXAMPLES);
@@ -43,6 +43,7 @@ const output_1 = require("./output");
43
43
  const temporary_workspace_1 = require("./temporary-workspace");
44
44
  const typecheck_output_1 = require("./typecheck-output");
45
45
  const verify_source_result_1 = require("./verify-source-result");
46
+ const verify_source_sources_1 = require("./verify-source-sources");
46
47
  const vite_output_1 = require("./vite-output");
47
48
  const EMAIL_BUILD_SIZE_CEILING_BYTES = 256 * 1024;
48
49
  const NON_EMAIL_RUNTIME_PATTERN = /DisplayRichText|ApexCharts|Tiptap|FlowCanvas|app\/.*table|components\/table/i;
@@ -58,44 +59,6 @@ function ensure(condition, title, reason) {
58
59
  if (!condition)
59
60
  throw new cli_1.CliError({ title, reason });
60
61
  }
61
- function readLayer(root) {
62
- const packagePath = (0, node_path_1.join)(root, "package.json");
63
- if (!(0, node_fs_1.existsSync)(packagePath))
64
- throw new common_1.UsageError({
65
- title: `No package.json in ${(0, output_1.showPath)(root)}`,
66
- fixes: [verify_source_result_1.LAYER_PATH_FIX],
67
- });
68
- const { name } = readJson(packagePath);
69
- return { path: root, sourcePath: root, packageName: name };
70
- }
71
- function readSources() {
72
- const layerSource = process.env.DMS_LAYER_SOURCE;
73
- if (!layerSource)
74
- throw new common_1.UsageError({
75
- title: "DMS_LAYER_SOURCE is not set",
76
- fixes: [
77
- `Set it to the root of a DMS frontend package, or run ${verify_source_result_1.VERIFY_SOURCE_COMMAND} -l <path>`,
78
- ],
79
- });
80
- const sourceRoot = (0, node_path_1.resolve)(layerSource);
81
- if (!(0, node_fs_1.statSync)(sourceRoot, { throwIfNoEntry: false })?.isDirectory())
82
- throw new common_1.UsageError({
83
- title: `Layer path not found: ${(0, output_1.showPath)(sourceRoot)}`,
84
- fixes: [verify_source_result_1.LAYER_PATH_FIX],
85
- });
86
- const extraSources = JSON.parse(process.env.DMS_MODULE_SOURCES ?? "[]");
87
- const layerRoots = (0, node_fs_1.existsSync)((0, node_path_1.join)(sourceRoot, "dms.frontend.ts"))
88
- ? [sourceRoot]
89
- : (0, node_fs_1.readdirSync)(sourceRoot, { withFileTypes: true })
90
- .filter((entry) => entry.isDirectory())
91
- .map((entry) => (0, node_path_1.join)(sourceRoot, entry.name));
92
- if (layerRoots.length === 0)
93
- throw new common_1.UsageError({
94
- title: `No frontend package in ${(0, output_1.showPath)(sourceRoot)}`,
95
- fixes: [verify_source_result_1.LAYER_PATH_FIX],
96
- });
97
- return [...layerRoots, ...extraSources.map((root) => (0, node_path_1.resolve)(root))].map(readLayer);
98
- }
99
62
  function removeDevelopmentDependencies(root) {
100
63
  const packagePath = (0, node_path_1.join)(root, "package.json");
101
64
  if (!(0, node_fs_1.existsSync)(packagePath))
@@ -104,7 +67,7 @@ function removeDevelopmentDependencies(root) {
104
67
  delete packageData.devDependencies;
105
68
  (0, node_fs_1.writeFileSync)(packagePath, `${JSON.stringify(packageData, null, 2)}\n`);
106
69
  }
107
- function materializeWorkspace(workspace, layers) {
70
+ function materializeWorkspace(workspace, layers, localPackages) {
108
71
  const templateRoot = (0, node_path_1.join)((0, common_1.getPackageRoot)(), "templates", "vue");
109
72
  const templateFiles = (0, node_fs_1.readdirSync)(templateRoot).filter((file) => !file.startsWith("npmrc"));
110
73
  for (const file of templateFiles)
@@ -121,7 +84,6 @@ function materializeWorkspace(workspace, layers) {
121
84
  (0, common_1.writeWorkspacePackageJson)(workspace, layers);
122
85
  const packagePath = (0, node_path_1.join)(workspace, "package.json");
123
86
  const workspacePackage = readJson(packagePath);
124
- const localPackages = JSON.parse(process.env.DMS_LOCAL_PACKAGES ?? "{}");
125
87
  workspacePackage.pnpm = {
126
88
  overrides: {
127
89
  ...Object.fromEntries(layers.map((layer) => [layer.packageName, "workspace:*"])),
@@ -314,8 +276,10 @@ function describeError(error, isVerbose) {
314
276
  };
315
277
  }
316
278
  async function verifySources() {
317
- const layers = readSources();
279
+ const options = (0, verify_source_sources_1.readSourceOptions)();
280
+ const { layers, coreLayer } = (0, verify_source_sources_1.readSources)(options);
318
281
  (0, output_1.writeHeader)("verify-source", [(0, cli_1.pluralize)(layers.length, "module")]);
282
+ (0, cli_1.getProcessUi)().message("info", `Verifying against ${coreLayer}`);
319
283
  (0, common_1.assertLayersSupportRenderer)(layers);
320
284
  const workspace = (0, temporary_workspace_1.createTemporaryWorkspace)("dms-frontend-real-source-");
321
285
  const isVerbose = (0, cli_1.isVerboseRun)();
@@ -327,7 +291,7 @@ async function verifySources() {
327
291
  env: { ...process.env, [vite_output_1.VITE_LOG_LEVEL_VARIABLE]: (0, vite_output_1.viteLogLevel)(isVerbose) },
328
292
  };
329
293
  const tasks = (0, cli_1.getProcessTasks)();
330
- await tasks.run(`Materializing ${(0, cli_1.pluralize)(layers.length, "module")}`, async () => materializeWorkspace(workspace, layers), { done: `Materialized ${(0, cli_1.pluralize)(layers.length, "module")}` });
294
+ await tasks.run(`Materializing ${(0, cli_1.pluralize)(layers.length, "module")}`, async () => materializeWorkspace(workspace, layers, options.localPackages), { done: `Materialized ${(0, cli_1.pluralize)(layers.length, "module")}` });
331
295
  await (0, common_1.installDeps)(workspace, context.mapLine, ["--ignore-scripts"]);
332
296
  await buildBundles(context);
333
297
  await tasks.run("Checking the client bundle", async () => checkClientBundle(workspace), { done: "Client bundle checked", failed: "Client bundle check failed" });
@@ -0,0 +1,13 @@
1
+ import { type ResolvedLayer } from "./common";
2
+ export interface SourceOptions {
3
+ projectDir: string;
4
+ layerSource?: string;
5
+ moduleSources: string[];
6
+ localPackages: Record<string, string>;
7
+ }
8
+ export interface Sources {
9
+ layers: ResolvedLayer[];
10
+ coreLayer: string;
11
+ }
12
+ export declare function readSourceOptions(): SourceOptions;
13
+ export declare function readSources(options: SourceOptions): Sources;
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readSourceOptions = readSourceOptions;
4
+ exports.readSources = readSources;
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
+ const common_1 = require("./common");
8
+ const output_1 = require("./output");
9
+ const verify_source_result_1 = require("./verify-source-result");
10
+ const DMS_PACKAGE = "@antelopejs/dms";
11
+ const DMS_CORE_LAYER_PACKAGE = "@antelopejs/dms-frontend-vue";
12
+ const CORE_LAYER_DIRECTORY = "frontend-vue";
13
+ const FRONTEND_ENTRY = "dms.frontend.ts";
14
+ const ADD_DEV_DEPENDENCY = {
15
+ pnpm: "pnpm add -D",
16
+ npm: "npm install -D",
17
+ yarn: "yarn add -D",
18
+ bun: "bun add -d",
19
+ };
20
+ const LOCKFILES = [
21
+ ["pnpm-lock.yaml", "pnpm"],
22
+ ["package-lock.json", "npm"],
23
+ ["yarn.lock", "yarn"],
24
+ ["bun.lock", "bun"],
25
+ ["bun.lockb", "bun"],
26
+ ];
27
+ function readSourceOptions() {
28
+ return {
29
+ projectDir: process.cwd(),
30
+ layerSource: process.env.DMS_LAYER_SOURCE || undefined,
31
+ moduleSources: JSON.parse(process.env.DMS_MODULE_SOURCES ?? "[]"),
32
+ localPackages: JSON.parse(process.env.DMS_LOCAL_PACKAGES ?? "{}"),
33
+ };
34
+ }
35
+ function readManifest(packagePath) {
36
+ return JSON.parse((0, node_fs_1.readFileSync)(packagePath, "utf8"));
37
+ }
38
+ function readLayer(root) {
39
+ const packagePath = (0, node_path_1.join)(root, "package.json");
40
+ if (!(0, node_fs_1.existsSync)(packagePath))
41
+ throw new common_1.UsageError({
42
+ title: `No package.json in ${(0, output_1.showPath)(root)}`,
43
+ fixes: [verify_source_result_1.LAYER_PATH_FIX],
44
+ });
45
+ const { name } = readManifest(packagePath);
46
+ return { path: root, sourcePath: root, packageName: name };
47
+ }
48
+ function isCoreLayer(layer) {
49
+ return layer.packageName === DMS_CORE_LAYER_PACKAGE;
50
+ }
51
+ function shellArgument(path) {
52
+ return /^[\w@%+=:,./~-]+$/.test(path) ? path : JSON.stringify(path);
53
+ }
54
+ function defaultModuleRoot(projectDir) {
55
+ const root = [projectDir, (0, node_path_1.join)(projectDir, CORE_LAYER_DIRECTORY)].find((candidate) => (0, node_fs_1.existsSync)((0, node_path_1.join)(candidate, FRONTEND_ENTRY)));
56
+ if (root)
57
+ return root;
58
+ throw new common_1.UsageError({
59
+ title: "No frontend module to verify",
60
+ reason: `Neither ${(0, output_1.showPath)(projectDir)} nor its ${CORE_LAYER_DIRECTORY} directory contains ${FRONTEND_ENTRY}.`,
61
+ fixes: [
62
+ `Run the command from the frontend module, or pass its root with -m`,
63
+ ],
64
+ });
65
+ }
66
+ function packageManager(projectDir) {
67
+ for (let directory = projectDir;; directory = (0, node_path_1.dirname)(directory)) {
68
+ const packagePath = (0, node_path_1.join)(directory, "package.json");
69
+ if ((0, node_fs_1.existsSync)(packagePath)) {
70
+ const [name] = (readManifest(packagePath).packageManager ?? "").split("@");
71
+ if (name && ADD_DEV_DEPENDENCY[name])
72
+ return name;
73
+ const lockfile = LOCKFILES.find(([file]) => (0, node_fs_1.existsSync)((0, node_path_1.join)(directory, file)));
74
+ if (lockfile)
75
+ return lockfile[1];
76
+ }
77
+ if ((0, node_path_1.dirname)(directory) === directory)
78
+ return "pnpm";
79
+ }
80
+ }
81
+ function addDmsCommand(projectDir, version = "") {
82
+ return `${ADD_DEV_DEPENDENCY[packageManager(projectDir)]} ${DMS_PACKAGE}${version}`;
83
+ }
84
+ function describeDirectory(directory) {
85
+ return (0, node_path_1.resolve)(directory) === process.cwd()
86
+ ? "the current directory"
87
+ : (0, output_1.showPath)(directory);
88
+ }
89
+ function resolveDmsPackage(projectDir) {
90
+ try {
91
+ return require.resolve(`${DMS_PACKAGE}/package.json`, {
92
+ paths: [projectDir],
93
+ });
94
+ }
95
+ catch {
96
+ return undefined;
97
+ }
98
+ }
99
+ function installedCoreLayer(projectDir) {
100
+ const packagePath = resolveDmsPackage(projectDir);
101
+ if (!packagePath)
102
+ throw new common_1.UsageError({
103
+ title: `${DMS_PACKAGE} is not installed in this project`,
104
+ reason: `Frontend modules are verified on top of the DMS core layer that ${DMS_PACKAGE} ships, and Node finds no ${DMS_PACKAGE} from ${describeDirectory(projectDir)}.`,
105
+ fixes: [
106
+ `Add it as a development dependency: ${addDmsCommand(projectDir)}`,
107
+ ],
108
+ });
109
+ const { version } = readManifest(packagePath);
110
+ const root = (0, node_path_1.join)((0, node_path_1.dirname)(packagePath), CORE_LAYER_DIRECTORY);
111
+ const layer = (0, node_fs_1.existsSync)((0, node_path_1.join)(root, "package.json"))
112
+ ? readLayer(root)
113
+ : undefined;
114
+ if (!layer || !isCoreLayer(layer))
115
+ throw new common_1.UsageError({
116
+ title: `${DMS_PACKAGE} ${version} ships no DMS core layer`,
117
+ reason: `${(0, output_1.showPath)((0, node_path_1.dirname)(packagePath))} has no ${CORE_LAYER_DIRECTORY} directory holding ${DMS_CORE_LAYER_PACKAGE}.`,
118
+ fixes: [`Update it: ${addDmsCommand(projectDir, "@latest")}`],
119
+ });
120
+ return {
121
+ layers: [layer],
122
+ coreLayer: `${DMS_PACKAGE} ${version} (installed in this project)`,
123
+ };
124
+ }
125
+ function notCoreLayer(sourceRoot, layers, modules, localPackages) {
126
+ const command = [
127
+ verify_source_result_1.VERIFY_SOURCE_COMMAND,
128
+ ...[...layers, ...modules].flatMap((layer) => [
129
+ "-m",
130
+ shellArgument((0, output_1.showPath)(layer.path)),
131
+ ]),
132
+ ...Object.entries(localPackages).flatMap(([name, path]) => [
133
+ "--local-package",
134
+ shellArgument(`${name}=${(0, output_1.showPath)(path)}`),
135
+ ]),
136
+ ].join(" ");
137
+ const names = layers
138
+ .map((layer) => layer.packageName ?? "a package without a name")
139
+ .join(", ");
140
+ const shown = (0, output_1.showPath)(sourceRoot);
141
+ return {
142
+ title: `${shown} is not the DMS core layer`,
143
+ reason: `--layer is for verifying an unpublished DMS core layer, ${DMS_CORE_LAYER_PACKAGE}, and ${shown} holds ${names}. ` +
144
+ `Without it, frontend modules are verified on the core layer of the ${DMS_PACKAGE} installed in the project.`,
145
+ fixes: [`Drop -l and pass the folder with -m: ${command}`],
146
+ };
147
+ }
148
+ function readLayerSource(layerSource) {
149
+ const sourceRoot = (0, node_path_1.resolve)(layerSource);
150
+ if (!(0, node_fs_1.statSync)(sourceRoot, { throwIfNoEntry: false })?.isDirectory())
151
+ throw new common_1.UsageError({
152
+ title: `Layer path not found: ${(0, output_1.showPath)(sourceRoot)}`,
153
+ fixes: [verify_source_result_1.LAYER_PATH_FIX],
154
+ });
155
+ const roots = (0, node_fs_1.existsSync)((0, node_path_1.join)(sourceRoot, FRONTEND_ENTRY))
156
+ ? [sourceRoot]
157
+ : (0, node_fs_1.readdirSync)(sourceRoot, { withFileTypes: true })
158
+ .filter((entry) => entry.isDirectory())
159
+ .map((entry) => (0, node_path_1.join)(sourceRoot, entry.name));
160
+ if (roots.length === 0)
161
+ throw new common_1.UsageError({
162
+ title: `No frontend package in ${(0, output_1.showPath)(sourceRoot)}`,
163
+ fixes: [verify_source_result_1.LAYER_PATH_FIX],
164
+ });
165
+ return { sourceRoot, layers: roots.map(readLayer) };
166
+ }
167
+ function readSources(options) {
168
+ const { projectDir, layerSource, localPackages } = options;
169
+ const modules = (options.moduleSources.length > 0 || layerSource
170
+ ? options.moduleSources.map((root) => (0, node_path_1.resolve)(root))
171
+ : [defaultModuleRoot(projectDir)]).map(readLayer);
172
+ if (layerSource) {
173
+ const { sourceRoot, layers } = readLayerSource(layerSource);
174
+ if (!layers.some(isCoreLayer))
175
+ throw new common_1.UsageError(notCoreLayer(sourceRoot, layers, modules, localPackages));
176
+ return {
177
+ layers: [...layers, ...modules],
178
+ coreLayer: `the DMS core layer in ${(0, output_1.showPath)(sourceRoot)}`,
179
+ };
180
+ }
181
+ const passedCore = modules.find(isCoreLayer);
182
+ if (passedCore)
183
+ return {
184
+ layers: [passedCore, ...modules.filter((layer) => layer !== passedCore)],
185
+ coreLayer: `the DMS core layer in ${(0, output_1.showPath)(passedCore.path)}`,
186
+ };
187
+ const installed = installedCoreLayer(projectDir);
188
+ return { ...installed, layers: [...installed.layers, ...modules] };
189
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/dms-frontend",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "description": "Frontend-agnostic loader for AntelopeJS DMS, shipping the Vue 3 renderer (Vite, Inertia, SSR)",
5
5
  "keywords": [
6
6
  "antelope",