@nuxt/module-builder 0.8.0 → 0.8.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/dist/chunks/build.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { createRegExp, anyOf } from 'magic-regexp';
|
|
|
9
9
|
import { consola } from 'consola';
|
|
10
10
|
import { resolvePath, findExports } from 'mlly';
|
|
11
11
|
import { defineCommand } from 'citty';
|
|
12
|
-
import { n as name, v as version } from '../shared/module-builder.
|
|
12
|
+
import { n as name, v as version } from '../shared/module-builder.78aa584a.mjs';
|
|
13
13
|
|
|
14
14
|
const build = defineCommand({
|
|
15
15
|
meta: {
|
|
@@ -142,28 +142,27 @@ const build = defineCommand({
|
|
|
142
142
|
};
|
|
143
143
|
const metaFile = resolve(ctx.options.outDir, "module.json");
|
|
144
144
|
await promises.writeFile(metaFile, JSON.stringify(moduleMeta, null, 2), "utf8");
|
|
145
|
-
await writeTypes(ctx.options.outDir);
|
|
145
|
+
await writeTypes(ctx.options.outDir, ctx.options.stub);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
});
|
|
151
|
-
async function writeTypes(distDir) {
|
|
151
|
+
async function writeTypes(distDir, isStub) {
|
|
152
152
|
const dtsFile = resolve(distDir, "types.d.ts");
|
|
153
153
|
const dtsFileMts = resolve(distDir, "types.d.mts");
|
|
154
154
|
if (existsSync(dtsFile)) {
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
moduleTypes.replace(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const isStub = moduleTypes.includes("export *");
|
|
157
|
+
const moduleReExports = [];
|
|
158
|
+
if (!isStub) {
|
|
159
|
+
const moduleTypesFile = resolve(distDir, "module.d.ts");
|
|
160
|
+
const moduleTypes = await promises.readFile(moduleTypesFile, "utf8").catch(() => "");
|
|
161
|
+
const normalisedModuleTypes = moduleTypes.replace(/export\s*\{.*?\}/gs, (match) => match.replace(/\b(type|interface)\b/g, ""));
|
|
162
|
+
for (const e of findExports(normalisedModuleTypes)) {
|
|
163
|
+
moduleReExports.push(e);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
167
166
|
const appShims = [];
|
|
168
167
|
const schemaShims = [];
|
|
169
168
|
const moduleImports = [];
|
|
@@ -214,6 +213,7 @@ ${schemaShims.join("\n")}
|
|
|
214
213
|
` : ""}
|
|
215
214
|
${moduleExports.length ? `
|
|
216
215
|
${moduleExports.join("\n")}` : ""}
|
|
216
|
+
${isStub ? 'export * from "./module"' : ""}
|
|
217
217
|
${moduleReExports[0] ? `
|
|
218
218
|
export { ${moduleReExports[0].names.map((n) => (n === "default" ? "" : "type ") + n).join(", ")} } from './module'` : ""}
|
|
219
219
|
`.trim().replace(/[\n\r]{3,}/g, "\n\n") + "\n";
|
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 { n as name, d as description, v as version } from './shared/module-builder.
|
|
4
|
+
import { n as name, d as description, v as version } from './shared/module-builder.78aa584a.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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/module-builder",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"repository": "nuxt/module-builder",
|
|
5
5
|
"description": "Complete solution for building Nuxt modules",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,18 +19,6 @@
|
|
|
19
19
|
"files": [
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build": "unbuild",
|
|
24
|
-
"dev:prepare": "pnpm -r dev:prepare",
|
|
25
|
-
"example:build": "pnpm nuxt-module-build build ./example",
|
|
26
|
-
"lint": "eslint .",
|
|
27
|
-
"nuxt-module-build": "JITI_ESM_RESOLVE=1 jiti ./src/cli.ts",
|
|
28
|
-
"prepack": "pnpm build",
|
|
29
|
-
"release": "pnpm vitest run && pnpm build && changelogen --release && pnpm publish && git push --follow-tags",
|
|
30
|
-
"test": "pnpm vitest",
|
|
31
|
-
"test:types": "vue-tsc --noEmit && pnpm -r test:types"
|
|
32
|
-
},
|
|
33
|
-
"packageManager": "pnpm@9.4.0",
|
|
34
22
|
"dependencies": {
|
|
35
23
|
"citty": "^0.1.6",
|
|
36
24
|
"consola": "^3.2.3",
|
|
@@ -39,7 +27,7 @@
|
|
|
39
27
|
"mlly": "^1.7.1",
|
|
40
28
|
"pathe": "^1.1.2",
|
|
41
29
|
"pkg-types": "^1.1.1",
|
|
42
|
-
"tsconfck": "^3.1.
|
|
30
|
+
"tsconfck": "^3.1.1",
|
|
43
31
|
"unbuild": "^2.0.0"
|
|
44
32
|
},
|
|
45
33
|
"peerDependencies": {
|
|
@@ -50,21 +38,31 @@
|
|
|
50
38
|
"@nuxt/eslint-config": "^0.3.13",
|
|
51
39
|
"@nuxt/kit": "^3.12.2",
|
|
52
40
|
"@nuxt/schema": "^3.12.2",
|
|
53
|
-
"@types/node": "^20.14.
|
|
41
|
+
"@types/node": "^20.14.9",
|
|
54
42
|
"@vitest/coverage-v8": "^1.6.0",
|
|
55
43
|
"changelogen": "^0.5.5",
|
|
56
44
|
"eslint": "^9.5.0",
|
|
57
45
|
"jiti": "^1.21.6",
|
|
58
46
|
"nuxi": "^3.12.0",
|
|
59
47
|
"nuxt": "^3.12.2",
|
|
60
|
-
"typescript": "^5.
|
|
48
|
+
"typescript": "^5.5.2",
|
|
61
49
|
"vitest": "^1.6.0",
|
|
62
|
-
"vue": "^3.4.
|
|
63
|
-
"vue-tsc": "^2.0.
|
|
50
|
+
"vue": "^3.4.31",
|
|
51
|
+
"vue-tsc": "^2.0.22"
|
|
64
52
|
},
|
|
65
53
|
"resolutions": {
|
|
66
54
|
"@nuxt/kit": "^3.12.2",
|
|
67
55
|
"@nuxt/schema": "^3.12.2",
|
|
68
|
-
"vue": "^3.4.
|
|
56
|
+
"vue": "^3.4.31"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "unbuild",
|
|
60
|
+
"dev:prepare": "pnpm -r dev:prepare",
|
|
61
|
+
"example:build": "pnpm nuxt-module-build build ./example",
|
|
62
|
+
"lint": "eslint .",
|
|
63
|
+
"nuxt-module-build": "JITI_ESM_RESOLVE=1 jiti ./src/cli.ts",
|
|
64
|
+
"release": "pnpm vitest run && pnpm build && changelogen --release && pnpm publish && git push --follow-tags",
|
|
65
|
+
"test": "pnpm vitest",
|
|
66
|
+
"test:types": "vue-tsc --noEmit && pnpm -r test:types"
|
|
69
67
|
}
|
|
70
|
-
}
|
|
68
|
+
}
|