@silgi/module-builder 0.4.3 → 0.4.5

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.
@@ -1,4 +1,4 @@
1
- import { existsSync, promises, writeFileSync } from 'node:fs';
1
+ import { existsSync, promises } from 'node:fs';
2
2
  import { writeFile, mkdir } from 'node:fs/promises';
3
3
  import { join } from 'node:path';
4
4
  import { fileURLToPath, pathToFileURL } from 'node:url';
@@ -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.BnM-_14B.mjs';
18
+ import { v as version, n as name } from '../shared/silgi-module-builder.CthaFlaR.mjs';
19
19
 
20
20
  const srcDir = fileURLToPath(new URL("src", import.meta.url));
21
21
  const subpaths = [
@@ -53,53 +53,9 @@ const build = defineCommand({
53
53
  async run(context) {
54
54
  const { build } = await import('unbuild');
55
55
  const cwd = resolve(context.args.cwd || context.args.rootDir || ".");
56
- let packageData = await readPackageJSON(cwd);
56
+ const packageData = await readPackageJSON(cwd);
57
57
  const jiti = createJiti(cwd);
58
58
  const outDir = context.args.outDir || "dist";
59
- function check() {
60
- if (packageData) {
61
- const expectedExports = {
62
- ".": {
63
- import: {
64
- types: "./dist/module.d.ts",
65
- default: "./dist/module.mjs"
66
- }
67
- },
68
- "./module": {
69
- types: "./dist/module.d.ts",
70
- import: "./dist/module.mjs"
71
- },
72
- "./runtime": {
73
- silgi: "./dist/runtime/index.ts",
74
- silgiTypes: "./dist/runtime/index.ts",
75
- types: "./runtime.d.ts",
76
- import: "./dist/runtime/index.mjs"
77
- },
78
- "./runtime/*": {
79
- silgi: "./dist/runtime/*.ts",
80
- silgiTypes: "./dist/runtime/*.ts",
81
- types: "./dist/runtime/*.d.ts",
82
- import: "./dist/runtime/*.mjs"
83
- }
84
- };
85
- packageData.exports = defu(packageData.exports, expectedExports);
86
- packageData = defu(packageData, {
87
- main: "./dist/module.mjs",
88
- types: "./dist/module.d.ts",
89
- scripts: {
90
- "build": "pnpm silgi-module-build build",
91
- "build:stub": "pnpm silgi-module-build build --stub",
92
- "test": "vitest",
93
- "test:coverage": "vitest run --coverage"
94
- }
95
- });
96
- }
97
- writeFileSync(resolve(cwd, "package.json"), JSON.stringify(packageData, null, 2));
98
- }
99
- if (context.args.check) {
100
- check();
101
- return;
102
- }
103
59
  const rootPkg = await readPackageJSON(join(pkgDir, "package.json"));
104
60
  await build(cwd, false, {
105
61
  declaration: "node16",
@@ -112,7 +68,7 @@ const build = defineCommand({
112
68
  entries: [
113
69
  "src/module",
114
70
  {
115
- input: "src/data",
71
+ input: "src/data/",
116
72
  outDir: `${outDir}/data`,
117
73
  addRelativeDeclarationExtensions: true,
118
74
  ext: "js",
@@ -127,10 +83,8 @@ const build = defineCommand({
127
83
  {
128
84
  input: "src/runtime/",
129
85
  outDir: `${outDir}/runtime`,
130
- builder: "mkdist",
131
- format: "esm",
132
- // addRelativeDeclarationExtensions: true,
133
- // ext: 'js',
86
+ addRelativeDeclarationExtensions: true,
87
+ ext: "js",
134
88
  pattern: [
135
89
  "**",
136
90
  "!**/*.stories.{js,cts,mts,ts,jsx,tsx}",
@@ -138,13 +92,20 @@ const build = defineCommand({
138
92
  "!**/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}"
139
93
  // ignore tests
140
94
  ]
141
- // esbuild: {
142
- // jsxImportSource: 'vue',
143
- // jsx: 'automatic',
144
- // jsxFactory: 'h',
145
- // },
146
95
  },
147
- { input: "src/types/index.ts" }
96
+ {
97
+ input: "src/types/index.ts",
98
+ outDir: `${outDir}/types`,
99
+ addRelativeDeclarationExtensions: true,
100
+ ext: "js",
101
+ pattern: [
102
+ "**",
103
+ "!**/*.stories.{js,cts,mts,ts,jsx,tsx}",
104
+ // ignore storybook files
105
+ "!**/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}"
106
+ // ignore tests
107
+ ]
108
+ }
148
109
  ],
149
110
  rollup: {
150
111
  esbuild: {
@@ -258,7 +219,7 @@ const build = defineCommand({
258
219
  "build:prepare": async function(_ctx) {
259
220
  for (const subpath of subpaths) {
260
221
  await writeFile(
261
- `./${subpath}.d.ts`,
222
+ `./${subpath}.d.mts`,
262
223
  `export * from './dist/${subpath}/index';`
263
224
  );
264
225
  }
@@ -295,7 +256,7 @@ const build = defineCommand({
295
256
  }
296
257
  });
297
258
  async function writeTypes(options, isStub, _moduleMeta) {
298
- const dtsFile = resolve(options.outDir, "moduleTypes.d.ts");
259
+ const dtsFile = resolve(options.outDir, "moduleTypes.d.mts");
299
260
  if (existsSync(dtsFile)) {
300
261
  return;
301
262
  }
@@ -384,7 +345,7 @@ export * from '${e.specifier || "./module.mjs"}'`).join("\n")}
384
345
  `.trim().replace(/[\n\r]{3,}/g, "\n\n")}
385
346
  `;
386
347
  await promises.writeFile(dtsFile, dtsContents, "utf8");
387
- await promises.writeFile(resolve(options.rootDir, "moduleTypes.d.ts"), `export * from './dist/moduleTypes';
348
+ await promises.writeFile(resolve(options.rootDir, "moduleTypes.d.mts"), `export * from './dist/moduleTypes';
388
349
  `, "utf8");
389
350
  }
390
351
  async function loadTSCompilerOptions(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.BnM-_14B.mjs';
4
+ import { v as version, d as description, n as name } from './shared/silgi-module-builder.CthaFlaR.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.BnM-_14B.mjs';
19
+ import './shared/silgi-module-builder.CthaFlaR.mjs';
@@ -1,5 +1,5 @@
1
1
  const name = "@silgi/module-builder";
2
- const version = "0.4.3";
2
+ const version = "0.4.5";
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.4.3",
4
+ "version": "0.4.5",
5
5
  "private": false,
6
6
  "description": "Complete solution for building Silgi modules",
7
7
  "exports": {