@temir.ra/create-workspace 0.4.7 → 0.4.8
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/CHANGELOG.md +4 -0
- package/buildinfo.txt +1 -1
- package/package.json +1 -1
- package/scripts/build-bundle.ts +26 -24
package/CHANGELOG.md
CHANGED
package/buildinfo.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.4.
|
|
1
|
+
0.4.8+2a16905
|
package/package.json
CHANGED
package/scripts/build-bundle.ts
CHANGED
|
@@ -28,16 +28,14 @@ function getManifest(packageIdentifier?: string): PackageManifest {
|
|
|
28
28
|
|
|
29
29
|
const manifestPath = packageIdentifier
|
|
30
30
|
? join('node_modules', packageIdentifier, 'package.json')
|
|
31
|
-
: 'package.json'
|
|
31
|
+
: 'package.json'
|
|
32
|
+
;
|
|
32
33
|
|
|
33
34
|
let manifest: PackageManifest;
|
|
34
35
|
try {
|
|
35
36
|
manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
|
|
36
37
|
} catch {
|
|
37
|
-
|
|
38
|
-
throw new Error(`[scripts/build-bundle.ts] Could not read manifest for '${packageIdentifier}' at '${manifestPath}'.`);
|
|
39
|
-
else
|
|
40
|
-
throw new Error(`[scripts/build-bundle.ts] Could not read package manifest at '${manifestPath}'.`);
|
|
38
|
+
throw new Error(`[scripts/build-bundle.ts] Failed to read package manifest at '${manifestPath}'.`);
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
return manifest;
|
|
@@ -104,7 +102,7 @@ const cdnRewritePlugin = {
|
|
|
104
102
|
console.log(`[cdn-rewrite] '${importSpecifier}' → '${url}'`);
|
|
105
103
|
}
|
|
106
104
|
|
|
107
|
-
build.onResolve({ filter:
|
|
105
|
+
build.onResolve({ filter: /.*/ }, (args: any) => {
|
|
108
106
|
const url = resolved.get(args.path);
|
|
109
107
|
if (url) return { path: url, external: true };
|
|
110
108
|
});
|
|
@@ -116,6 +114,8 @@ const cdnRewritePlugin = {
|
|
|
116
114
|
const entrypoints = getManifestEntrypoints(getManifest());
|
|
117
115
|
console.log('[scripts/build-bundle.ts] Entrypoints:', entrypoints);
|
|
118
116
|
|
|
117
|
+
const omitIife = process.argv.includes('--omit-iife');
|
|
118
|
+
|
|
119
119
|
let buildResult;
|
|
120
120
|
|
|
121
121
|
console.log('[scripts/build-bundle.ts] Starting ESM bundle build...');
|
|
@@ -139,23 +139,25 @@ if (!buildResult.success) {
|
|
|
139
139
|
}
|
|
140
140
|
console.log('[scripts/build-bundle.ts] ESM bundle build completed successfully.');
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
142
|
+
if (!omitIife) {
|
|
143
|
+
console.log('[scripts/build-bundle.ts] Starting IIFE bundle build...');
|
|
144
|
+
buildResult = await Bun.build({
|
|
145
|
+
entrypoints,
|
|
146
|
+
outdir: 'dist',
|
|
147
|
+
naming: '[dir]/[name].iife.[ext]',
|
|
148
|
+
target: 'browser',
|
|
149
|
+
format: 'iife',
|
|
150
|
+
minify: true,
|
|
151
|
+
sourcemap: 'external',
|
|
152
|
+
plugins: [cdnRewritePlugin],
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
if (!buildResult.success) {
|
|
156
|
+
console.error('[scripts/build-bundle.ts] Build failed:');
|
|
157
|
+
for (const message of buildResult.logs) {
|
|
158
|
+
console.error(message);
|
|
159
|
+
}
|
|
160
|
+
process.exit(1);
|
|
158
161
|
}
|
|
159
|
-
|
|
162
|
+
console.log('[scripts/build-bundle.ts] IIFE bundle build completed successfully.');
|
|
160
163
|
}
|
|
161
|
-
console.log('[scripts/build-bundle.ts] IIFE bundle build completed successfully.');
|