@zenfs/core 1.0.6 → 1.0.7
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/backends/file_index.d.ts +1 -1
- package/dist/backends/file_index.js +1 -1
- package/package.json +4 -7
- package/readme.md +1 -1
- package/src/backends/file_index.ts +1 -1
- package/dist/browser.min.js +0 -22
- package/dist/browser.min.js.map +0 -7
- package/scripts/build.js +0 -83
package/scripts/build.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { build, context } from 'esbuild';
|
|
3
|
-
import { execSync } from 'node:child_process';
|
|
4
|
-
import { parseArgs } from 'node:util';
|
|
5
|
-
import { rmSync } from 'node:fs';
|
|
6
|
-
import { globalExternals } from '@fal-works/esbuild-plugin-global-externals';
|
|
7
|
-
|
|
8
|
-
let buildCount = 0;
|
|
9
|
-
|
|
10
|
-
const { watch, keep, quiet, globalName, entry } = parseArgs({
|
|
11
|
-
options: {
|
|
12
|
-
watch: { short: 'w', type: 'boolean', default: false },
|
|
13
|
-
keep: { short: 'k', type: 'boolean', default: false },
|
|
14
|
-
quiet: { short: 'q', type: 'boolean', default: false },
|
|
15
|
-
globalName: { type: 'string' },
|
|
16
|
-
entry: { type: 'string' },
|
|
17
|
-
},
|
|
18
|
-
strict: false,
|
|
19
|
-
allowPositionals: true,
|
|
20
|
-
}).values;
|
|
21
|
-
|
|
22
|
-
async function exportsOf(name) {
|
|
23
|
-
return Object.keys(await import(name)).filter(key => key != 'default');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const plugins = [
|
|
27
|
-
{
|
|
28
|
-
name: 'tsc+counter',
|
|
29
|
-
setup({ onStart, onEnd }) {
|
|
30
|
-
onStart(start);
|
|
31
|
-
|
|
32
|
-
if (watch && !quiet) {
|
|
33
|
-
onEnd(() => console.log(`--------------- Built #${buildCount}`));
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
if (globalName != 'ZenFS') {
|
|
40
|
-
plugins.push(
|
|
41
|
-
globalExternals({
|
|
42
|
-
'@zenfs/core': {
|
|
43
|
-
varName: 'ZenFS',
|
|
44
|
-
namedExports: await exportsOf('@zenfs/core'),
|
|
45
|
-
},
|
|
46
|
-
})
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function start() {
|
|
51
|
-
if (!keep) {
|
|
52
|
-
rmSync('dist', { force: true, recursive: true });
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (watch && !quiet) {
|
|
56
|
-
console.log(`------------ Building #${++buildCount}`);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
execSync('npx tsc -p tsconfig.json', { stdio: 'inherit' });
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const config = {
|
|
63
|
-
entryPoints: [entry || 'src/index.ts'],
|
|
64
|
-
target: 'es2021',
|
|
65
|
-
globalName,
|
|
66
|
-
outfile: 'dist/browser.min.js',
|
|
67
|
-
sourcemap: true,
|
|
68
|
-
keepNames: true,
|
|
69
|
-
bundle: true,
|
|
70
|
-
minify: true,
|
|
71
|
-
platform: 'browser',
|
|
72
|
-
plugins,
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
if (watch) {
|
|
76
|
-
if (!quiet) {
|
|
77
|
-
console.log('Watching for changes...');
|
|
78
|
-
}
|
|
79
|
-
const ctx = await context(config);
|
|
80
|
-
await ctx.watch();
|
|
81
|
-
} else {
|
|
82
|
-
await build(config);
|
|
83
|
-
}
|