@silgi/module-builder 0.7.2 → 0.7.4

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.
@@ -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.C1cFCKRO.mjs';
18
+ import { v as version, n as name } from '../shared/silgi-module-builder.0J4PF1--.mjs';
19
19
 
20
20
  const subpaths = [
21
21
  "runtime",
@@ -105,7 +105,8 @@ 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
+ name: "types",
109
110
  builder: "rollup"
110
111
  });
111
112
  }
@@ -263,9 +264,12 @@ const build = defineCommand({
263
264
  }
264
265
  });
265
266
  async function writeTypes(options, _moduleMeta) {
266
- const dtsFile = resolve(options.outDir, "moduleTypes.d.mts");
267
+ if (!options.stub) {
268
+ return;
269
+ }
270
+ const dtsFile = resolve(options.outDir, "types.mts");
267
271
  const moduleReExports = [];
268
- const moduleTypesFile = resolve(options.rootDir, "src/module.ts");
272
+ const moduleTypesFile = resolve(options.rootDir, "src/types/index.ts");
269
273
  const moduleTypes = await promises.readFile(moduleTypesFile, "utf8").catch(() => "");
270
274
  const normalisedModuleTypes = moduleTypes.replace(/export\s*\{.*?\}/gs, (match) => match.replace(/\b(type|interface)\b/g, ""));
271
275
  for (const e of findExports(normalisedModuleTypes)) {
@@ -309,8 +313,18 @@ async function writeTypes(options, _moduleMeta) {
309
313
  if (hasTypeExport("MetaData")) {
310
314
  moduleImports.push("MetaData");
311
315
  }
312
- const dtsContents = `${`
313
- ${moduleImports.length ? `import type { ${moduleImports.join(", ")} } from './module.mjs'` : ""}
316
+ let fromPath;
317
+ if (existsSync(dtsFile)) {
318
+ const prevContent = await promises.readFile(dtsFile, "utf8").catch(() => "");
319
+ const match = prevContent.match(/export\s+\*\s+from\s+["'](.+)["']/);
320
+ if (match) {
321
+ fromPath = match[1];
322
+ }
323
+ }
324
+ let dtsContents;
325
+ const importFrom = fromPath || "./module.mjs";
326
+ dtsContents = `${`
327
+ ${moduleImports.length ? `import type { ${moduleImports.join(", ")} } from '${importFrom}'` : ""}
314
328
 
315
329
  ${moduleImports.length ? `
316
330
  export type { ${moduleImports.join(", ")} }` : ""}
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.C1cFCKRO.mjs';
4
+ import { v as version, d as description, n as name } from './shared/silgi-module-builder.0J4PF1--.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.C1cFCKRO.mjs';
19
+ import './shared/silgi-module-builder.0J4PF1--.mjs';
@@ -1,5 +1,5 @@
1
1
  const name = "@silgi/module-builder";
2
- const version = "0.7.2";
2
+ const version = "0.7.4";
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.2",
4
+ "version": "0.7.4",
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": {