vona-cli-set-api 1.1.125 → 1.1.127

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/dist/index.js CHANGED
@@ -315,7 +315,11 @@ class CliBinBuild extends BeanCliBase {
315
315
  } = await generateVonaMeta(configMeta, configOptions);
316
316
  const outDir = path.join(projectPath, getOutDir());
317
317
  await rimraf(outDir);
318
- await this._rollup(projectPath, env, outDir);
318
+ const {
319
+ externals,
320
+ allowBuilds
321
+ } = await this._rollup(projectPath, env, modulesMeta, outDir);
322
+ await this._packageJson(projectPath, outDir, externals, allowBuilds);
319
323
  await this._assets(projectPath, modulesMeta, outDir);
320
324
  // custom
321
325
  await this._custom(projectPath, env, outDir);
@@ -339,6 +343,24 @@ class CliBinBuild extends BeanCliBase {
339
343
  fse.copySync(outDir, outReleasesDirCopy);
340
344
  }
341
345
  }
346
+ async _packageJson(_projectPath, outDir, externals, allowBuilds) {
347
+ // package.json
348
+ const dependencies = {};
349
+ for (const name of Object.keys(externals).sort()) {
350
+ const version = externals[name];
351
+ if (!version) throw new Error(`external dependency version not found: ${name}`);
352
+ dependencies[name] = version;
353
+ }
354
+ const pkgContent = {
355
+ type: 'module',
356
+ dependencies
357
+ };
358
+ await fse.writeFile(path.join(outDir, 'package.json'), `${JSON.stringify(pkgContent, null, 2)}\n`);
359
+ // pnpm-workspace.yaml
360
+ const nativeBuildDepsAllowList = Object.keys(allowBuilds);
361
+ const content = ['allowBuilds:', ...nativeBuildDepsAllowList.map(name => ` ${name}: true`), ''].join('\n');
362
+ await fse.writeFile(path.join(outDir, 'pnpm-workspace.yaml'), content);
363
+ }
342
364
  async _custom(projectPath, env, outDir) {
343
365
  // custom
344
366
  const jsFile = path.join(projectPath, 'src/backend/cli.ts');
@@ -372,7 +394,7 @@ class CliBinBuild extends BeanCliBase {
372
394
  glob: true
373
395
  });
374
396
  }
