app-bundler 0.2.4 → 0.2.5
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/lib/bundler.js +46 -0
- package/lib/cli.js +46 -0
- package/package.json +1 -1
package/lib/bundler.js
CHANGED
|
@@ -4953,6 +4953,41 @@ var __register, __require, require;
|
|
|
4953
4953
|
|
|
4954
4954
|
}));
|
|
4955
4955
|
|
|
4956
|
+
// end:source ./UMD.js
|
|
4957
|
+
`,
|
|
4958
|
+
ESM: `
|
|
4959
|
+
// source ./UMD.js
|
|
4960
|
+
(function (factory) {
|
|
4961
|
+
|
|
4962
|
+
var _name = '%NAME%',
|
|
4963
|
+
_global = typeof window === 'undefined' ? global : window,
|
|
4964
|
+
_module = {
|
|
4965
|
+
exports: {}
|
|
4966
|
+
};
|
|
4967
|
+
|
|
4968
|
+
factory(_module, _module.exports, _global);
|
|
4969
|
+
|
|
4970
|
+
if (typeof module === 'object' && module.exports) {
|
|
4971
|
+
module.exports = _module.exports;
|
|
4972
|
+
}
|
|
4973
|
+
|
|
4974
|
+
if (typeof define === 'function' && define.amd) {
|
|
4975
|
+
define([], function () {
|
|
4976
|
+
return _module.exports;
|
|
4977
|
+
});
|
|
4978
|
+
return;
|
|
4979
|
+
}
|
|
4980
|
+
|
|
4981
|
+
if (_name) {
|
|
4982
|
+
_global[_name] = _module.exports;
|
|
4983
|
+
}
|
|
4984
|
+
|
|
4985
|
+
}(function (module, exports, global) {
|
|
4986
|
+
|
|
4987
|
+
%MODULE%
|
|
4988
|
+
|
|
4989
|
+
}));
|
|
4990
|
+
|
|
4956
4991
|
// end:source ./UMD.js
|
|
4957
4992
|
`,
|
|
4958
4993
|
Style: `
|
|
@@ -5220,6 +5255,9 @@ class ModuleWrapper {
|
|
|
5220
5255
|
case 'umd':
|
|
5221
5256
|
body = this.wrapWithUMD(body);
|
|
5222
5257
|
break;
|
|
5258
|
+
case 'esm':
|
|
5259
|
+
body = this.wrapWithESM(body);
|
|
5260
|
+
break;
|
|
5223
5261
|
case 'custom':
|
|
5224
5262
|
body = this.wrapWithCustom(body);
|
|
5225
5263
|
break;
|
|
@@ -5246,6 +5284,14 @@ class ModuleWrapper {
|
|
|
5246
5284
|
.replace('%MODULE%', () => body)
|
|
5247
5285
|
.replace('%NAME%', () => name);
|
|
5248
5286
|
}
|
|
5287
|
+
wrapWithESM(body) {
|
|
5288
|
+
var opts = this.solution.opts.package;
|
|
5289
|
+
var exportsCode = opts.moduleExportsCode || '';
|
|
5290
|
+
return Templates_1.Templates
|
|
5291
|
+
.ESM
|
|
5292
|
+
.replace('$CUSTOM_EXPORTS_CODE$', () => exportsCode)
|
|
5293
|
+
.replace('$MODULE$', () => body);
|
|
5294
|
+
}
|
|
5249
5295
|
wrapWithCustom(body) {
|
|
5250
5296
|
let opts = this.solution.opts.package;
|
|
5251
5297
|
let template = Templates_1.Templates.load(opts.moduleWrapperCustomPath);
|
package/lib/cli.js
CHANGED
|
@@ -4955,6 +4955,41 @@ var __register, __require, require;
|
|
|
4955
4955
|
|
|
4956
4956
|
}));
|
|
4957
4957
|
|
|
4958
|
+
// end:source ./UMD.js
|
|
4959
|
+
`,
|
|
4960
|
+
ESM: `
|
|
4961
|
+
// source ./UMD.js
|
|
4962
|
+
(function (factory) {
|
|
4963
|
+
|
|
4964
|
+
var _name = '%NAME%',
|
|
4965
|
+
_global = typeof window === 'undefined' ? global : window,
|
|
4966
|
+
_module = {
|
|
4967
|
+
exports: {}
|
|
4968
|
+
};
|
|
4969
|
+
|
|
4970
|
+
factory(_module, _module.exports, _global);
|
|
4971
|
+
|
|
4972
|
+
if (typeof module === 'object' && module.exports) {
|
|
4973
|
+
module.exports = _module.exports;
|
|
4974
|
+
}
|
|
4975
|
+
|
|
4976
|
+
if (typeof define === 'function' && define.amd) {
|
|
4977
|
+
define([], function () {
|
|
4978
|
+
return _module.exports;
|
|
4979
|
+
});
|
|
4980
|
+
return;
|
|
4981
|
+
}
|
|
4982
|
+
|
|
4983
|
+
if (_name) {
|
|
4984
|
+
_global[_name] = _module.exports;
|
|
4985
|
+
}
|
|
4986
|
+
|
|
4987
|
+
}(function (module, exports, global) {
|
|
4988
|
+
|
|
4989
|
+
%MODULE%
|
|
4990
|
+
|
|
4991
|
+
}));
|
|
4992
|
+
|
|
4958
4993
|
// end:source ./UMD.js
|
|
4959
4994
|
`,
|
|
4960
4995
|
Style: `
|
|
@@ -5222,6 +5257,9 @@ class ModuleWrapper {
|
|
|
5222
5257
|
case 'umd':
|
|
5223
5258
|
body = this.wrapWithUMD(body);
|
|
5224
5259
|
break;
|
|
5260
|
+
case 'esm':
|
|
5261
|
+
body = this.wrapWithESM(body);
|
|
5262
|
+
break;
|
|
5225
5263
|
case 'custom':
|
|
5226
5264
|
body = this.wrapWithCustom(body);
|
|
5227
5265
|
break;
|
|
@@ -5248,6 +5286,14 @@ class ModuleWrapper {
|
|
|
5248
5286
|
.replace('%MODULE%', () => body)
|
|
5249
5287
|
.replace('%NAME%', () => name);
|
|
5250
5288
|
}
|
|
5289
|
+
wrapWithESM(body) {
|
|
5290
|
+
var opts = this.solution.opts.package;
|
|
5291
|
+
var exportsCode = opts.moduleExportsCode || '';
|
|
5292
|
+
return Templates_1.Templates
|
|
5293
|
+
.ESM
|
|
5294
|
+
.replace('$CUSTOM_EXPORTS_CODE$', () => exportsCode)
|
|
5295
|
+
.replace('$MODULE$', () => body);
|
|
5296
|
+
}
|
|
5251
5297
|
wrapWithCustom(body) {
|
|
5252
5298
|
let opts = this.solution.opts.package;
|
|
5253
5299
|
let template = Templates_1.Templates.load(opts.moduleWrapperCustomPath);
|