@unpackjs/core 3.9.1 → 3.9.2
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/index.js
CHANGED
|
@@ -754,7 +754,7 @@ class JsMinifyPlugin {
|
|
|
754
754
|
apply(compiler) {
|
|
755
755
|
let meta = JSON.stringify({
|
|
756
756
|
name: jsMinify_PLUGIN_NAME,
|
|
757
|
-
version: "3.9.
|
|
757
|
+
version: "3.9.2",
|
|
758
758
|
options: this.minifyOptions
|
|
759
759
|
});
|
|
760
760
|
compiler.hooks.compilation.tap(jsMinify_PLUGIN_NAME, (compilation)=>{
|
|
@@ -1586,7 +1586,7 @@ async function unpackDev(unpackConfig) {
|
|
|
1586
1586
|
...middlewares
|
|
1587
1587
|
]);
|
|
1588
1588
|
let server = new RspackDevServer(devServerOptions, compiler);
|
|
1589
|
-
await server.start(), logger_logger.greet(` ${colors.brand(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.9.
|
|
1589
|
+
await server.start(), logger_logger.greet(` ${colors.brand(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v3.9.2${unpackConfig.performance?.cache ? ' ϟ' : ''}`)} ${colors.dim('ready in')} ${colors.bold(Math.ceil(performance.now() - getUnpackStartTime()))} ${colors.dim('ms')}\n`), printServerUrls({
|
|
1590
1590
|
port,
|
|
1591
1591
|
host: unpackConfig.server.host,
|
|
1592
1592
|
base: unpackConfig.base
|
|
@@ -1600,10 +1600,10 @@ async function unpackDev(unpackConfig) {
|
|
|
1600
1600
|
function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'unpack' }) {
|
|
1601
1601
|
let _context = {
|
|
1602
1602
|
callerName,
|
|
1603
|
-
version: "3.9.
|
|
1603
|
+
version: "3.9.2",
|
|
1604
1604
|
cachePath: 'node_modules/.unpack'
|
|
1605
1605
|
}, resolveConfig = (mode)=>{
|
|
1606
|
-
let rootPath, outputPath, basePath, cachedTraceMap, fs, isValidMethodName, parseFrame, formatOriginalLocation, formatFullStack, resolveErrorLocationAndStack, shouldTransformDeepImport, preJsAssets, jsAssets, cssAssets, bundledDepsCachePath, deepImportPkgPattern, deepImportRegex, root;
|
|
1606
|
+
let rootPath, outputPath, basePath, cachedTraceMap, fs, isValidMethodName, parseFrame, formatOriginalLocation, formatFullStack, resolveErrorLocationAndStack, shouldTransformDeepImport, preJsAssets, jsAssets, cssAssets, bundledDepsCachePath, deepImportPkgPattern, deepImportRegex, plugin, root;
|
|
1607
1607
|
return {
|
|
1608
1608
|
...mergeConfig({
|
|
1609
1609
|
root: cwd,
|
|
@@ -1890,18 +1890,16 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
1890
1890
|
format(cleanedTemplate, ...rest)
|
|
1891
1891
|
];
|
|
1892
1892
|
})(formattedArgs), prefix = colors.dim(`[browser ${time}]`);
|
|
1893
|
-
switch(
|
|
1893
|
+
switch(level){
|
|
1894
1894
|
case 'error':
|
|
1895
|
-
|
|
1895
|
+
console.log(colors.red(`${prefix} ${format(...outputArgs)}`));
|
|
1896
1896
|
break;
|
|
1897
1897
|
case 'warn':
|
|
1898
|
-
|
|
1898
|
+
console.log(colors.yellow(`${prefix} ${format(...outputArgs)}`));
|
|
1899
1899
|
break;
|
|
1900
1900
|
case 'debug':
|
|
1901
|
-
|
|
1901
|
+
console.log(prefix, ...outputArgs);
|
|
1902
1902
|
}
|
|
1903
|
-
} catch (e) {
|
|
1904
|
-
logger_logger.error('Failed to parse browser log payload', e);
|
|
1905
1903
|
} finally{
|
|
1906
1904
|
res.statusCode = 204, res.end();
|
|
1907
1905
|
}
|
|
@@ -1912,7 +1910,7 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
1912
1910
|
}),
|
|
1913
1911
|
(shouldTransformDeepImport = !1, preJsAssets = [], jsAssets = [], cssAssets = [], bundledDepsCachePath = '', deepImportPkgPattern = [
|
|
1914
1912
|
...SPECIAL_NO_ENTRY_DEPS
|
|
1915
|
-
].sort((a, b)=>b.length - a.length).map((name)=>name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), deepImportRegex = RegExp(`import\\s+([a-zA-Z0-9_$]+)\\s+from\\s+['"]((${deepImportPkgPattern})/[^'"]+)['"]`, 'g'), {
|
|
1913
|
+
].sort((a, b)=>b.length - a.length).map((name)=>name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), deepImportRegex = RegExp(`import\\s+([a-zA-Z0-9_$]+)\\s+from\\s+['"]((${deepImportPkgPattern})/[^'"]+)['"]`, 'g'), plugin = {
|
|
1916
1914
|
name: 'unpack:prebundle',
|
|
1917
1915
|
apply: (config, { command })=>'dev' === command && !!config.dev?.prebundle,
|
|
1918
1916
|
config: async (config, context)=>{
|
|
@@ -2144,16 +2142,15 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
2144
2142
|
return config.externals = [
|
|
2145
2143
|
externals1,
|
|
2146
2144
|
...existingExternals
|
|
2147
|
-
],
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
}) : null
|
|
2145
|
+
], shouldTransformDeepImport && (plugin.transform = {
|
|
2146
|
+
filter: {
|
|
2147
|
+
test: JSX_REGEX
|
|
2148
|
+
},
|
|
2149
|
+
handler: (code)=>SPECIAL_NO_ENTRY_DEPS.some((pkg)=>code.includes(pkg)) ? code.replace(deepImportRegex, (_, localName, importPath, pkgName)=>{
|
|
2150
|
+
let exportName = pathToExportIdentifier(importPath.slice(pkgName.length + 1));
|
|
2151
|
+
return `import { ${exportName} as ${localName} } from '${pkgName}'`;
|
|
2152
|
+
}) : null
|
|
2153
|
+
}), config;
|
|
2157
2154
|
},
|
|
2158
2155
|
transformHtml: (html)=>injectToHead(html, preJsAssets.sort((a, b)=>a.order - b.order).map((item)=>item.path).map((item)=>`<script defer src="${item}"></script>`).join('')),
|
|
2159
2156
|
setupMiddlewares: (middlewares)=>[
|
|
@@ -2270,7 +2267,7 @@ function createUnpack({ cwd = process.cwd(), config: userConfig, callerName = 'u
|
|
|
2270
2267
|
let mode = watch ? 'development' : 'production';
|
|
2271
2268
|
setNodeEnv(mode);
|
|
2272
2269
|
let config = resolveConfig(mode);
|
|
2273
|
-
console.log(colors.brand(`${callerName} v3.9.
|
|
2270
|
+
console.log(colors.brand(`${callerName} v3.9.2${config.performance?.cache ? ' ϟ' : ''}`), colors.cyan(`building for ${mode}...`)), await unpackBuild(config);
|
|
2274
2271
|
},
|
|
2275
2272
|
dev: async ()=>{
|
|
2276
2273
|
setUnpackStartTime(performance.now());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserLogs.d.ts","sourceRoot":"","sources":["../../src/plugins/browserLogs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"browserLogs.d.ts","sourceRoot":"","sources":["../../src/plugins/browserLogs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AA6B7C,eAAO,MAAM,iBAAiB,QAAO,YAgZpC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prebundle.d.ts","sourceRoot":"","sources":["../../src/plugins/prebundle.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAwB,YAAY,EAAE,MAAM,WAAW,CAAA;AAkGnE,eAAO,MAAM,eAAe,QAAO,
|
|
1
|
+
{"version":3,"file":"prebundle.d.ts","sourceRoot":"","sources":["../../src/plugins/prebundle.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAwB,YAAY,EAAE,MAAM,WAAW,CAAA;AAkGnE,eAAO,MAAM,eAAe,QAAO,YAiZlC,CAAA"}
|