375
- async _rollup(projectPath, env, outDir) {
397
+ async _rollup(projectPath, env, modulesMeta, outDir) {
376
398
  const aliasEntries = [];
377
399
  const dialectDrivers = (process.env.BUILD_DIALECT_DRIVERS || '').split(',');
378
400
  for (const name of __dialectDriversAll) {
@@ -384,6 +406,32 @@ class CliBinBuild extends BeanCliBase {
384
406
  }
385
407
  const sourceMap = process.env.BUILD_SOURCEMAP === 'true';
386
408
  const replaceValues = generateConfigDefine(env, ['NODE_ENV', 'META_MODE', 'META_FLAVOR']);
409
+ for (const relativeName in modulesMeta.modules) {
410
+ const module = modulesMeta.modules[relativeName];
411
+ const replacesModule = module.package.vonaModule?.bundle?.replaces;
412
+ if (!replacesModule) continue;
413
+ for (const replaceModule of replacesModule) {
414
+ replaceValues[replaceModule[0]] = replaceModule[1];
415
+ }
416
+ }
417
+ const externals = {};
418
+ for (const relativeName in modulesMeta.modules) {
419
+ const module = modulesMeta.modules[relativeName];
420
+ const externalsModule = module.package.vonaModule?.bundle?.externals;
421
+ if (!externalsModule) continue;
422
+ for (const external of externalsModule) {
423
+ externals[external] = module.package.dependencies[external];
424
+ }
425
+ }
426
+ const allowBuilds = {};
427
+ for (const relativeName in modulesMeta.modules) {
428
+ const module = modulesMeta.modules[relativeName];
429
+ const allowBuildsModule = module.package.vonaModule?.bundle?.allowBuilds;
430
+ if (!allowBuildsModule) continue;
431
+ for (const allowBuild of allowBuildsModule) {
432
+ allowBuilds[allowBuild] = true;
433
+ }
434
+ }
387
435
  const babelPluginVonaBeanModule = getAbsolutePathOfModule('babel-plugin-vona-bean-module', '');
388
436
  const babelPluginTransformTypescriptMetadata = getAbsolutePathOfModule('babel-plugin-transform-typescript-metadata', '');
389
437
  const babelPluginProposalDecorators = getAbsolutePathOfModule('@babel/plugin-proposal-decorators', '');
@@ -428,6 +476,7 @@ class CliBinBuild extends BeanCliBase {
428
476
  const inputOptions = {
429
477
  input: path.join(projectPath, '.vona/bootstrap.ts'),
430
478
  plugins,
479
+ external: Object.keys(externals),
431
480
  onLog: (level, log, defaultHandler) => {
432
481
  if (log.code === 'CIRCULAR_DEPENDENCY' && process.env.BUILD_LOG_CIRCULAR_DEPENDENCY === 'false') {
433
482
  return;
@@ -458,6 +507,10 @@ class CliBinBuild extends BeanCliBase {
458
507
  await bundle.close();
459
508
  }
460
509
  }
510
+ return {
511
+ externals,
512
+ allowBuilds
513
+ };
461
514
  }
462
515
  }
463
516
 
@@ -10,7 +10,11 @@ declare module '@cabloy/cli' {
10
10
  export declare class CliBinBuild extends BeanCliBase {
11
11
  execute(): Promise<void>;
12
12
  _build(projectPath: string): Promise<void>;
13
+ _packageJson(_projectPath: string, outDir: string, externals: Record<string, string>, allowBuilds: Record<string, boolean>): Promise<void>;
13
14
  _custom(projectPath: string, env: NodeJS.ProcessEnv, outDir: string): Promise<any>;
14
15
  _assets(_projectPath: string, modulesMeta: Awaited<ReturnType<typeof glob>>, outDir: string): Promise<void>;
15
- _rollup(projectPath: string, env: NodeJS.ProcessEnv, outDir: string): Promise<void>;
16
+ _rollup(projectPath: string, env: NodeJS.ProcessEnv, modulesMeta: Awaited<ReturnType<typeof glob>>, outDir: string): Promise<{
17
+ externals: Record<string, string>;
18
+ allowBuilds: Record<string, true>;
19
+ }>;
16
20
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-cli-set-api",
3
- "version": "1.1.125",
4
- "gitHead": "ecaeb81d8e1aec6b3bff3d87fd5449f4f78028eb",
3
+ "version": "1.1.127",
4
+ "gitHead": "f7296d0004da7e5c173bc9149d209c2e57cab1b8",
5
5
  "description": "vona cli-set-api",
6
6
  "keywords": [
7
7
  "framework",
@@ -41,12 +41,12 @@
41
41
  "@babel/plugin-proposal-decorators": "^7.29.0",
42
42
  "@babel/plugin-transform-class-properties": "^7.28.6",
43
43
  "@babel/plugin-transform-typescript": "^7.28.6",
44
- "@cabloy/cli": "^3.1.27",
44
+ "@cabloy/cli": "^3.1.28",
45
45
  "@cabloy/dotenv": "^1.2.8",
46
46
  "@cabloy/extend": "^3.2.8",
47
- "@cabloy/module-glob": "^5.3.16",
48
- "@cabloy/module-info": "^2.0.0",
49
- "@cabloy/utils": "^2.1.25",
47
+ "@cabloy/module-glob": "^5.3.17",
48
+ "@cabloy/module-info": "^2.0.3",
49
+ "@cabloy/utils": "^2.1.26",
50
50
  "@cabloy/word-utils": "^2.1.8",
51
51
  "@lcov-viewer/cli": "^1.3.0",
52
52
  "@rollup/plugin-alias": "^5.1.1",
@@ -58,7 +58,7 @@
58
58
  "@rollup/plugin-terser": "^1.0.0",
59
59
  "@rollup/plugin-typescript": "^12.3.0",
60
60
  "babel-plugin-transform-typescript-metadata": "^0.3.2",
61
- "babel-plugin-vona-bean-module": "^1.1.6",
61
+ "babel-plugin-vona-bean-module": "^1.1.7",
62
62
  "chalk": "^3.0.0",
63
63
  "cli-table3": "^0.6.5",
64
64
  "compressing": "^1.10.4",
@@ -73,7 +73,7 @@
73
73
  "ts-node-maintained": "^10.9.6",
74
74
  "urllib": "^4.9.0",
75
75
  "uuid": "^11.1.0",
76
- "vona-core": "^5.1.30",
76
+ "vona-core": "^5.1.32",
77
77
  "why-is-node-running": "^3.2.2",
78
78
  "yargs-parser": "^22.0.0"
79
79
  }