@silgi/module-builder 0.4.3 → 0.4.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.
package/dist/chunks/build.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { existsSync, promises
|
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.
|
18
|
+
import { v as version, n as name } from '../shared/silgi-module-builder.B__EJalk.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
|
-
|
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
|
-
|
131
|
-
|
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
|
-
{
|
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: {
|
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.
|
4
|
+
import { v as version, d as description, n as name } from './shared/silgi-module-builder.B__EJalk.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