@nuxt/module-builder 0.7.0 → 0.7.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/README.md CHANGED
@@ -131,7 +131,7 @@ Module builder generates dist files in `dist/` directory:
131
131
  - `module.cjs`: ESM proxy to allow require module in CommonJS context
132
132
  - `types.d.ts`: Exported types in addition to shims for `nuxt.config` auto completion.
133
133
  - `runtime/*`: Individually transformed files using [unjs/mkdist](https://github.com/unjs/mkdist)
134
- - Javascript and `.ts` files will be transformed to `.mjs` with extracted types on `.d.ts` file with same name
134
+ - Javascript and `.ts` files will be transformed to `.js` with extracted types on `.d.ts` file with same name
135
135
  - `.vue` files will be transformed with extracted `.d.ts` file
136
136
  - Other files will be copied as is
137
137
 
@@ -11,7 +11,7 @@ import { resolvePath, findExports } from 'mlly';
11
11
  import { generateTypes, resolveSchema } from 'untyped';
12
12
  import { defineCommand } from 'citty';
13
13
  import { loadNuxt } from '@nuxt/kit';
14
- import { n as name, v as version } from '../shared/module-builder.4be2741e.mjs';
14
+ import { n as name, v as version } from '../shared/module-builder.832f08b1.mjs';
15
15
 
16
16
  const build = defineCommand({
17
17
  meta: {
@@ -179,13 +179,16 @@ async function writeTypes(distDir, meta, getOptions) {
179
179
  const appShims = [];
180
180
  const schemaShims = [];
181
181
  const moduleImports = [];
182
+ const moduleDeclarations = [];
182
183
  const hasTypeExport = (name2) => isStub || typeExports.find((exp) => exp.names.includes(name2));
183
- if (meta.configKey && hasTypeExport("ModuleOptions")) {
184
- moduleImports.push("ModuleOptions");
184
+ if (meta.configKey) {
185
185
  schemaShims.push(` interface NuxtConfig { ['${meta.configKey}']?: Partial<ModuleOptions> }`);
186
186
  schemaShims.push(` interface NuxtOptions { ['${meta.configKey}']?: ModuleOptions }`);
187
- } else if (meta.configKey) {
188
- schemaShims.push(` ${generateTypes(await resolveSchema(await getOptions()), { interfaceName: "ModuleOptions" })}`);
187
+ if (hasTypeExport("ModuleOptions")) {
188
+ moduleImports.push("ModuleOptions");
189
+ } else {
190
+ moduleDeclarations.push(` ${generateTypes(await resolveSchema(await getOptions()), { interfaceName: "ModuleOptions" })}`);
191
+ }
189
192
  }
190
193
  if (hasTypeExport("ModuleHooks")) {
191
194
  moduleImports.push("ModuleHooks");
@@ -210,6 +213,7 @@ async function writeTypes(distDir, meta, getOptions) {
210
213
  const dtsContents = `
211
214
  import type { ${moduleImports.join(", ")} } from './module'
212
215
 
216
+ ${moduleDeclarations.join("\n")}
213
217
  ${appShims.length ? `declare module '#app' {
214
218
  ${appShims.join("\n")}
215
219
  }
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.4be2741e.mjs';
4
+ import { n as name, d as description, v as version } from './shared/module-builder.832f08b1.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
@@ -13,4 +13,4 @@ import 'mlly';
13
13
  import 'untyped';
14
14
  import 'citty';
15
15
  import '@nuxt/kit';
16
- import './shared/module-builder.4be2741e.mjs';
16
+ import './shared/module-builder.832f08b1.mjs';
@@ -1,5 +1,5 @@
1
1
  const name = "@nuxt/module-builder";
2
- const version = "0.7.0";
2
+ const version = "0.7.1";
3
3
  const description = "Complete solution for building Nuxt modules";
4
4
 
5
5
  export { description as d, name as n, version as v };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/module-builder",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "repository": "nuxt/module-builder",
5
5
  "description": "Complete solution for building Nuxt modules",
6
6
  "license": "MIT",
@@ -24,36 +24,36 @@
24
24
  "consola": "^3.2.3",
25
25
  "defu": "^6.1.4",
26
26
  "magic-regexp": "^0.8.0",
27
- "mlly": "^1.7.0",
27
+ "mlly": "^1.7.1",
28
28
  "pathe": "^1.1.2",
29
29
  "pkg-types": "^1.1.1",
30
- "tsconfck": "^3.0.3",
30
+ "tsconfck": "^3.1.0",
31
31
  "unbuild": "^2.0.0",
32
32
  "untyped": "^1.4.2"
33
33
  },
34
34
  "peerDependencies": {
35
- "@nuxt/kit": "^3.11.2",
36
- "nuxi": "^3.11.1"
35
+ "@nuxt/kit": "^3.12.1",
36
+ "nuxi": "^3.12.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@nuxt/eslint-config": "^0.3.13",
40
- "@nuxt/kit": "^3.11.2",
41
- "@nuxt/schema": "^3.11.2",
42
- "@types/node": "^20.12.12",
40
+ "@nuxt/kit": "^3.12.1",
41
+ "@nuxt/schema": "^3.12.1",
42
+ "@types/node": "^20.14.2",
43
43
  "@vitest/coverage-v8": "^1.6.0",
44
44
  "changelogen": "^0.5.5",
45
- "eslint": "^9.3.0",
46
- "jiti": "^1.21.0",
47
- "nuxi": "^3.11.1",
48
- "nuxt": "^3.11.2",
45
+ "eslint": "^9.4.0",
46
+ "jiti": "^1.21.6",
47
+ "nuxi": "^3.12.0",
48
+ "nuxt": "^3.12.1",
49
49
  "typescript": "^5.4.5",
50
50
  "vitest": "^1.6.0",
51
51
  "vue": "^3.4.27",
52
52
  "vue-tsc": "^2.0.19"
53
53
  },
54
54
  "resolutions": {
55
- "@nuxt/kit": "^3.11.2",
56
- "@nuxt/schema": "^3.11.2",
55
+ "@nuxt/kit": "^3.12.1",
56
+ "@nuxt/schema": "^3.12.1",
57
57
  "vue": "^3.4.27"
58
58
  },
59
59
  "scripts": {