@umijs/bundler-webpack 4.0.0-rc.11 → 4.0.0-rc.14
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/client/client/client.js +15 -7
- package/client/constants.js +6 -0
- package/compiled/cssnano/index.js +6 -6
- package/compiled/fork-ts-checker-webpack-plugin/index.js +7 -13
- package/compiled/{tapable → react-refresh}/LICENSE +6 -6
- package/compiled/react-refresh/index.js +9 -7
- package/compiled/react-refresh/package.json +1 -0
- package/compiled/webpack/BasicEffectRulePlugin.js +1 -0
- package/compiled/webpack/BasicMatcherRulePlugin.js +1 -0
- package/compiled/webpack/HotModuleReplacement.runtime.js +29 -14
- package/compiled/webpack/JavascriptHotModuleReplacement.runtime.js +4 -3
- package/compiled/webpack/ObjectMatcherRulePlugin.js +1 -0
- package/compiled/webpack/RuleSetCompiler.js +1 -0
- package/compiled/webpack/UseEffectRulePlugin.js +1 -0
- package/compiled/webpack/deepImports.json +6 -1
- package/compiled/webpack/index.js +4473 -2910
- package/compiled/webpack/types.d.ts +606 -171
- package/compiled/webpack-manifest-plugin/index.js +1 -1
- package/dist/build.d.ts +1 -0
- package/dist/build.js +2 -0
- package/dist/client/client.js +15 -7
- package/dist/config/compressPlugin.js +9 -1
- package/dist/config/config.d.ts +2 -0
- package/dist/config/config.js +7 -4
- package/dist/config/javaScriptRules.d.ts +1 -0
- package/dist/config/javaScriptRules.js +36 -12
- package/dist/config/nodePolyfill.js +2 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +7 -1
- package/dist/dev.d.ts +4 -0
- package/dist/dev.js +33 -7
- package/dist/schema.js +2 -0
- package/dist/server/https.d.ts +1 -2
- package/dist/server/https.js +3 -2
- package/dist/server/server.d.ts +1 -0
- package/dist/server/server.js +19 -13
- package/dist/server/ws.d.ts +3 -1
- package/dist/types.d.ts +1 -0
- package/dist/utils/getEsBuildTarget.d.ts +5 -0
- package/dist/utils/getEsBuildTarget.js +12 -0
- package/package.json +19 -18
- package/compiled/tapable/index.js +0 -1
- package/compiled/tapable/package.json +0 -1
- package/compiled/tapable/tapable.d.ts +0 -116
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";var e={156:function(e,t,s){Object.defineProperty(t,"__esModule",{value:true});t.transformFiles=t.reduceChunk=t.reduceAssets=t.generateManifest=void 0;const n=s(17);const generateManifest=(e,t,{generate:s,seed:n={}})=>{let o;if(s){const i=Array.from(e.entrypoints.entries());const a=i.reduce(((e,[t,s])=>Object.assign(e,{[t]:s.getFiles()})),{});o=s(n,t,a)}else{o=t.reduce(((e,t)=>Object.assign(e,{[t.name]:t.path})),n)}return o};t.generateManifest=generateManifest;const getFileType=(e,{transformExtensions:t})=>{const s=e.replace(/\?.*/,"");const n=s.split(".");const o=n.pop();return t.test(o)?`${n.pop()}.${o}`:o};const reduceAssets=(e,t,s)=>{let o;if(s[t.name]){o=s[t.name]}else if(t.info.sourceFilename){o=n.join(n.dirname(t.name),n.basename(t.info.sourceFilename))}if(o){return e.concat({isAsset:true,isChunk:false,isInitial:false,isModuleAsset:true,name:o,path:t.name})}const i=t.chunks&&t.chunks.length>0;if(i){return e}return e.concat({isAsset:true,isChunk:false,isInitial:false,isModuleAsset:false,name:t.name,path:t.name})};t.reduceAssets=reduceAssets;const reduceChunk=(e,t,s,o)=>{Array.from(t.auxiliaryFiles||[]).forEach((e=>{o[e]={isAsset:true,isChunk:false,isInitial:false,isModuleAsset:true,name:n.basename(e),path:e}}));return Array.from(t.files).reduce(((e,n)=>{let o=t.name?t.name:null;o=o?s.useEntryKeys&&!n.endsWith(".map")?o:`${o}.${getFileType(n,s)}`:n;return e.concat({chunk:t,isAsset:false,isChunk:true,isInitial:t.isOnlyInitial(),isModuleAsset:false,name:o,path:n})}),e)};t.reduceChunk=reduceChunk;const standardizeFilePaths=e=>{const t=Object.assign({},e);t.name=e.name.replace(/\\/g,"/");t.path=e.path.replace(/\\/g,"/");return t};const transformFiles=(e,t)=>["filter","map","sort"].filter((e=>!!t[e])).reduce(((e,s)=>e[s](t[s])),e).map(standardizeFilePaths);t.transformFiles=transformFiles},874:function(e,t,s){Object.defineProperty(t,"__esModule",{value:true});t.normalModuleLoaderHook=t.getCompilerHooks=t.emitHook=t.beforeRunHook=void 0;const n=s(147);const o=s(17);const i=s(535);const a=s(728);const r=s(156);const u=new WeakMap;const getCompilerHooks=e=>{let t=u.get(e);if(typeof t==="undefined"){t={afterEmit:new i.SyncWaterfallHook(["manifest"]),beforeEmit:new i.SyncWaterfallHook(["manifest"])};u.set(e,t)}return t};t.getCompilerHooks=getCompilerHooks;const beforeRunHook=({emitCountMap:e,manifestFileName:t},s,n)=>{const o=e.get(t)||0;e.set(t,o+1);if(n){n()}};t.beforeRunHook=beforeRunHook;const l=function emit({compiler:e,emitCountMap:t,manifestAssetId:s,manifestFileName:i,moduleAssets:u,options:l},c){const p=t.get(i)-1;const m=c.getStats().toJson({all:false,assets:true,cachedAssets:true,ids:true,publicPath:true});const f=l.publicPath!==null?l.publicPath:m.publicPath;const{basePath:d,removeKeyHash:h}=l;t.set(i,p);const k={};let b=Array.from(c.chunks).reduce(((e,t)=>r.reduceChunk(e,t,l,k)),[]);b=m.assets.reduce(((e,t)=>r.reduceAssets(e,t,u)),b);b=b.filter((({name:s,path:n})=>{var i;return!n.includes("hot-update")&&typeof t.get(o.join(((i=e.options.output)===null||i===void 0?void 0:i.path)||"<unknown>",s))==="undefined"}));b.forEach((e=>{delete k[e.path]}));Object.keys(k).forEach((e=>{b=b.concat(k[e])}));b=b.map((e=>{const normalizePath=e=>{if(!e.endsWith("/")){return`${e}/`}return e};const t={name:d?normalizePath(d)+e.name:e.name,path:f?normalizePath(f)+e.path:e.path};t.name=h?t.name.replace(h,""):t.name;return Object.assign(e,t)}));b=r.transformFiles(b,l);let g=r.generateManifest(c,b,l);const _=p===0;g=getCompilerHooks(e).beforeEmit.call(g);if(_){const e=l.serialize(g);c.emitAsset(s,new a.RawSource(e));if(l.writeToFileEmit){n.mkdirSync(o.dirname(i),{recursive:true});n.writeFileSync(i,e)}}getCompilerHooks(e).afterEmit.call(g)};t.emitHook=l;const normalModuleLoaderHook=({moduleAssets:e},t,s)=>{const{emitFile:n}=t;t.emitFile=(t,i,a)=>{if(s.userRequest&&!e[t]){Object.assign(e,{[t]:o.join(o.dirname(t),o.basename(s.userRequest))})}return n.call(s,t,i,a)}};t.normalModuleLoaderHook=normalModuleLoaderHook},131:function(e,t,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.WebpackManifestPlugin=t.getCompilerHooks=void 0;const o=s(17);const i=n(s(205));const a=s(874);Object.defineProperty(t,"getCompilerHooks",{enumerable:true,get:function(){return a.getCompilerHooks}});const r=new Map;const u={assetHookStage:Infinity,basePath:"",fileName:"manifest.json",filter:null,generate:void 0,map:null,publicPath:null,removeKeyHash:/([a-f0-9]{16,32}\.?)/gi,seed:void 0,serialize(e){return JSON.stringify(e,null,2)},sort:null,transformExtensions:/^(gz|map)$/i,useEntryKeys:false,useLegacyEmit:false,writeToFileEmit:false};class WebpackManifestPlugin{constructor(e){this.options=Object.assign({},u,e)}apply(e){var t,s;const n={};const u=o.resolve(((t=e.options.output)===null||t===void 0?void 0:t.path)||"./",this.options.fileName);const l=o.relative(((s=e.options.output)===null||s===void 0?void 0:s.path)||"./",u);const c=a.beforeRunHook.bind(this,{emitCountMap:r,manifestFileName:u});const p=a.emitHook.bind(this,{compiler:e,emitCountMap:r,manifestAssetId:l,manifestFileName:u,moduleAssets:n,options:this.options});const m=a.normalModuleLoaderHook.bind(this,{moduleAssets:n});const f={name:"WebpackManifestPlugin",stage:this.options.assetHookStage};e.hooks.compilation.tap(f,(e=>{const t=!i.default.getCompilationHooks?e.hooks.normalModuleLoader:i.default.getCompilationHooks(e).loader;t.tap(f,m)}));if(this.options.useLegacyEmit===true){e.hooks.emit.tap(f,p)}else{e.hooks.thisCompilation.tap(f,(e=>{e.hooks.processAssets.tap(f,(()=>p(e)))}))}e.hooks.run.tapAsync(f,c);e.hooks.watchRun.tapAsync(f,c)}}t.WebpackManifestPlugin=WebpackManifestPlugin},205:function(e){e.exports=require("../webpack/NormalModule")},535:function(e){e.exports=require("@umijs/bundler-
|
|
1
|
+
(function(){"use strict";var e={156:function(e,t,s){Object.defineProperty(t,"__esModule",{value:true});t.transformFiles=t.reduceChunk=t.reduceAssets=t.generateManifest=void 0;const n=s(17);const generateManifest=(e,t,{generate:s,seed:n={}})=>{let o;if(s){const i=Array.from(e.entrypoints.entries());const a=i.reduce(((e,[t,s])=>Object.assign(e,{[t]:s.getFiles()})),{});o=s(n,t,a)}else{o=t.reduce(((e,t)=>Object.assign(e,{[t.name]:t.path})),n)}return o};t.generateManifest=generateManifest;const getFileType=(e,{transformExtensions:t})=>{const s=e.replace(/\?.*/,"");const n=s.split(".");const o=n.pop();return t.test(o)?`${n.pop()}.${o}`:o};const reduceAssets=(e,t,s)=>{let o;if(s[t.name]){o=s[t.name]}else if(t.info.sourceFilename){o=n.join(n.dirname(t.name),n.basename(t.info.sourceFilename))}if(o){return e.concat({isAsset:true,isChunk:false,isInitial:false,isModuleAsset:true,name:o,path:t.name})}const i=t.chunks&&t.chunks.length>0;if(i){return e}return e.concat({isAsset:true,isChunk:false,isInitial:false,isModuleAsset:false,name:t.name,path:t.name})};t.reduceAssets=reduceAssets;const reduceChunk=(e,t,s,o)=>{Array.from(t.auxiliaryFiles||[]).forEach((e=>{o[e]={isAsset:true,isChunk:false,isInitial:false,isModuleAsset:true,name:n.basename(e),path:e}}));return Array.from(t.files).reduce(((e,n)=>{let o=t.name?t.name:null;o=o?s.useEntryKeys&&!n.endsWith(".map")?o:`${o}.${getFileType(n,s)}`:n;return e.concat({chunk:t,isAsset:false,isChunk:true,isInitial:t.isOnlyInitial(),isModuleAsset:false,name:o,path:n})}),e)};t.reduceChunk=reduceChunk;const standardizeFilePaths=e=>{const t=Object.assign({},e);t.name=e.name.replace(/\\/g,"/");t.path=e.path.replace(/\\/g,"/");return t};const transformFiles=(e,t)=>["filter","map","sort"].filter((e=>!!t[e])).reduce(((e,s)=>e[s](t[s])),e).map(standardizeFilePaths);t.transformFiles=transformFiles},874:function(e,t,s){Object.defineProperty(t,"__esModule",{value:true});t.normalModuleLoaderHook=t.getCompilerHooks=t.emitHook=t.beforeRunHook=void 0;const n=s(147);const o=s(17);const i=s(535);const a=s(728);const r=s(156);const u=new WeakMap;const getCompilerHooks=e=>{let t=u.get(e);if(typeof t==="undefined"){t={afterEmit:new i.SyncWaterfallHook(["manifest"]),beforeEmit:new i.SyncWaterfallHook(["manifest"])};u.set(e,t)}return t};t.getCompilerHooks=getCompilerHooks;const beforeRunHook=({emitCountMap:e,manifestFileName:t},s,n)=>{const o=e.get(t)||0;e.set(t,o+1);if(n){n()}};t.beforeRunHook=beforeRunHook;const l=function emit({compiler:e,emitCountMap:t,manifestAssetId:s,manifestFileName:i,moduleAssets:u,options:l},c){const p=t.get(i)-1;const m=c.getStats().toJson({all:false,assets:true,cachedAssets:true,ids:true,publicPath:true});const f=l.publicPath!==null?l.publicPath:m.publicPath;const{basePath:d,removeKeyHash:h}=l;t.set(i,p);const k={};let b=Array.from(c.chunks).reduce(((e,t)=>r.reduceChunk(e,t,l,k)),[]);b=m.assets.reduce(((e,t)=>r.reduceAssets(e,t,u)),b);b=b.filter((({name:s,path:n})=>{var i;return!n.includes("hot-update")&&typeof t.get(o.join(((i=e.options.output)===null||i===void 0?void 0:i.path)||"<unknown>",s))==="undefined"}));b.forEach((e=>{delete k[e.path]}));Object.keys(k).forEach((e=>{b=b.concat(k[e])}));b=b.map((e=>{const normalizePath=e=>{if(!e.endsWith("/")){return`${e}/`}return e};const t={name:d?normalizePath(d)+e.name:e.name,path:f?normalizePath(f)+e.path:e.path};t.name=h?t.name.replace(h,""):t.name;return Object.assign(e,t)}));b=r.transformFiles(b,l);let g=r.generateManifest(c,b,l);const _=p===0;g=getCompilerHooks(e).beforeEmit.call(g);if(_){const e=l.serialize(g);c.emitAsset(s,new a.RawSource(e));if(l.writeToFileEmit){n.mkdirSync(o.dirname(i),{recursive:true});n.writeFileSync(i,e)}}getCompilerHooks(e).afterEmit.call(g)};t.emitHook=l;const normalModuleLoaderHook=({moduleAssets:e},t,s)=>{const{emitFile:n}=t;t.emitFile=(t,i,a)=>{if(s.userRequest&&!e[t]){Object.assign(e,{[t]:o.join(o.dirname(t),o.basename(s.userRequest))})}return n.call(s,t,i,a)}};t.normalModuleLoaderHook=normalModuleLoaderHook},131:function(e,t,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.WebpackManifestPlugin=t.getCompilerHooks=void 0;const o=s(17);const i=n(s(205));const a=s(874);Object.defineProperty(t,"getCompilerHooks",{enumerable:true,get:function(){return a.getCompilerHooks}});const r=new Map;const u={assetHookStage:Infinity,basePath:"",fileName:"manifest.json",filter:null,generate:void 0,map:null,publicPath:null,removeKeyHash:/([a-f0-9]{16,32}\.?)/gi,seed:void 0,serialize(e){return JSON.stringify(e,null,2)},sort:null,transformExtensions:/^(gz|map)$/i,useEntryKeys:false,useLegacyEmit:false,writeToFileEmit:false};class WebpackManifestPlugin{constructor(e){this.options=Object.assign({},u,e)}apply(e){var t,s;const n={};const u=o.resolve(((t=e.options.output)===null||t===void 0?void 0:t.path)||"./",this.options.fileName);const l=o.relative(((s=e.options.output)===null||s===void 0?void 0:s.path)||"./",u);const c=a.beforeRunHook.bind(this,{emitCountMap:r,manifestFileName:u});const p=a.emitHook.bind(this,{compiler:e,emitCountMap:r,manifestAssetId:l,manifestFileName:u,moduleAssets:n,options:this.options});const m=a.normalModuleLoaderHook.bind(this,{moduleAssets:n});const f={name:"WebpackManifestPlugin",stage:this.options.assetHookStage};e.hooks.compilation.tap(f,(e=>{const t=!i.default.getCompilationHooks?e.hooks.normalModuleLoader:i.default.getCompilationHooks(e).loader;t.tap(f,m)}));if(this.options.useLegacyEmit===true){e.hooks.emit.tap(f,p)}else{e.hooks.thisCompilation.tap(f,(e=>{e.hooks.processAssets.tap(f,(()=>p(e)))}))}e.hooks.run.tapAsync(f,c);e.hooks.watchRun.tapAsync(f,c)}}t.WebpackManifestPlugin=WebpackManifestPlugin},205:function(e){e.exports=require("../webpack/NormalModule")},535:function(e){e.exports=require("@umijs/bundler-utils/compiled/tapable")},728:function(e){e.exports=require("@umijs/bundler-webpack/compiled/webpack-sources")},147:function(e){e.exports=require("fs")},17:function(e){e.exports=require("path")}};var t={};function __nccwpck_require__(s){var n=t[s];if(n!==undefined){return n.exports}var o=t[s]={exports:{}};var i=true;try{e[s].call(o.exports,o,o.exports,__nccwpck_require__);i=false}finally{if(i)delete t[s]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var s=__nccwpck_require__(131);module.exports=s})();
|
package/dist/build.d.ts
CHANGED
package/dist/build.js
CHANGED
|
@@ -21,6 +21,7 @@ function build(opts) {
|
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
const webpackConfig = yield (0, config_1.getConfig)({
|
|
23
23
|
cwd: opts.cwd,
|
|
24
|
+
rootDir: opts.rootDir,
|
|
24
25
|
env: types_1.Env.production,
|
|
25
26
|
entry: opts.entry,
|
|
26
27
|
userConfig: opts.config,
|
|
@@ -34,6 +35,7 @@ function build(opts) {
|
|
|
34
35
|
...(opts.beforeBabelPresets || []),
|
|
35
36
|
...(opts.extraBabelPresets || []),
|
|
36
37
|
],
|
|
38
|
+
extraBabelIncludes: opts.config.extraBabelIncludes,
|
|
37
39
|
chainWebpack: opts.chainWebpack,
|
|
38
40
|
modifyWebpackConfig: opts.modifyWebpackConfig,
|
|
39
41
|
cache: opts.cache,
|
package/dist/client/client.js
CHANGED
|
@@ -41,21 +41,29 @@ const ErrorOverlay = __importStar(require("react-error-overlay"));
|
|
|
41
41
|
const constants_1 = require("../constants");
|
|
42
42
|
const formatWebpackMessages_1 = require("../utils/formatWebpackMessages");
|
|
43
43
|
console.log('[webpack] connecting...');
|
|
44
|
-
function
|
|
45
|
-
let l = location;
|
|
44
|
+
function getHost() {
|
|
46
45
|
if (process.env.SOCKET_SERVER) {
|
|
47
|
-
|
|
46
|
+
return new URL(process.env.SOCKET_SERVER);
|
|
48
47
|
}
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
return location;
|
|
49
|
+
}
|
|
50
|
+
function getSocketUrl() {
|
|
51
|
+
let h = getHost();
|
|
52
|
+
const host = h.host;
|
|
53
|
+
const isHttps = h.protocol === 'https:';
|
|
51
54
|
return `${isHttps ? 'wss' : 'ws'}://${host}`;
|
|
52
55
|
}
|
|
56
|
+
function getPingUrl() {
|
|
57
|
+
const h = getHost();
|
|
58
|
+
return `${h.protocol}//${h.host}/__umi_ping`;
|
|
59
|
+
}
|
|
53
60
|
let pingTimer = null;
|
|
54
61
|
let isFirstCompilation = true;
|
|
55
62
|
let mostRecentCompilationHash = null;
|
|
56
63
|
let hasCompileErrors = false;
|
|
57
64
|
let hadRuntimeError = false;
|
|
58
|
-
const
|
|
65
|
+
const pingUrl = getPingUrl();
|
|
66
|
+
const socket = new WebSocket(getSocketUrl(), 'webpack-hmr');
|
|
59
67
|
socket.addEventListener('message', ({ data }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
68
|
data = JSON.parse(data);
|
|
61
69
|
if (data.type === 'connected') {
|
|
@@ -73,7 +81,7 @@ function waitForSuccessfulPing(ms = 1000) {
|
|
|
73
81
|
// eslint-disable-next-line no-constant-condition
|
|
74
82
|
while (true) {
|
|
75
83
|
try {
|
|
76
|
-
yield fetch(
|
|
84
|
+
yield fetch(pingUrl);
|
|
77
85
|
break;
|
|
78
86
|
}
|
|
79
87
|
catch (e) {
|
|
@@ -19,6 +19,7 @@ const terser_webpack_plugin_1 = __importDefault(require("../../compiled/terser-w
|
|
|
19
19
|
const ESBuildCSSMinifyPlugin_1 = __importDefault(require("../plugins/ESBuildCSSMinifyPlugin"));
|
|
20
20
|
const ParcelCSSMinifyPlugin_1 = require("../plugins/ParcelCSSMinifyPlugin");
|
|
21
21
|
const types_1 = require("../types");
|
|
22
|
+
const getEsBuildTarget_1 = require("../utils/getEsBuildTarget");
|
|
22
23
|
function addCompressPlugin(opts) {
|
|
23
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
25
|
const { config, userConfig, env } = opts;
|
|
@@ -32,8 +33,14 @@ function addCompressPlugin(opts) {
|
|
|
32
33
|
}
|
|
33
34
|
config.optimization.minimize(true);
|
|
34
35
|
let minify;
|
|
36
|
+
let terserOptions;
|
|
35
37
|
if (jsMinifier === types_1.JSMinifier.esbuild) {
|
|
36
38
|
minify = terser_webpack_plugin_1.default.esbuildMinify;
|
|
39
|
+
terserOptions = {
|
|
40
|
+
target: (0, getEsBuildTarget_1.getEsBuildTarget)({
|
|
41
|
+
targets: userConfig.targets || {},
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
37
44
|
}
|
|
38
45
|
else if (jsMinifier === types_1.JSMinifier.terser) {
|
|
39
46
|
minify = terser_webpack_plugin_1.default.terserMinify;
|
|
@@ -47,11 +54,12 @@ function addCompressPlugin(opts) {
|
|
|
47
54
|
else if (jsMinifier !== types_1.JSMinifier.none) {
|
|
48
55
|
throw new Error(`Unsupported jsMinifier ${userConfig.jsMinifier}.`);
|
|
49
56
|
}
|
|
57
|
+
terserOptions = Object.assign(Object.assign({}, terserOptions), userConfig.jsMinifierOptions);
|
|
50
58
|
if (jsMinifier !== types_1.JSMinifier.none) {
|
|
51
59
|
config.optimization.minimizer(`js-${jsMinifier}`).use(terser_webpack_plugin_1.default, [
|
|
52
60
|
{
|
|
53
61
|
minify,
|
|
54
|
-
terserOptions
|
|
62
|
+
terserOptions,
|
|
55
63
|
},
|
|
56
64
|
]);
|
|
57
65
|
}
|
package/dist/config/config.d.ts
CHANGED
|
@@ -2,10 +2,12 @@ import { Configuration } from '../../compiled/webpack';
|
|
|
2
2
|
import { Env, IConfig } from '../types';
|
|
3
3
|
export interface IOpts {
|
|
4
4
|
cwd: string;
|
|
5
|
+
rootDir?: string;
|
|
5
6
|
env: Env;
|
|
6
7
|
entry: Record<string, string>;
|
|
7
8
|
extraBabelPresets?: any[];
|
|
8
9
|
extraBabelPlugins?: any[];
|
|
10
|
+
extraBabelIncludes?: string[];
|
|
9
11
|
extraEsbuildLoaderHandler?: any[];
|
|
10
12
|
babelPreset?: any;
|
|
11
13
|
chainWebpack?: Function;
|
package/dist/config/config.js
CHANGED
|
@@ -35,7 +35,6 @@ const javaScriptRules_1 = require("./javaScriptRules");
|
|
|
35
35
|
const manifestPlugin_1 = require("./manifestPlugin");
|
|
36
36
|
const miniCSSExtractPlugin_1 = require("./miniCSSExtractPlugin");
|
|
37
37
|
const nodePolyfill_1 = require("./nodePolyfill");
|
|
38
|
-
const nodePrefixPlugin_1 = require("./nodePrefixPlugin");
|
|
39
38
|
const progressPlugin_1 = require("./progressPlugin");
|
|
40
39
|
const speedMeasureWebpackPlugin_1 = require("./speedMeasureWebpackPlugin");
|
|
41
40
|
const svgRules_1 = require("./svgRules");
|
|
@@ -55,6 +54,7 @@ function getConfig(opts) {
|
|
|
55
54
|
babelPreset: opts.babelPreset,
|
|
56
55
|
extraBabelPlugins: opts.extraBabelPlugins || [],
|
|
57
56
|
extraBabelPresets: opts.extraBabelPresets || [],
|
|
57
|
+
extraBabelIncludes: opts.extraBabelIncludes || [],
|
|
58
58
|
extraEsbuildLoaderHandler: opts.extraEsbuildLoaderHandler || [],
|
|
59
59
|
browsers: (0, browsersList_1.getBrowsersList)({
|
|
60
60
|
targets: userConfig.targets,
|
|
@@ -155,7 +155,8 @@ function getConfig(opts) {
|
|
|
155
155
|
// handle HarmonyLinkingError
|
|
156
156
|
yield (0, harmonyLinkingErrorPlugin_1.addHarmonyLinkingErrorPlugin)(applyOpts);
|
|
157
157
|
// remove node: prefix
|
|
158
|
-
|
|
158
|
+
// disable for performance
|
|
159
|
+
// await addNodePrefixPlugin(applyOpts);
|
|
159
160
|
// runtimePublicPath
|
|
160
161
|
if (userConfig.runtimePublicPath) {
|
|
161
162
|
config.plugin('runtimePublicPath').use(RuntimePublicPathPlugin_1.RuntimePublicPathPlugin);
|
|
@@ -169,7 +170,8 @@ function getConfig(opts) {
|
|
|
169
170
|
config: opts.cache.buildDependencies || [],
|
|
170
171
|
},
|
|
171
172
|
cacheDirectory: opts.cache.cacheDirectory ||
|
|
172
|
-
|
|
173
|
+
// 使用 rootDir 是在有 APP_ROOT 时,把 cache 目录放在根目录下
|
|
174
|
+
(0, path_1.join)(opts.rootDir || opts.cwd, 'node_modules', '.cache', 'bundler-webpack'),
|
|
173
175
|
});
|
|
174
176
|
// tnpm 安装依赖的情况 webpack 默认的 managedPaths 不生效
|
|
175
177
|
// 使用 immutablePaths 避免 node_modules 的内容被写入缓存
|
|
@@ -178,7 +180,8 @@ function getConfig(opts) {
|
|
|
178
180
|
if ( /*isTnpm*/require('@umijs/utils/package').__npminstall_done) {
|
|
179
181
|
config.snapshot({
|
|
180
182
|
immutablePaths: [
|
|
181
|
-
opts.cache.absNodeModulesPath ||
|
|
183
|
+
opts.cache.absNodeModulesPath ||
|
|
184
|
+
(0, path_1.join)(opts.rootDir || opts.cwd, 'node_modules'),
|
|
182
185
|
],
|
|
183
186
|
});
|
|
184
187
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.addJavaScriptRules = void 0;
|
|
13
13
|
const mfsu_1 = require("@umijs/mfsu");
|
|
14
14
|
const utils_1 = require("@umijs/utils");
|
|
15
|
+
const path_1 = require("path");
|
|
15
16
|
const webpack_1 = require("../../compiled/webpack");
|
|
16
17
|
const constants_1 = require("../constants");
|
|
17
18
|
const types_1 = require("../types");
|
|
@@ -40,18 +41,41 @@ function addJavaScriptRules(opts) {
|
|
|
40
41
|
config.module
|
|
41
42
|
.rule('extra-src')
|
|
42
43
|
.test(/\.(js|mjs)$/)
|
|
43
|
-
.include.add(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
.include.add([
|
|
45
|
+
// support extraBabelIncludes
|
|
46
|
+
...opts.extraBabelIncludes.map((p) => {
|
|
47
|
+
// handle absolute path
|
|
48
|
+
if ((0, path_1.isAbsolute)(p)) {
|
|
49
|
+
return p;
|
|
50
|
+
}
|
|
51
|
+
// resolve npm package name
|
|
52
|
+
try {
|
|
53
|
+
if (p.startsWith('./')) {
|
|
54
|
+
return require.resolve(p, { paths: [cwd] });
|
|
55
|
+
}
|
|
56
|
+
return (0, path_1.dirname)(require.resolve(`${p}/package.json`, { paths: [cwd] }));
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
if (e.code === 'MODULE_NOT_FOUND') {
|
|
60
|
+
throw new Error('Cannot resolve extraBabelIncludes: ' + p);
|
|
61
|
+
}
|
|
62
|
+
throw e;
|
|
63
|
+
}
|
|
64
|
+
}),
|
|
65
|
+
// support es5ImcompatibleVersions
|
|
66
|
+
(path) => {
|
|
67
|
+
try {
|
|
68
|
+
// do src transform for bundler-webpack/client/client/client.js
|
|
69
|
+
if (path.includes('client/client/client'))
|
|
70
|
+
return true;
|
|
71
|
+
return (0, depMatch_1.isMatch)({ path, pkgs: depPkgs });
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
console.error(utils_1.chalk.red(e));
|
|
75
|
+
throw e;
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
])
|
|
55
79
|
.end(),
|
|
56
80
|
];
|
|
57
81
|
if (userConfig.mdx) {
|
|
@@ -14,12 +14,13 @@ const webpack_1 = require("@umijs/bundler-webpack/compiled/webpack");
|
|
|
14
14
|
function addNodePolyfill(opts) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
const { config } = opts;
|
|
17
|
+
const nodeLibs = require('node-libs-browser');
|
|
17
18
|
config.plugin('node-polyfill-provider').use(webpack_1.ProvidePlugin, [
|
|
18
19
|
{
|
|
19
20
|
Buffer: ['buffer', 'Buffer'],
|
|
21
|
+
process: nodeLibs['process'],
|
|
20
22
|
},
|
|
21
23
|
]);
|
|
22
|
-
const nodeLibs = require('node-libs-browser');
|
|
23
24
|
config.resolve.fallback.merge(Object.assign(Object.assign({}, Object.keys(nodeLibs).reduce((memo, key) => {
|
|
24
25
|
if (nodeLibs[key]) {
|
|
25
26
|
memo[key] = nodeLibs[key];
|
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_BROWSER_TARGETS = exports.MESSAGE_TYPE = exports.MFSU_NAME = exports.DEFAULT_OUTPUT_PATH = exports.DEFAULT_DEVTOOL = void 0;
|
|
3
|
+
exports.DEFAULT_ESBUILD_TARGET_KEYS = exports.DEFAULT_BROWSER_TARGETS = exports.MESSAGE_TYPE = exports.MFSU_NAME = exports.DEFAULT_OUTPUT_PATH = exports.DEFAULT_DEVTOOL = void 0;
|
|
4
4
|
exports.DEFAULT_DEVTOOL = 'cheap-module-source-map';
|
|
5
5
|
exports.DEFAULT_OUTPUT_PATH = 'dist';
|
|
6
6
|
exports.MFSU_NAME = 'MFSU';
|
|
@@ -16,3 +16,9 @@ var MESSAGE_TYPE;
|
|
|
16
16
|
exports.DEFAULT_BROWSER_TARGETS = {
|
|
17
17
|
chrome: 80,
|
|
18
18
|
};
|
|
19
|
+
exports.DEFAULT_ESBUILD_TARGET_KEYS = [
|
|
20
|
+
'chrome',
|
|
21
|
+
'firefox',
|
|
22
|
+
'edge',
|
|
23
|
+
'safari',
|
|
24
|
+
];
|
package/dist/dev.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ declare type IOpts = {
|
|
|
4
4
|
afterMiddlewares?: any[];
|
|
5
5
|
beforeMiddlewares?: any[];
|
|
6
6
|
onDevCompileDone?: Function;
|
|
7
|
+
onProgress?: Function;
|
|
8
|
+
onMFSUProgress?: Function;
|
|
7
9
|
port?: number;
|
|
8
10
|
host?: string;
|
|
9
11
|
babelPreset?: any;
|
|
@@ -14,8 +16,10 @@ declare type IOpts = {
|
|
|
14
16
|
extraBabelPlugins?: any[];
|
|
15
17
|
extraBabelPresets?: any[];
|
|
16
18
|
cwd: string;
|
|
19
|
+
rootDir?: string;
|
|
17
20
|
config: IConfig;
|
|
18
21
|
entry: Record<string, string>;
|
|
19
22
|
} & Pick<IConfigOpts, 'cache'>;
|
|
23
|
+
export declare function stripUndefined(obj: any): any;
|
|
20
24
|
export declare function dev(opts: IOpts): Promise<void>;
|
|
21
25
|
export {};
|
package/dist/dev.js
CHANGED
|
@@ -12,15 +12,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.dev = void 0;
|
|
15
|
+
exports.dev = exports.stripUndefined = void 0;
|
|
16
16
|
const mfsu_1 = require("@umijs/mfsu");
|
|
17
17
|
const utils_1 = require("@umijs/utils");
|
|
18
|
+
const fs_1 = require("fs");
|
|
18
19
|
const path_1 = require("path");
|
|
19
20
|
const webpack_1 = __importDefault(require("../compiled/webpack"));
|
|
20
21
|
const config_1 = require("./config/config");
|
|
21
22
|
const constants_1 = require("./constants");
|
|
22
23
|
const server_1 = require("./server/server");
|
|
23
24
|
const types_1 = require("./types");
|
|
25
|
+
function stripUndefined(obj) {
|
|
26
|
+
Object.keys(obj).forEach((key) => {
|
|
27
|
+
if (obj[key] === undefined) {
|
|
28
|
+
delete obj[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return obj;
|
|
32
|
+
}
|
|
33
|
+
exports.stripUndefined = stripUndefined;
|
|
24
34
|
function dev(opts) {
|
|
25
35
|
var _a, _b, _c, _d, _e, _f;
|
|
26
36
|
var _g;
|
|
@@ -40,23 +50,24 @@ function dev(opts) {
|
|
|
40
50
|
mfName: (_c = opts.config.mfsu) === null || _c === void 0 ? void 0 : _c.mfName,
|
|
41
51
|
runtimePublicPath: opts.config.runtimePublicPath,
|
|
42
52
|
tmpBase: ((_d = opts.config.mfsu) === null || _d === void 0 ? void 0 : _d.cacheDirectory) ||
|
|
43
|
-
(0, path_1.join)(opts.cwd, 'node_modules/.cache/mfsu'),
|
|
53
|
+
(0, path_1.join)(opts.rootDir || opts.cwd, 'node_modules/.cache/mfsu'),
|
|
54
|
+
onMFSUProgress: opts.onMFSUProgress,
|
|
44
55
|
getCacheDependency() {
|
|
45
|
-
|
|
46
|
-
return {
|
|
56
|
+
return stripUndefined({
|
|
47
57
|
version: require('../package.json').version,
|
|
48
|
-
|
|
58
|
+
mfsu: opts.config.mfsu,
|
|
49
59
|
alias: opts.config.alias,
|
|
50
60
|
externals: opts.config.externals,
|
|
51
61
|
theme: opts.config.theme,
|
|
52
62
|
runtimePublicPath: opts.config.runtimePublicPath,
|
|
53
63
|
publicPath: opts.config.publicPath,
|
|
54
|
-
};
|
|
64
|
+
});
|
|
55
65
|
},
|
|
56
66
|
});
|
|
57
67
|
}
|
|
58
68
|
const webpackConfig = yield (0, config_1.getConfig)({
|
|
59
69
|
cwd: opts.cwd,
|
|
70
|
+
rootDir: opts.rootDir,
|
|
60
71
|
env: types_1.Env.development,
|
|
61
72
|
entry: opts.entry,
|
|
62
73
|
userConfig: opts.config,
|
|
@@ -70,6 +81,7 @@ function dev(opts) {
|
|
|
70
81
|
...(opts.beforeBabelPresets || []),
|
|
71
82
|
...(opts.extraBabelPresets || []),
|
|
72
83
|
],
|
|
84
|
+
extraBabelIncludes: opts.config.extraBabelIncludes,
|
|
73
85
|
extraEsbuildLoaderHandler: (mfsu === null || mfsu === void 0 ? void 0 : mfsu.getEsbuildLoaderHandler()) || [],
|
|
74
86
|
chainWebpack: opts.chainWebpack,
|
|
75
87
|
modifyWebpackConfig: opts.modifyWebpackConfig,
|
|
@@ -79,6 +91,7 @@ function dev(opts) {
|
|
|
79
91
|
});
|
|
80
92
|
const depConfig = yield (0, config_1.getConfig)({
|
|
81
93
|
cwd: opts.cwd,
|
|
94
|
+
rootDir: opts.rootDir,
|
|
82
95
|
env: types_1.Env.development,
|
|
83
96
|
entry: opts.entry,
|
|
84
97
|
userConfig: opts.config,
|
|
@@ -88,7 +101,7 @@ function dev(opts) {
|
|
|
88
101
|
chainWebpack: (_e = opts.config.mfsu) === null || _e === void 0 ? void 0 : _e.chainWebpack,
|
|
89
102
|
cache: {
|
|
90
103
|
buildDependencies: (_f = opts.cache) === null || _f === void 0 ? void 0 : _f.buildDependencies,
|
|
91
|
-
cacheDirectory: (0, path_1.join)(opts.cwd, 'node_modules', '.cache', 'mfsu-deps'),
|
|
104
|
+
cacheDirectory: (0, path_1.join)(opts.rootDir || opts.cwd, 'node_modules', '.cache', 'mfsu-deps'),
|
|
92
105
|
},
|
|
93
106
|
});
|
|
94
107
|
(_g = webpackConfig.resolve).alias || (_g.alias = {});
|
|
@@ -101,6 +114,18 @@ function dev(opts) {
|
|
|
101
114
|
config: webpackConfig,
|
|
102
115
|
depConfig: depConfig,
|
|
103
116
|
}));
|
|
117
|
+
if (mfsu &&
|
|
118
|
+
webpackConfig.cache &&
|
|
119
|
+
typeof webpackConfig.cache === 'object' &&
|
|
120
|
+
webpackConfig.cache.type === 'filesystem') {
|
|
121
|
+
const webpackCachePath = (0, path_1.join)(webpackConfig.cache.cacheDirectory, `default-development`, 'index.pack');
|
|
122
|
+
const mfsuCacheExists = (0, fs_1.existsSync)(mfsu.depInfo.cacheFilePath);
|
|
123
|
+
const webpackCacheExists = (0, fs_1.existsSync)(webpackCachePath);
|
|
124
|
+
if (webpackCacheExists && !mfsuCacheExists) {
|
|
125
|
+
utils_1.logger.warn(`Invalidate webpack cache since mfsu cache is missing`);
|
|
126
|
+
utils_1.rimraf.sync(webpackConfig.cache.cacheDirectory);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
104
129
|
yield (0, server_1.createServer)({
|
|
105
130
|
webpackConfig,
|
|
106
131
|
userConfig: opts.config,
|
|
@@ -113,6 +138,7 @@ function dev(opts) {
|
|
|
113
138
|
host: opts.host,
|
|
114
139
|
afterMiddlewares: [...(opts.afterMiddlewares || [])],
|
|
115
140
|
onDevCompileDone: opts.onDevCompileDone,
|
|
141
|
+
onProgress: opts.onProgress,
|
|
116
142
|
});
|
|
117
143
|
});
|
|
118
144
|
}
|
package/dist/schema.js
CHANGED
|
@@ -40,6 +40,7 @@ function getSchemas() {
|
|
|
40
40
|
devtool: (Joi) => Joi.alternatives().try(Joi.string().regex(DEVTOOL_REGEX), Joi.boolean()),
|
|
41
41
|
esm: (Joi) => Joi.object(),
|
|
42
42
|
externals: (Joi) => Joi.alternatives().try(Joi.object(), Joi.string(), Joi.func()),
|
|
43
|
+
extraBabelIncludes: (Joi) => Joi.array().items(Joi.string()),
|
|
43
44
|
extraBabelPlugins: (Joi) => Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.array())),
|
|
44
45
|
extraBabelPresets: (Joi) => Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.array())),
|
|
45
46
|
extraPostCSSPlugins: (Joi) => Joi.array(),
|
|
@@ -62,6 +63,7 @@ function getSchemas() {
|
|
|
62
63
|
chainWebpack: Joi.function(),
|
|
63
64
|
esbuild: Joi.boolean(),
|
|
64
65
|
mfName: Joi.string(),
|
|
66
|
+
runtimePublicPath: Joi.boolean(),
|
|
65
67
|
}), Joi.boolean()),
|
|
66
68
|
outputPath: (Joi) => Joi.string(),
|
|
67
69
|
postcssLoader: (Joi) => Joi.object(),
|
package/dist/server/https.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { RequestListener } from 'http';
|
|
3
|
-
import https from 'https';
|
|
4
3
|
import { HttpsParams } from '../types';
|
|
5
|
-
export declare function createHttpsServer(app: RequestListener, httpsConfig: HttpsParams): Promise<https.Server>;
|
|
4
|
+
export declare function createHttpsServer(app: RequestListener, httpsConfig: HttpsParams): Promise<import("https").Server>;
|
package/dist/server/https.js
CHANGED
|
@@ -15,8 +15,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.createHttpsServer = void 0;
|
|
16
16
|
const utils_1 = require("@umijs/utils");
|
|
17
17
|
const fs_1 = require("fs");
|
|
18
|
-
const https_1 = __importDefault(require("https"));
|
|
19
18
|
const path_1 = require("path");
|
|
19
|
+
const spdy_1 = __importDefault(require("spdy"));
|
|
20
20
|
const defaultHttpsHosts = ['localhost', '127.0.0.1'];
|
|
21
21
|
function createHttpsServer(app, httpsConfig) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -64,10 +64,11 @@ function createHttpsServer(app, httpsConfig) {
|
|
|
64
64
|
]);
|
|
65
65
|
}
|
|
66
66
|
// Create server
|
|
67
|
-
|
|
67
|
+
const http2Service = spdy_1.default.createServer({
|
|
68
68
|
key: (0, fs_1.readFileSync)(key, 'utf-8'),
|
|
69
69
|
cert: (0, fs_1.readFileSync)(cert, 'utf-8'),
|
|
70
70
|
}, app);
|
|
71
|
+
return http2Service;
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
exports.createHttpsServer = createHttpsServer;
|
package/dist/server/server.d.ts
CHANGED
package/dist/server/server.js
CHANGED
|
@@ -28,18 +28,6 @@ function createServer(opts) {
|
|
|
28
28
|
const { webpackConfig, userConfig } = opts;
|
|
29
29
|
const { proxy } = userConfig;
|
|
30
30
|
const app = (0, express_1.default)();
|
|
31
|
-
// basename middleware
|
|
32
|
-
app.use((req, _res, next) => {
|
|
33
|
-
const { url, path } = req;
|
|
34
|
-
const { basename, history } = userConfig;
|
|
35
|
-
if ((history === null || history === void 0 ? void 0 : history.type) === 'browser' &&
|
|
36
|
-
basename !== '/' &&
|
|
37
|
-
url.startsWith(basename)) {
|
|
38
|
-
req.url = url.slice(basename.length);
|
|
39
|
-
req.path = path.slice(basename.length);
|
|
40
|
-
}
|
|
41
|
-
next();
|
|
42
|
-
});
|
|
43
31
|
// cros
|
|
44
32
|
app.use((_req, res, next) => {
|
|
45
33
|
res.header('Access-Control-Allow-Origin', '*');
|
|
@@ -63,7 +51,25 @@ function createServer(opts) {
|
|
|
63
51
|
}
|
|
64
52
|
});
|
|
65
53
|
// webpack dev middleware
|
|
66
|
-
const
|
|
54
|
+
const configs = Array.isArray(webpackConfig)
|
|
55
|
+
? webpackConfig
|
|
56
|
+
: [webpackConfig];
|
|
57
|
+
const progresses = [];
|
|
58
|
+
if (opts.onProgress) {
|
|
59
|
+
configs.forEach((config) => {
|
|
60
|
+
const progress = {
|
|
61
|
+
percent: 0,
|
|
62
|
+
status: 'waiting',
|
|
63
|
+
};
|
|
64
|
+
progresses.push(progress);
|
|
65
|
+
config.plugins.push(new webpack_1.default.ProgressPlugin((percent, msg) => {
|
|
66
|
+
progress.percent = percent;
|
|
67
|
+
progress.status = msg;
|
|
68
|
+
opts.onProgress({ progresses });
|
|
69
|
+
}));
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const compiler = (0, webpack_1.default)(configs);
|
|
67
73
|
const webpackDevMiddleware = require('@umijs/bundler-webpack/compiled/webpack-dev-middleware');
|
|
68
74
|
const compilerMiddleware = webpackDevMiddleware(compiler, {
|
|
69
75
|
publicPath: userConfig.publicPath || '/',
|
package/dist/server/ws.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Server as HttpServer } from 'http';
|
|
3
|
+
import { Http2Server } from 'http2';
|
|
3
4
|
import { Server as HttpsServer } from 'https';
|
|
5
|
+
import { Server } from 'spdy';
|
|
4
6
|
import WebSocket from '../../compiled/ws';
|
|
5
|
-
export declare function createWebSocketServer(server: HttpServer | HttpsServer): {
|
|
7
|
+
export declare function createWebSocketServer(server: HttpServer | HttpsServer | Http2Server | Server): {
|
|
6
8
|
send(message: string): void;
|
|
7
9
|
wss: WebSocket.Server;
|
|
8
10
|
close(): void;
|
package/dist/types.d.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEsBuildTarget = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
function getEsBuildTarget({ targets }) {
|
|
6
|
+
return Object.keys(targets)
|
|
7
|
+
.filter((key) => constants_1.DEFAULT_ESBUILD_TARGET_KEYS.includes(key))
|
|
8
|
+
.map((key) => {
|
|
9
|
+
return `${key}${targets[key] === true ? '0' : targets[key]}`;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
exports.getEsBuildTarget = getEsBuildTarget;
|