@silgi/module-builder 0.7.1 → 0.7.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.
@@ -7,7 +7,7 @@ import { consola } from 'consola';
7
7
  import defu from 'defu';
8
8
  import { createJiti } from 'jiti';
9
9
  import { createRegExp, anyOf } from 'magic-regexp';
10
- import { resolvePath, findExports, findTypeExports } from 'mlly';
10
+ import { resolvePath } from 'mlly';
11
11
  import { resolve, basename, normalize, dirname } from 'pathe';
12
12
  import { filename } from 'pathe/utils';
13
13
  import { readPackageJSON } from 'pkg-types';
@@ -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.BNHMleRo.mjs';
18
+ import { v as version, n as name } from '../shared/silgi-module-builder.CeW3fdq4.mjs';
19
19
 
20
20
  const subpaths = [
21
21
  "runtime",
@@ -61,7 +61,7 @@ const build = defineCommand({
61
61
  ...Object.fromEntries(
62
62
  subpaths.map((subpath) => [
63
63
  `${packageData.name}/${subpath}`,
64
- resolve(cwd, `${subpath}/index.ts`)
64
+ resolve(cwd, `src/${subpath}/index.ts`)
65
65
  ])
66
66
  )
67
67
  }
@@ -105,7 +105,7 @@ const build = defineCommand({
105
105
  if (isTypesFolder) {
106
106
  entries.push({
107
107
  input: "src/types/index.ts",
108
- outDir: `${outDir}/types`,
108
+ outDir: `${outDir}`,
109
109
  builder: "rollup"
110
110
  });
111
111
  }
@@ -229,7 +229,6 @@ const build = defineCommand({
229
229
  };
230
230
  const metaFile = resolve(ctx.options.outDir, "module.json");
231
231
  await promises.writeFile(metaFile, JSON.stringify(moduleMeta, null, 2), "utf8");
232
- await writeTypes(ctx.options);
233
232
  },
234
233
  "build:done": async function(ctx) {
235
234
  const logs = [...ctx.warnings].filter((l) => l.startsWith("Potential missing package.json files:"));
@@ -252,7 +251,7 @@ const build = defineCommand({
252
251
  ...Object.fromEntries(
253
252
  subpaths.map((subpath) => [
254
253
  `${packageData.name}/${subpath}`,
255
- resolve(cwd, `${subpath}/index.ts`)
254
+ resolve(cwd, `src/${subpath}/index.ts`)
256
255
  ])
257
256
  )
258
257
  }
@@ -262,62 +261,6 @@ const build = defineCommand({
262
261
  });
263
262
  }
264
263
  });
265
- async function writeTypes(options, _moduleMeta) {
266
- const dtsFile = resolve(options.outDir, "moduleTypes.d.mts");
267
- const moduleReExports = [];
268
- const moduleTypesFile = resolve(options.rootDir, "src/module.ts");
269
- const moduleTypes = await promises.readFile(moduleTypesFile, "utf8").catch(() => "");
270
- const normalisedModuleTypes = moduleTypes.replace(/export\s*\{.*?\}/gs, (match) => match.replace(/\b(type|interface)\b/g, ""));
271
- for (const e of findExports(normalisedModuleTypes)) {
272
- moduleReExports.push(e);
273
- }
274
- for (const i of findTypeExports(normalisedModuleTypes)) {
275
- moduleReExports.push(i);
276
- }
277
- const moduleImports = [];
278
- const hasTypeExport = (name2) => moduleReExports.find((exp) => exp.names?.includes(name2));
279
- if (hasTypeExport("ModuleOptions")) {
280
- moduleImports.push("ModuleOptions");
281
- }
282
- if (hasTypeExport("ModuleRuntimeOptions")) {
283
- moduleImports.push("ModuleRuntimeOptions");
284
- }
285
- if (hasTypeExport("ModuleRuntimeShareds")) {
286
- moduleImports.push("ModuleRuntimeShareds");
287
- }
288
- if (hasTypeExport("ModuleEvents")) {
289
- moduleImports.push("ModuleEvents");
290
- }
291
- if (hasTypeExport("ModuleRuntimeContexts")) {
292
- moduleImports.push("ModuleRuntimeContexts");
293
- }
294
- if (hasTypeExport("ModuleHooks")) {
295
- moduleImports.push("ModuleHooks");
296
- }
297
- if (hasTypeExport("ModuleRuntimeHooks")) {
298
- moduleImports.push("ModuleRuntimeHooks");
299
- }
300
- if (hasTypeExport("SetupModuleOption")) {
301
- moduleImports.push("SetupModuleOption");
302
- }
303
- if (hasTypeExport("ModuleRuntimeMethods")) {
304
- moduleImports.push("ModuleRuntimeMethods");
305
- }
306
- if (hasTypeExport("RouteRules")) {
307
- moduleImports.push("RouteRules");
308
- }
309
- if (hasTypeExport("MetaData")) {
310
- moduleImports.push("MetaData");
311
- }
312
- const dtsContents = `${`
313
- ${moduleImports.length ? `import type { ${moduleImports.join(", ")} } from './module.mjs'` : ""}
314
-
315
- ${moduleImports.length ? `
316
- export type { ${moduleImports.join(", ")} }` : ""}
317
- `.trim().replace(/[\n\r]{3,}/g, "\n\n")}
318
- `;
319
- await promises.writeFile(dtsFile, dtsContents, "utf8");
320
- }
321
264
  async function loadTSCompilerOptions(path) {
322
265
  const config = await parse(path);
323
266
  const resolvedCompilerOptions = config?.tsconfig.compilerOptions || {};
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.BNHMleRo.mjs';
4
+ import { v as version, d as description, n as name } from './shared/silgi-module-builder.CeW3fdq4.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.BNHMleRo.mjs';
19
+ import './shared/silgi-module-builder.CeW3fdq4.mjs';
@@ -1,5 +1,5 @@
1
1
  const name = "@silgi/module-builder";
2
- const version = "0.7.1";
2
+ const version = "0.7.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.7.1",
4
+ "version": "0.7.3",
5
5
  "private": false,
6
6
  "description": "Complete solution for building Silgi modules",
7
7
  "exports": {
@@ -23,15 +23,15 @@
23
23
  "mlly": "^1.7.4",
24
24
  "pathe": "^2.0.3",
25
25
  "pkg-types": "^2.1.0",
26
- "silgi": "^0.39.0",
27
- "tsconfck": "^3.1.5",
26
+ "silgi": "^0.41.40",
27
+ "tsconfck": "^3.1.6",
28
28
  "unbuild": "^3.5.0",
29
29
  "unimport": "^5.0.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@antfu/eslint-config": "^4.13.0",
33
- "@types/node": "^22.15.17",
34
- "eslint": "^9.26.0",
32
+ "@antfu/eslint-config": "^4.13.2",
33
+ "@types/node": "^22.15.21",
34
+ "eslint": "^9.27.0",
35
35
  "typescript": "^5.8.3"
36
36
  },
37
37
  "publishConfig": {