@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.
package/dist/chunks/build.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
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.
|
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:
|
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
|
-
|
118
|
-
|
119
|
-
pattern: [
|
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
|
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
|
362
|
-
export { ${
|
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.
|
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
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@silgi/module-builder",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.4.
|
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.
|
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.
|
26
|
+
"silgi": "^0.28.1",
|
27
27
|
"tsconfck": "^3.1.5",
|
28
28
|
"unbuild": "^3.5.0",
|
29
|
-
"unimport": "^
|
29
|
+
"unimport": "^5.0.0"
|
30
30
|
},
|
31
31
|
"devDependencies": {
|
32
|
-
"@antfu/eslint-config": "^4.
|
33
|
-
"@types/node": "^22.
|
34
|
-
"eslint": "^9.
|
35
|
-
"typescript": "^5.8.
|
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"
|