@silgi/module-builder 0.7.5 → 0.7.6

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.C81SXUbd.mjs';
18
+ import { v as version, n as name } from '../shared/silgi-module-builder.B-36xW1_.mjs';
19
19
 
20
20
  const subpaths = [
21
21
  "runtime",
@@ -105,8 +105,7 @@ const build = defineCommand({
105
105
  if (isTypesFolder) {
106
106
  entries.push({
107
107
  input: "src/types/index.ts",
108
- outDir: `${outDir}`,
109
- name: "types",
108
+ outDir: `${outDir}/types`,
110
109
  builder: "rollup"
111
110
  });
112
111
  }
@@ -267,7 +266,7 @@ async function writeTypes(options, _moduleMeta) {
267
266
  if (!options.stub) {
268
267
  return;
269
268
  }
270
- const dtsFile = resolve(options.outDir, "types.d.mts");
269
+ const dtsFile = resolve(options.outDir, "types/index.d.mts");
271
270
  const moduleReExports = [];
272
271
  const moduleTypesFile = resolve(options.rootDir, "src/types/index.ts");
273
272
  const moduleTypes = await promises.readFile(moduleTypesFile, "utf8").catch(() => "");
@@ -314,8 +313,9 @@ async function writeTypes(options, _moduleMeta) {
314
313
  moduleImports.push("MetaData");
315
314
  }
316
315
  let fromPath;
316
+ let prevContent;
317
317
  if (existsSync(dtsFile)) {
318
- const prevContent = await promises.readFile(dtsFile, "utf8").catch(() => "");
318
+ prevContent = await promises.readFile(dtsFile, "utf8").catch(() => "");
319
319
  const match = prevContent.match(/export\s+\*\s+from\s+["'](.+)["']/);
320
320
  if (match) {
321
321
  fromPath = match[1];
@@ -323,14 +323,19 @@ async function writeTypes(options, _moduleMeta) {
323
323
  }
324
324
  let dtsContents;
325
325
  const importFrom = fromPath || "./module.mjs";
326
- dtsContents = `${`
327
- ${moduleImports.length ? `import type { ${moduleImports.join(", ")} } from '${importFrom}'` : ""}
326
+ dtsContents = `${`${moduleImports.length ? `import type { ${moduleImports.join(", ")} } from '${importFrom}'
328
327
 
329
- ${moduleImports.length ? `
330
- export type { ${moduleImports.join(", ")} }` : ""}
331
- `.trim().replace(/[\n\r]{3,}/g, "\n\n")}
328
+ export type { ${moduleImports.join(", ")} }` : ""}`.trim()}
332
329
  `;
333
- await promises.writeFile(dtsFile, dtsContents, "utf8");
330
+ let mergedContent = dtsContents;
331
+ if (prevContent) {
332
+ const prevLines = prevContent.split("\n").map((l) => l.trim());
333
+ const newLines = dtsContents.split("\n").map((l) => l.trim());
334
+ const uniqueLines = newLines.filter((line) => line && !prevLines.includes(line));
335
+ mergedContent = `${uniqueLines.join("\n")}
336
+ ${prevContent}`;
337
+ }
338
+ await promises.writeFile(dtsFile, mergedContent, "utf8");
334
339
  }
335
340
  async function loadTSCompilerOptions(path) {
336
341
  const config = await parse(path);
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.C81SXUbd.mjs';
4
+ import { v as version, d as description, n as name } from './shared/silgi-module-builder.B-36xW1_.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.C81SXUbd.mjs';
19
+ import './shared/silgi-module-builder.B-36xW1_.mjs';
@@ -1,5 +1,5 @@
1
1
  const name = "@silgi/module-builder";
2
- const version = "0.7.5";
2
+ const version = "0.7.6";
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.5",
4
+ "version": "0.7.6",
5
5
  "private": false,
6
6
  "description": "Complete solution for building Silgi modules",
7
7
  "exports": {