@silgi/module-builder 0.4.1 → 0.4.3

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.
@@ -1,4 +1,4 @@
1
- import { promises, existsSync, writeFileSync } from 'node:fs';
1
+ import { existsSync, promises, writeFileSync } from 'node:fs';
2
2
  import { writeFile, mkdir } from 'node:fs/promises';
3
3
  import { join } from 'node:path';
4
4
  import { fileURLToPath, pathToFileURL } from 'node:url';
@@ -15,7 +15,7 @@ import { pkgDir } from 'silgi/runtime/meta';
15
15
  import { parse } from 'tsconfck';
16
16
  import { convertCompilerOptionsFromJson } from 'typescript';
17
17
  import { scanExports } from 'unimport';
18
- import { v as version, n as name } from '../shared/silgi-module-builder.B3dUnesr.mjs';
18
+ import { v as version, n as name } from '../shared/silgi-module-builder.BnM-_14B.mjs';
19
19
 
20
20
  const srcDir = fileURLToPath(new URL("src", import.meta.url));
21
21
  const subpaths = [
@@ -102,7 +102,7 @@ const build = defineCommand({
102
102
  }
103
103
  const rootPkg = await readPackageJSON(join(pkgDir, "package.json"));
104
104
  await build(cwd, false, {
105
- declaration: true,
105
+ declaration: "node16",
106
106
  sourcemap: context.args.sourcemap,
107
107
  stub: context.args.stub,
108
108
  outDir,
@@ -114,9 +114,15 @@ const build = defineCommand({
114
114
  {
115
115
  input: "src/data",
116
116
  outDir: `${outDir}/data`,
117
- builder: "mkdist",
118
- format: "esm",
119
- pattern: ["**", "!**/*.stories.{js,cts,mts,ts,jsx,tsx}", "!**/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}"]
117
+ addRelativeDeclarationExtensions: true,
118
+ ext: "js",
119
+ pattern: [
120
+ "**",
121
+ "!**/*.stories.{js,cts,mts,ts,jsx,tsx}",
122
+ // ignore storybook files
123
+ "!**/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}"
124
+ // ignore tests
125
+ ]
120
126
  },
121
127
  {
122
128
  input: "src/runtime/",
@@ -256,6 +262,19 @@ const build = defineCommand({
256
262
  `export * from './dist/${subpath}/index';`
257
263
  );
258
264
  }
265
+ },
266
+ "build:done": async function(ctx) {
267
+ const logs = [...ctx.warnings].filter((l) => l.startsWith("Potential missing package.json files:"));
268
+ if (logs.filter((l) => l.match(/\.d\.ts/)).length > 0) {
269
+ consola.warn(`@silgi/module-builder\` will no longer generate \`.d.ts\` declaration files. You can update these paths to use the \`.d.mts\` extension instead.`);
270
+ }
271
+ if (logs.filter((l) => l.match(/module\.cjs/)).length > 0) {
272
+ consola.warn(`@silgi/module-builder\` will no longer generate \`module.cjs\` as this is not required for Nuxt v3+. You can safely remove replace this with \`module.mjs\` in your \`package.json\`.`);
273
+ }
274
+ const pkg = await readPackageJSON(cwd);
275
+ if (pkg?.types && !existsSync(resolve(cwd, pkg.types))) {
276
+ consola.warn(`Please remove the \`types\` field from package.json as it is no longer required for Bundler TypeScript module resolution. Instead, you can use \`typesVersions\` to support subpath export types for Node10, if required.`);
277
+ }
259
278
  }
260
279
  },
261
280
  stubOptions: {
@@ -312,7 +331,7 @@ async function writeTypes(options, isStub, _moduleMeta) {
312
331
  }
313
332
  if (hasTypeExport("ModuleRuntimeShareds")) {
314
333
  moduleImports.push("ModuleRuntimeShareds");
315
- schemaShims.push(" interface SilgiRuntimeSharedExtends extends ModuleRuntimeShareds {}");
334
+ schemaShims.push(" interface SilgiRuntimeSharedsExtend extends ModuleRuntimeShareds {}");
316
335
  }
317
336
  if (hasTypeExport("ModuleEvents")) {
318
337
  moduleImports.push("ModuleEvents");
@@ -358,8 +377,10 @@ ${schemaShims.join("\n")}
358
377
  ${moduleExports.length ? `
359
378
  ${moduleExports.join("\n")}` : ""}
360
379
  ${isStub ? 'export * from "./module.mjs"' : ""}
361
- ${moduleReExports[0] ? `
362
- export { ${moduleReExports[0].names.map((n) => (n === "default" ? "" : "type ") + n).join(", ")} } from './module.mjs'` : ""}
380
+ ${moduleReExports.filter((e) => e.type === "named" || e.type === "default").map((e) => `
381
+ export { ${e.names.map((n) => (n === "default" ? "" : "type ") + n).join(", ")} } from '${e.specifier || "./module.mjs"}'`).join("\n")}
382
+ ${moduleReExports.filter((e) => e.type === "star").map((e) => `
383
+ export * from '${e.specifier || "./module.mjs"}'`).join("\n")}
363
384
  `.trim().replace(/[\n\r]{3,}/g, "\n\n")}
364
385
  `;
365
386
  await promises.writeFile(dtsFile, dtsContents, "utf8");
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { defineCommand, runMain } from 'citty';
3
3
  import { consola } from 'consola';
4
- import { v as version, d as description, n as name } from './shared/silgi-module-builder.B3dUnesr.mjs';
4
+ import { v as version, d as description, n as name } from './shared/silgi-module-builder.BnM-_14B.mjs';
5
5
 
6
6
  const _rDefault = (r) => r && typeof r === "object" && "default" in r ? r.default : r;
7
7
  const main = defineCommand({
package/dist/index.mjs CHANGED
@@ -16,4 +16,4 @@ import 'silgi/runtime/meta';
16
16
  import 'tsconfck';
17
17
  import 'typescript';
18
18
  import 'unimport';
19
- import './shared/silgi-module-builder.B3dUnesr.mjs';
19
+ import './shared/silgi-module-builder.BnM-_14B.mjs';
@@ -1,5 +1,5 @@
1
1
  const name = "@silgi/module-builder";
2
- const version = "0.4.1";
2
+ const version = "0.4.3";
3
3
  const description = "Complete solution for building Silgi modules";
4
4
 
5
5
  export { description as d, name as n, version as v };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@silgi/module-builder",
3
3
  "type": "module",
4
- "version": "0.4.1",
4
+ "version": "0.4.3",
5
5
  "private": false,
6
6
  "description": "Complete solution for building Silgi modules",
7
7
  "exports": {
@@ -19,20 +19,20 @@
19
19
  "consola": "^3.4.2",
20
20
  "defu": "^6.1.4",
21
21
  "dev-jiti": "^2.4.2",
22
- "magic-regexp": "^0.8.0",
22
+ "magic-regexp": "^0.9.0",
23
23
  "mlly": "^1.7.4",
24
24
  "pathe": "^2.0.3",
25
25
  "pkg-types": "^2.1.0",
26
- "silgi": "^0.24.0",
26
+ "silgi": "^0.28.1",
27
27
  "tsconfck": "^3.1.5",
28
28
  "unbuild": "^3.5.0",
29
- "unimport": "^4.1.2"
29
+ "unimport": "^5.0.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@antfu/eslint-config": "^4.11.0",
33
- "@types/node": "^22.13.11",
34
- "eslint": "^9.23.0",
35
- "typescript": "^5.8.2"
32
+ "@antfu/eslint-config": "^4.12.0",
33
+ "@types/node": "^22.14.1",
34
+ "eslint": "^9.25.0",
35
+ "typescript": "^5.8.3"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"