app-bundler 0.2.16 → 0.2.18

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.
Files changed (3) hide show
  1. package/lib/bundler.js +212 -95
  2. package/lib/cli.js +212 -95
  3. package/package.json +3 -2
package/lib/bundler.js CHANGED
@@ -1310,7 +1310,8 @@ const global_1 = _src_global;
1310
1310
  const atma_io_1 = require("atma-io");
1311
1311
  var Npm;
1312
1312
  (function (Npm) {
1313
- function resolveAppUrl(path, currentLocation, base) {
1313
+ function resolveAppUrl(path, currentLocation, opts) {
1314
+ let base = opts.base;
1314
1315
  let name = /^(@?[^\\\/]+)/.exec(path)[0];
1315
1316
  let resource = path.substring(name.length + 1);
1316
1317
  while (path != null) {
@@ -1329,14 +1330,9 @@ var Npm;
1329
1330
  dirname = (0, path_1.path_combine)(dirname, `/${subPackage}`, '/');
1330
1331
  resource = resource.substring(subPackage.length + 1);
1331
1332
  }
1332
- if (resource === '') {
1333
- let pkg = (0, path_1.path_combine)(dirname, 'package.json');
1334
- let json = global_1.io.File.read(pkg);
1335
- if (json) {
1336
- resource = json.main;
1337
- }
1338
- }
1339
- let filename = combineMain(dirname, resource);
1333
+ let pkg = (0, path_1.path_combine)(dirname, 'package.json');
1334
+ let json = global_1.io.File.read(pkg);
1335
+ let filename = resolveAppUrlFromPackageJson(dirname, json, resource, opts);
1340
1336
  if (base) {
1341
1337
  if (base.endsWith('/') === false) {
1342
1338
  // Base path must be a folder
@@ -1353,6 +1349,89 @@ var Npm;
1353
1349
  return null;
1354
1350
  }
1355
1351
  Npm.resolveAppUrl = resolveAppUrl;
1352
+ function resolveAppUrlFromPackageJson(pkgDir, pkg, subPath, opts) {
1353
+ var _a;
1354
+ if (pkg.main == null && pkg.exports == null) {
1355
+ return combineMain(pkgDir, subPath);
1356
+ }
1357
+ if (pkg.exports == null) {
1358
+ return combineMain(pkgDir, subPath || pkg.main);
1359
+ }
1360
+ if (typeof pkg.exports === 'string') {
1361
+ return combineMain(pkgDir, subPath || pkg.exports);
1362
+ }
1363
+ const moduleExportsMap = 'require';
1364
+ const conditionExportsMap = (_a = opts.package.platform) !== null && _a !== void 0 ? _a : 'node';
1365
+ let libraryFilePath = fromExports(pkg.exports, subPath, {
1366
+ moduleExports: moduleExportsMap,
1367
+ conditionExports: conditionExportsMap,
1368
+ pkgDir,
1369
+ });
1370
+ return combineMain(pkgDir, libraryFilePath);
1371
+ }
1372
+ Npm.resolveAppUrlFromPackageJson = resolveAppUrlFromPackageJson;
1373
+ function fromExports(exports, subPath, opts) {
1374
+ var _a;
1375
+ if (exports == null) {
1376
+ throw new Error(`Invalid exports for ${subPath}`);
1377
+ }
1378
+ if (typeof exports === 'object') {
1379
+ exports = extractConditional(exports, opts);
1380
+ }
1381
+ if (typeof exports === 'object') {
1382
+ // TExportsMap
1383
+ let map = exports;
1384
+ if (!subPath) {
1385
+ let dot = '.';
1386
+ if (map[dot] == null) {
1387
+ throw new Error(`Missing default "." export in exports for ${JSON.stringify(exports)}`);
1388
+ }
1389
+ return extractConditional(map[dot], opts);
1390
+ }
1391
+ for (let tpl in exports) {
1392
+ let mapped = extractConditional(exports[tpl], opts);
1393
+ if (typeof mapped !== 'string') {
1394
+ throw new Error(`Invalid conditional exports for ${JSON.stringify(exports)} in ${(_a = opts.pkgDir) !== null && _a !== void 0 ? _a : subPath}`);
1395
+ }
1396
+ if (tpl.startsWith('./')) {
1397
+ tpl = tpl.substring(2);
1398
+ if (tpl === '*') {
1399
+ return mapped.replace('*', subPath);
1400
+ }
1401
+ let globIndex = tpl.indexOf('*');
1402
+ if (globIndex === -1 && tpl === subPath) {
1403
+ return mapped;
1404
+ }
1405
+ if (globIndex > -1) {
1406
+ let tplPfx = tpl.substring(0, globIndex).replace(/\/+$/, '');
1407
+ if (subPath.startsWith(tplPfx)) {
1408
+ let subPathSfx = subPath.replace(tplPfx, '');
1409
+ return mapped.replace('*', subPathSfx);
1410
+ }
1411
+ }
1412
+ }
1413
+ }
1414
+ }
1415
+ if (typeof exports === 'string') {
1416
+ return exports;
1417
+ }
1418
+ throw new Error(`Path can't be mapped ${JSON.stringify(exports)}`);
1419
+ }
1420
+ function extractConditional(exports, opts) {
1421
+ if (exports == null || typeof exports !== 'object') {
1422
+ return exports;
1423
+ }
1424
+ if (opts.conditionExports in exports) {
1425
+ return extractConditional(exports[opts.conditionExports], opts);
1426
+ }
1427
+ if (opts.moduleExports in exports) {
1428
+ return extractConditional(exports[opts.moduleExports], opts);
1429
+ }
1430
+ if ('default' in exports) {
1431
+ return extractConditional(exports['default'], opts);
1432
+ }
1433
+ return exports;
1434
+ }
1356
1435
  function combineMain(directory, filename) {
1357
1436
  filename !== null && filename !== void 0 ? filename : (filename = 'index.js');
1358
1437
  let path = (0, path_1.path_combine)(directory, filename);
@@ -1515,7 +1594,7 @@ class Resource {
1515
1594
  }
1516
1595
  if (Include_1.Include.PathResolver.isNpm(includeData.url)) {
1517
1596
  this.aliases.push(includeData.url);
1518
- let byNpmResolver = npm_1.Npm.resolveAppUrl(includeData.url, parent && parent.location, solution.opts.base);
1597
+ let byNpmResolver = npm_1.Npm.resolveAppUrl(includeData.url, parent && parent.location, solution.opts);
1519
1598
  if (byNpmResolver != null) {
1520
1599
  // otherwise "url" could be previously resolved with pathResolver.resolve
1521
1600
  url = byNpmResolver;
@@ -1525,6 +1604,15 @@ class Resource {
1525
1604
  url = includeData.url;
1526
1605
  }
1527
1606
  }
1607
+ if (includeData.route != null) {
1608
+ let { path, alias } = includeData.route;
1609
+ if (path && Include_1.Include.PathResolver.isNpm(path) && this.aliases.includes(path) === false) {
1610
+ this.aliases.push(path);
1611
+ }
1612
+ if (alias && Include_1.Include.PathResolver.isNpm(alias) && this.aliases.includes(alias) === false) {
1613
+ this.aliases.push(alias);
1614
+ }
1615
+ }
1528
1616
  let mappedUrl = this.solution.mapUrl(url);
1529
1617
  if (mappedUrl != url) {
1530
1618
  console.log(`URL mapped: ${url} => ${mappedUrl}`);
@@ -4697,10 +4785,10 @@ const global_1 = _src_global;
4697
4785
  exports.Templates = {
4698
4786
  Module: `
4699
4787
  // source ./Module.js
4700
- __register("%MODULE_PATH%", function(require, module, exports, __filename, __dirname){
4701
- %MODULE%
4788
+ __register(%MODULE_PATH%, %MODULE_ALIASES%, function(require, module, exports, __filename, __dirname){
4789
+ %MODULE%
4702
4790
 
4703
- %FOOTER%
4791
+ %FOOTER%
4704
4792
  });
4705
4793
 
4706
4794
  // end:source ./Module.js
@@ -4876,32 +4964,49 @@ var __register, __require, require;
4876
4964
 
4877
4965
  var __global = typeof global !== 'undefined' && global ? global : window;
4878
4966
  var __nativeRequire = __global.require || require;
4879
- var __originalRequire = function (path_) {
4880
- var path = typeof include !== 'undefined' && typeof include.resolvePath === 'function'
4881
- ? include.resolvePath(path_)
4882
- : path_resolveUrl(path_, this.location);
4883
-
4884
- if (modules[path]) {
4885
- return modules[path].runOnce();
4967
+ var __bundlerRequire = function (path_) {
4968
+ var arr = [
4969
+ path_resolveUrl(path_, this.location)
4970
+ ];
4971
+ if (typeof include !== 'undefined' && typeof include.resolvePath === 'function') {
4972
+ arr.push(include.resolvePath(path_));
4886
4973
  }
4887
- var pathWithoutExt = path.replace(/\\.\\w+$/, '').toLowerCase();
4974
+ if (/^[@\\w]/.test(path_)) {
4975
+ arr.push(path_);
4976
+ }
4977
+ for (var i = 0; i < arr.length; i++) {
4978
+ if (arr[i] in modules) {
4979
+ return modules[arr[i]].runOnce();
4980
+ }
4981
+ }
4982
+
4888
4983
  for (var key in modules) {
4889
4984
  var $pathWithoutExt = key.replace(/\\.\\w+$/, '').toLowerCase();
4890
- if ($pathWithoutExt === pathWithoutExt) {
4891
- let module = modules[path] = modules[key];
4892
- return module.runOnce();
4985
+ for (var i = 0; i < arr.length; i++) {
4986
+ var path = arr[i];
4987
+ var pathWithoutExt = path.replace(/\\.\\w+$/, '').toLowerCase();
4988
+ if ($pathWithoutExt === pathWithoutExt) {
4989
+ let module = modules[path] = modules[key];
4990
+ return module.runOnce();
4991
+ }
4893
4992
  }
4894
4993
  }
4895
4994
 
4896
4995
  return __nativeRequire(path_);
4897
4996
  };
4898
4997
 
4899
- __register = function (path, factory) {
4998
+ __register = function (path, aliases, factory) {
4900
4999
  var filename = path_resolveUrl(path);
4901
- modules[filename] = new Module(filename, factory);
5000
+ var module = new Module(filename, factory);
5001
+ modules[filename] = module;
5002
+ if (aliases) {
5003
+ aliases.forEach(alias => {
5004
+ modules[alias] = module;
5005
+ })
5006
+ }
4902
5007
  };
4903
5008
 
4904
- __require =__originalRequire.bind({ location: path_getDir(path_resolveUrl('%ROOT_DIR%')) });
5009
+ __require =__bundlerRequire.bind({ location: path_getDir(path_resolveUrl('%ROOT_DIR%')) });
4905
5010
 
4906
5011
  var modules = {};
4907
5012
  var Module = function(filename, factory){
@@ -4914,7 +5019,7 @@ var __register, __require, require;
4914
5019
  if (this.exports != null) {
4915
5020
  return this.exports;
4916
5021
  }
4917
- var require = __originalRequire.bind({
5022
+ var require = __bundlerRequire.bind({
4918
5023
  location: this.dirname
4919
5024
  });
4920
5025
  this.exports = {};
@@ -6107,7 +6212,7 @@ class CommonJsBuilder extends BaseScriptBuilder_1.BaseScriptBuilder {
6107
6212
  super(solution, handler);
6108
6213
  this.solution = solution;
6109
6214
  this.handler = handler;
6110
- var opts = this.solution.opts.package.commonjs;
6215
+ let opts = this.solution.opts.package.commonjs;
6111
6216
  if (opts && opts.output === 'simplified') {
6112
6217
  this.wrapModule = CommonJsBuilderSimplified_1.CommonJsBuilderSimplified.wrapModule;
6113
6218
  this.getRootContent = CommonJsBuilderSimplified_1.CommonJsBuilderSimplified.getRootContent;
@@ -6125,7 +6230,7 @@ class CommonJsBuilder extends BaseScriptBuilder_1.BaseScriptBuilder {
6125
6230
  return module === 'commonjs';
6126
6231
  }
6127
6232
  wrapModule(resource, outputItem, outputItems, setts) {
6128
- var opts = this.solution.iteration;
6233
+ let opts = this.solution.iteration;
6129
6234
  if (opts.commonjs == null) {
6130
6235
  opts.commonjs = {
6131
6236
  addHeading: true,
@@ -6133,21 +6238,22 @@ class CommonJsBuilder extends BaseScriptBuilder_1.BaseScriptBuilder {
6133
6238
  };
6134
6239
  }
6135
6240
  ;
6136
- var body = '';
6241
+ let body = '';
6137
6242
  if (opts.commonjs.hasHeading === false && opts.commonjs.addHeading === true) {
6138
6243
  opts.commonjs.hasHeading = true;
6139
6244
  body = this.getHeaderContent();
6140
6245
  }
6141
- var { url, content } = resource;
6142
- var module = Templates_1.Templates
6246
+ let { url, content, aliases } = resource;
6247
+ let module = Templates_1.Templates
6143
6248
  .Module
6144
- .replace('%MODULE_PATH%', () => url)
6249
+ .replace('%MODULE_PATH%', () => `"${url}"`)
6250
+ .replace('%MODULE_ALIASES%', JSON.stringify(aliases !== null && aliases !== void 0 ? aliases : []))
6145
6251
  .replace('%MODULE%', () => content)
6146
6252
  .replace('%FOOTER%', () => { var _a, _b; return ((_b = (_a = setts === null || setts === void 0 ? void 0 : setts.partials) === null || _a === void 0 ? void 0 : _a.footer) !== null && _b !== void 0 ? _b : ''); });
6147
6253
  return body + module;
6148
6254
  }
6149
6255
  getHeaderContent() {
6150
- var mainUrl = this.solution.outputResources.rootInput.url;
6256
+ let mainUrl = this.solution.outputResources.rootInput.url;
6151
6257
  return Templates_1.Templates
6152
6258
  .Header
6153
6259
  .replace('%ROOT_DIR%', () => mainUrl);
@@ -6168,7 +6274,7 @@ class CommonJsBuilder extends BaseScriptBuilder_1.BaseScriptBuilder {
6168
6274
  })
6169
6275
  .concat([content])
6170
6276
  .join('\n');
6171
- var wrapper = new ModuleWrapper_1.ModuleWrapper(this.solution);
6277
+ let wrapper = new ModuleWrapper_1.ModuleWrapper(this.solution);
6172
6278
  root.content = wrapper.wrap(body);
6173
6279
  }
6174
6280
  getRootContent(root, outputDependencies) {
@@ -6209,8 +6315,7 @@ var _src_handlers_script_common_js_CommonJsPathResolver;
6209
6315
  Object.defineProperty(exports, "__esModule", { value: true });
6210
6316
  exports.CommonJsPathResolver = void 0;
6211
6317
  const BasePathResolver_1 = _src_handlers_base_BasePathResolver;
6212
- const path_1 = _src_utils_path;
6213
- const global_1 = _src_global;
6318
+ const npm_1 = _src_utils_npm;
6214
6319
  class CommonJsPathResolver extends BasePathResolver_1.BasePathResolver {
6215
6320
  accepts(includeData) {
6216
6321
  if (includeData.type !== 'js' || includeData.module !== 'commonjs') {
@@ -6225,7 +6330,7 @@ class CommonJsPathResolver extends BasePathResolver_1.BasePathResolver {
6225
6330
  return true;
6226
6331
  }
6227
6332
  resolve(includeData, parentResource) {
6228
- let filename = nodeModuleResolve(includeData.url, parentResource.directory);
6333
+ let filename = npm_1.Npm.resolveAppUrl(includeData.url, parentResource.directory, this.solution.opts);
6229
6334
  if (filename) {
6230
6335
  let url = this.solution.opts.toAppUrl(filename);
6231
6336
  this.solution.opts.mappings[includeData.url] = url;
@@ -6241,49 +6346,49 @@ const nodeCoreModules = [
6241
6346
  'process', 'punycode', 'querystring', 'readline', 'repl', 'stream', 'string_decoder', 'sys', 'timers',
6242
6347
  'tls', 'tty', 'url', 'util', 'vm', 'zlib'
6243
6348
  ];
6244
- function nodeModuleResolve(path, location_) {
6245
- let location = location_.replace(/[\\\/]+$/, '');
6246
- let name = /^([\w\-]+)/.exec(path)[0];
6247
- let resource = path.substring(name.length + 1);
6248
- let current = location;
6249
- let root_ = current + '/node_modules/' + name + '/';
6250
- while (true) {
6251
- let nodeModules = (0, path_1.path_combine)(current, '/node_modules/' + name + '/');
6252
- let pckg = nodeModules + 'package.json';
6253
- if (global_1.io.File.exists(pckg) === false) {
6254
- let next = current.replace(/[^\/\\]+[\/\\]?$/, '');
6255
- if (next === current) {
6256
- return root_ + 'package.json';
6257
- }
6258
- current = next;
6259
- continue;
6260
- }
6261
- if (resource) {
6262
- let path = nodeModules + resource;
6263
- if (hasExt(path) === false) {
6264
- let likelyTs = path.includes('/src/');
6265
- if (likelyTs) {
6266
- if (global_1.io.File.exists(path + '.ts')) {
6267
- return path + '.ts';
6268
- }
6269
- }
6270
- return path + '.js';
6271
- }
6272
- return path;
6273
- }
6274
- let json = global_1.io.File.read(pckg);
6275
- if (typeof json === 'string') {
6276
- json = JSON.parse(json);
6277
- }
6278
- if (json.main) {
6279
- return (0, path_1.path_combine)(nodeModules, json.main);
6280
- }
6281
- return nodeModules + 'index.js';
6282
- }
6283
- }
6284
- function hasExt(path) {
6285
- return /\.[\w]{1,8}($|\?)/.test(path);
6286
- }
6349
+ // function nodeModuleResolve(path, location_){
6350
+ // let location = location_.replace(/[\\\/]+$/, '');
6351
+ // let name = /^([\w\-]+)/.exec(path)[0];
6352
+ // let resource = path.substring(name.length + 1);
6353
+ // let current = location;
6354
+ // let root_ = current + '/node_modules/' + name + '/';
6355
+ // while (true) {
6356
+ // let nodeModules = path_combine(current, '/node_modules/' + name + '/');
6357
+ // let pkg = nodeModules + 'package.json';
6358
+ // if (io.File.exists(pkg) === false) {
6359
+ // let next = current.replace(/[^\/\\]+[\/\\]?$/, '');
6360
+ // if (next === current) {
6361
+ // return root_ + 'package.json';
6362
+ // }
6363
+ // current = next;
6364
+ // continue;
6365
+ // }
6366
+ // if (resource) {
6367
+ // let path = nodeModules + resource;
6368
+ // if (hasExt(path) === false) {
6369
+ // let likelyTs = path.includes('/src/');
6370
+ // if (likelyTs) {
6371
+ // if (io.File.exists(path + '.ts')) {
6372
+ // return path + '.ts';
6373
+ // }
6374
+ // }
6375
+ // return path + '.js';
6376
+ // }
6377
+ // return path;
6378
+ // }
6379
+ // let json = io.File.read(pkg);
6380
+ // if (typeof json === 'string') {
6381
+ // json = JSON.parse(json);
6382
+ // }
6383
+ // if (json.main) {
6384
+ // return path_combine(nodeModules, json.main)
6385
+ // }
6386
+ // return nodeModules + 'index.js';
6387
+ // }
6388
+ // }
6389
+ // function hasExt(path) {
6390
+ // return /\.[\w]{1,8}($|\?)/.test(path);
6391
+ // }
6287
6392
  //# sourceMappingURL=CommonJsPathResolver.js.map
6288
6393
  //# sourceMappingURL=CommonJsPathResolver.ts.map;
6289
6394
 
@@ -7875,8 +7980,11 @@ class DataInliner extends BaseRewriter_1.BaseRewriter {
7875
7980
  rewritePartial(content, ownerResource) {
7876
7981
  }
7877
7982
  async rewriteResource(resource) {
7983
+ if (resource.dependencies == null) {
7984
+ return;
7985
+ }
7878
7986
  for (let res of resource.dependencies) {
7879
- if (/(json|yml)$/.test(res.url) === false) {
7987
+ if (/\.(json|yml)$/.test(res.url) === false) {
7880
7988
  continue;
7881
7989
  }
7882
7990
  if (res.import != null) {
@@ -7907,6 +8015,7 @@ class DataInliner extends BaseRewriter_1.BaseRewriter {
7907
8015
  let i = resource.dependencies.indexOf(dep);
7908
8016
  resource.dependencies.splice(i, 1);
7909
8017
  this.solution.outputResources.remove(dep.resource);
8018
+ this.solution.reporter.info(`Inlining import data from ${dep.url}`);
7910
8019
  }
7911
8020
  rewriteRequire(resource, dep) {
7912
8021
  let rgx = new RegExp(`require\\s*\\(\\s*['"]${dep.url}['"]\\s*\\)\\s*;?`);
@@ -7925,6 +8034,7 @@ class DataInliner extends BaseRewriter_1.BaseRewriter {
7925
8034
  let i = resource.dependencies.indexOf(dep);
7926
8035
  resource.dependencies.splice(i, 1);
7927
8036
  this.solution.outputResources.remove(dep.resource);
8037
+ this.solution.reporter.info(`Inlining require data from ${dep.url}`);
7928
8038
  }
7929
8039
  }
7930
8040
  exports.DataInliner = DataInliner;
@@ -11751,6 +11861,13 @@ var ResourceLoader;
11751
11861
  loader.process();
11752
11862
  }
11753
11863
  else {
11864
+ // Merge aliases to the current cached resource
11865
+ if (resource.aliases.length > 0) {
11866
+ loader.resource.aliases = (0, alot_1.default)([
11867
+ ...loader.resource.aliases,
11868
+ ...resource.aliases
11869
+ ]).distinct().toArray();
11870
+ }
11754
11871
  // Try to find the resource in ancestors
11755
11872
  let res = tryGetCyclicRoot(resource);
11756
11873
  if (res != null) {
@@ -11898,12 +12015,13 @@ var ResourceLoader;
11898
12015
  resources.forEach((res, i) => {
11899
12016
  let dep = deps[i];
11900
12017
  if (res.isMapped) {
11901
- let str = this.resource.content.replace(dep.url, res.url);
11902
- if (str === this.resource.content) {
11903
- throw new Error(`Mapped url was not replaced: ${dep.url}`);
11904
- }
11905
- this.resource.content = str;
11906
- dep.url = res.url;
12018
+ // do not replace in source
12019
+ // let str = this.resource.content.replace(dep.url, res.url);
12020
+ // if (str === this.resource.content) {
12021
+ // throw new Error(`Mapped url was not replaced: ${dep.url}`);
12022
+ // }
12023
+ // this.resource.content = str;
12024
+ // dep.url = res.url;
11907
12025
  }
11908
12026
  });
11909
12027
  this.resource.resources.push(...resources);
@@ -12140,8 +12258,8 @@ exports.Builder = {
12140
12258
  .then(buildRoot)
12141
12259
  .then(() => solution.outputResources.getAll());
12142
12260
  });
12143
- function rewriteDependenciesInternal(resources) {
12144
- let promises = resources.map(resource => {
12261
+ async function rewriteDependenciesInternal(resources) {
12262
+ await (0, alot_1.default)(resources).forEachAsync(async (resource, i) => {
12145
12263
  let ext = (0, path_1.path_getExtension)(resource.url);
12146
12264
  let handler = solution.handlers.find(x => x.rewriter.accepts(ext));
12147
12265
  if (handler == null) {
@@ -12150,9 +12268,8 @@ exports.Builder = {
12150
12268
  if (handler == null) {
12151
12269
  throw Error('Rewriter not found for the resource: ' + resource.url);
12152
12270
  }
12153
- return handler.rewriter.rewriteResource(resource);
12154
- });
12155
- return (0, async_1.async_whenAll)(promises);
12271
+ await handler.rewriter.rewriteResource(resource);
12272
+ }).toArrayAsync({ threads: 1 });
12156
12273
  }
12157
12274
  function rewriteRoot() {
12158
12275
  return (0, async_1.async_run)(() => {
@@ -12393,7 +12510,7 @@ class Bundler extends atma_utils_1.class_EventEmitter {
12393
12510
  if (typeof content !== 'string') {
12394
12511
  content = JSON.stringify(content, null, 2);
12395
12512
  }
12396
- File_1.FileActions.writeFile(res.filename, content, { skipHooks: true });
12513
+ File_1.FileActions.writeFile(res.filename, content, { skipHooks: false });
12397
12514
  });
12398
12515
  return solution
12399
12516
  .assetsManager
package/lib/cli.js CHANGED
@@ -1312,7 +1312,8 @@ const global_1 = _src_global;
1312
1312
  const atma_io_1 = require("atma-io");
1313
1313
  var Npm;
1314
1314
  (function (Npm) {
1315
- function resolveAppUrl(path, currentLocation, base) {
1315
+ function resolveAppUrl(path, currentLocation, opts) {
1316
+ let base = opts.base;
1316
1317
  let name = /^(@?[^\\\/]+)/.exec(path)[0];
1317
1318
  let resource = path.substring(name.length + 1);
1318
1319
  while (path != null) {
@@ -1331,14 +1332,9 @@ var Npm;
1331
1332
  dirname = (0, path_1.path_combine)(dirname, `/${subPackage}`, '/');
1332
1333
  resource = resource.substring(subPackage.length + 1);
1333
1334
  }
1334
- if (resource === '') {
1335
- let pkg = (0, path_1.path_combine)(dirname, 'package.json');
1336
- let json = global_1.io.File.read(pkg);
1337
- if (json) {
1338
- resource = json.main;
1339
- }
1340
- }
1341
- let filename = combineMain(dirname, resource);
1335
+ let pkg = (0, path_1.path_combine)(dirname, 'package.json');
1336
+ let json = global_1.io.File.read(pkg);
1337
+ let filename = resolveAppUrlFromPackageJson(dirname, json, resource, opts);
1342
1338
  if (base) {
1343
1339
  if (base.endsWith('/') === false) {
1344
1340
  // Base path must be a folder
@@ -1355,6 +1351,89 @@ var Npm;
1355
1351
  return null;
1356
1352
  }
1357
1353
  Npm.resolveAppUrl = resolveAppUrl;
1354
+ function resolveAppUrlFromPackageJson(pkgDir, pkg, subPath, opts) {
1355
+ var _a;
1356
+ if (pkg.main == null && pkg.exports == null) {
1357
+ return combineMain(pkgDir, subPath);
1358
+ }
1359
+ if (pkg.exports == null) {
1360
+ return combineMain(pkgDir, subPath || pkg.main);
1361
+ }
1362
+ if (typeof pkg.exports === 'string') {
1363
+ return combineMain(pkgDir, subPath || pkg.exports);
1364
+ }
1365
+ const moduleExportsMap = 'require';
1366
+ const conditionExportsMap = (_a = opts.package.platform) !== null && _a !== void 0 ? _a : 'node';
1367
+ let libraryFilePath = fromExports(pkg.exports, subPath, {
1368
+ moduleExports: moduleExportsMap,
1369
+ conditionExports: conditionExportsMap,
1370
+ pkgDir,
1371
+ });
1372
+ return combineMain(pkgDir, libraryFilePath);
1373
+ }
1374
+ Npm.resolveAppUrlFromPackageJson = resolveAppUrlFromPackageJson;
1375
+ function fromExports(exports, subPath, opts) {
1376
+ var _a;
1377
+ if (exports == null) {
1378
+ throw new Error(`Invalid exports for ${subPath}`);
1379
+ }
1380
+ if (typeof exports === 'object') {
1381
+ exports = extractConditional(exports, opts);
1382
+ }
1383
+ if (typeof exports === 'object') {
1384
+ // TExportsMap
1385
+ let map = exports;
1386
+ if (!subPath) {
1387
+ let dot = '.';
1388
+ if (map[dot] == null) {
1389
+ throw new Error(`Missing default "." export in exports for ${JSON.stringify(exports)}`);
1390
+ }
1391
+ return extractConditional(map[dot], opts);
1392
+ }
1393
+ for (let tpl in exports) {
1394
+ let mapped = extractConditional(exports[tpl], opts);
1395
+ if (typeof mapped !== 'string') {
1396
+ throw new Error(`Invalid conditional exports for ${JSON.stringify(exports)} in ${(_a = opts.pkgDir) !== null && _a !== void 0 ? _a : subPath}`);
1397
+ }
1398
+ if (tpl.startsWith('./')) {
1399
+ tpl = tpl.substring(2);
1400
+ if (tpl === '*') {
1401
+ return mapped.replace('*', subPath);
1402
+ }
1403
+ let globIndex = tpl.indexOf('*');
1404
+ if (globIndex === -1 && tpl === subPath) {
1405
+ return mapped;
1406
+ }
1407
+ if (globIndex > -1) {
1408
+ let tplPfx = tpl.substring(0, globIndex).replace(/\/+$/, '');
1409
+ if (subPath.startsWith(tplPfx)) {
1410
+ let subPathSfx = subPath.replace(tplPfx, '');
1411
+ return mapped.replace('*', subPathSfx);
1412
+ }
1413
+ }
1414
+ }
1415
+ }
1416
+ }
1417
+ if (typeof exports === 'string') {
1418
+ return exports;
1419
+ }
1420
+ throw new Error(`Path can't be mapped ${JSON.stringify(exports)}`);
1421
+ }
1422
+ function extractConditional(exports, opts) {
1423
+ if (exports == null || typeof exports !== 'object') {
1424
+ return exports;
1425
+ }
1426
+ if (opts.conditionExports in exports) {
1427
+ return extractConditional(exports[opts.conditionExports], opts);
1428
+ }
1429
+ if (opts.moduleExports in exports) {
1430
+ return extractConditional(exports[opts.moduleExports], opts);
1431
+ }
1432
+ if ('default' in exports) {
1433
+ return extractConditional(exports['default'], opts);
1434
+ }
1435
+ return exports;
1436
+ }
1358
1437
  function combineMain(directory, filename) {
1359
1438
  filename !== null && filename !== void 0 ? filename : (filename = 'index.js');
1360
1439
  let path = (0, path_1.path_combine)(directory, filename);
@@ -1517,7 +1596,7 @@ class Resource {
1517
1596
  }
1518
1597
  if (Include_1.Include.PathResolver.isNpm(includeData.url)) {
1519
1598
  this.aliases.push(includeData.url);
1520
- let byNpmResolver = npm_1.Npm.resolveAppUrl(includeData.url, parent && parent.location, solution.opts.base);
1599
+ let byNpmResolver = npm_1.Npm.resolveAppUrl(includeData.url, parent && parent.location, solution.opts);
1521
1600
  if (byNpmResolver != null) {
1522
1601
  // otherwise "url" could be previously resolved with pathResolver.resolve
1523
1602
  url = byNpmResolver;
@@ -1527,6 +1606,15 @@ class Resource {
1527
1606
  url = includeData.url;
1528
1607
  }
1529
1608
  }
1609
+ if (includeData.route != null) {
1610
+ let { path, alias } = includeData.route;
1611
+ if (path && Include_1.Include.PathResolver.isNpm(path) && this.aliases.includes(path) === false) {
1612
+ this.aliases.push(path);
1613
+ }
1614
+ if (alias && Include_1.Include.PathResolver.isNpm(alias) && this.aliases.includes(alias) === false) {
1615
+ this.aliases.push(alias);
1616
+ }
1617
+ }
1530
1618
  let mappedUrl = this.solution.mapUrl(url);
1531
1619
  if (mappedUrl != url) {
1532
1620
  console.log(`URL mapped: ${url} => ${mappedUrl}`);
@@ -4699,10 +4787,10 @@ const global_1 = _src_global;
4699
4787
  exports.Templates = {
4700
4788
  Module: `
4701
4789
  // source ./Module.js
4702
- __register("%MODULE_PATH%", function(require, module, exports, __filename, __dirname){
4703
- %MODULE%
4790
+ __register(%MODULE_PATH%, %MODULE_ALIASES%, function(require, module, exports, __filename, __dirname){
4791
+ %MODULE%
4704
4792
 
4705
- %FOOTER%
4793
+ %FOOTER%
4706
4794
  });
4707
4795
 
4708
4796
  // end:source ./Module.js
@@ -4878,32 +4966,49 @@ var __register, __require, require;
4878
4966
 
4879
4967
  var __global = typeof global !== 'undefined' && global ? global : window;
4880
4968
  var __nativeRequire = __global.require || require;
4881
- var __originalRequire = function (path_) {
4882
- var path = typeof include !== 'undefined' && typeof include.resolvePath === 'function'
4883
- ? include.resolvePath(path_)
4884
- : path_resolveUrl(path_, this.location);
4885
-
4886
- if (modules[path]) {
4887
- return modules[path].runOnce();
4969
+ var __bundlerRequire = function (path_) {
4970
+ var arr = [
4971
+ path_resolveUrl(path_, this.location)
4972
+ ];
4973
+ if (typeof include !== 'undefined' && typeof include.resolvePath === 'function') {
4974
+ arr.push(include.resolvePath(path_));
4888
4975
  }
4889
- var pathWithoutExt = path.replace(/\\.\\w+$/, '').toLowerCase();
4976
+ if (/^[@\\w]/.test(path_)) {
4977
+ arr.push(path_);
4978
+ }
4979
+ for (var i = 0; i < arr.length; i++) {
4980
+ if (arr[i] in modules) {
4981
+ return modules[arr[i]].runOnce();
4982
+ }
4983
+ }
4984
+
4890
4985
  for (var key in modules) {
4891
4986
  var $pathWithoutExt = key.replace(/\\.\\w+$/, '').toLowerCase();
4892
- if ($pathWithoutExt === pathWithoutExt) {
4893
- let module = modules[path] = modules[key];
4894
- return module.runOnce();
4987
+ for (var i = 0; i < arr.length; i++) {
4988
+ var path = arr[i];
4989
+ var pathWithoutExt = path.replace(/\\.\\w+$/, '').toLowerCase();
4990
+ if ($pathWithoutExt === pathWithoutExt) {
4991
+ let module = modules[path] = modules[key];
4992
+ return module.runOnce();
4993
+ }
4895
4994
  }
4896
4995
  }
4897
4996
 
4898
4997
  return __nativeRequire(path_);
4899
4998
  };
4900
4999
 
4901
- __register = function (path, factory) {
5000
+ __register = function (path, aliases, factory) {
4902
5001
  var filename = path_resolveUrl(path);
4903
- modules[filename] = new Module(filename, factory);
5002
+ var module = new Module(filename, factory);
5003
+ modules[filename] = module;
5004
+ if (aliases) {
5005
+ aliases.forEach(alias => {
5006
+ modules[alias] = module;
5007
+ })
5008
+ }
4904
5009
  };
4905
5010
 
4906
- __require =__originalRequire.bind({ location: path_getDir(path_resolveUrl('%ROOT_DIR%')) });
5011
+ __require =__bundlerRequire.bind({ location: path_getDir(path_resolveUrl('%ROOT_DIR%')) });
4907
5012
 
4908
5013
  var modules = {};
4909
5014
  var Module = function(filename, factory){
@@ -4916,7 +5021,7 @@ var __register, __require, require;
4916
5021
  if (this.exports != null) {
4917
5022
  return this.exports;
4918
5023
  }
4919
- var require = __originalRequire.bind({
5024
+ var require = __bundlerRequire.bind({
4920
5025
  location: this.dirname
4921
5026
  });
4922
5027
  this.exports = {};
@@ -6109,7 +6214,7 @@ class CommonJsBuilder extends BaseScriptBuilder_1.BaseScriptBuilder {
6109
6214
  super(solution, handler);
6110
6215
  this.solution = solution;
6111
6216
  this.handler = handler;
6112
- var opts = this.solution.opts.package.commonjs;
6217
+ let opts = this.solution.opts.package.commonjs;
6113
6218
  if (opts && opts.output === 'simplified') {
6114
6219
  this.wrapModule = CommonJsBuilderSimplified_1.CommonJsBuilderSimplified.wrapModule;
6115
6220
  this.getRootContent = CommonJsBuilderSimplified_1.CommonJsBuilderSimplified.getRootContent;
@@ -6127,7 +6232,7 @@ class CommonJsBuilder extends BaseScriptBuilder_1.BaseScriptBuilder {
6127
6232
  return module === 'commonjs';
6128
6233
  }
6129
6234
  wrapModule(resource, outputItem, outputItems, setts) {
6130
- var opts = this.solution.iteration;
6235
+ let opts = this.solution.iteration;
6131
6236
  if (opts.commonjs == null) {
6132
6237
  opts.commonjs = {
6133
6238
  addHeading: true,
@@ -6135,21 +6240,22 @@ class CommonJsBuilder extends BaseScriptBuilder_1.BaseScriptBuilder {
6135
6240
  };
6136
6241
  }
6137
6242
  ;
6138
- var body = '';
6243
+ let body = '';
6139
6244
  if (opts.commonjs.hasHeading === false && opts.commonjs.addHeading === true) {
6140
6245
  opts.commonjs.hasHeading = true;
6141
6246
  body = this.getHeaderContent();
6142
6247
  }
6143
- var { url, content } = resource;
6144
- var module = Templates_1.Templates
6248
+ let { url, content, aliases } = resource;
6249
+ let module = Templates_1.Templates
6145
6250
  .Module
6146
- .replace('%MODULE_PATH%', () => url)
6251
+ .replace('%MODULE_PATH%', () => `"${url}"`)
6252
+ .replace('%MODULE_ALIASES%', JSON.stringify(aliases !== null && aliases !== void 0 ? aliases : []))
6147
6253
  .replace('%MODULE%', () => content)
6148
6254
  .replace('%FOOTER%', () => { var _a, _b; return ((_b = (_a = setts === null || setts === void 0 ? void 0 : setts.partials) === null || _a === void 0 ? void 0 : _a.footer) !== null && _b !== void 0 ? _b : ''); });
6149
6255
  return body + module;
6150
6256
  }
6151
6257
  getHeaderContent() {
6152
- var mainUrl = this.solution.outputResources.rootInput.url;
6258
+ let mainUrl = this.solution.outputResources.rootInput.url;
6153
6259
  return Templates_1.Templates
6154
6260
  .Header
6155
6261
  .replace('%ROOT_DIR%', () => mainUrl);
@@ -6170,7 +6276,7 @@ class CommonJsBuilder extends BaseScriptBuilder_1.BaseScriptBuilder {
6170
6276
  })
6171
6277
  .concat([content])
6172
6278
  .join('\n');
6173
- var wrapper = new ModuleWrapper_1.ModuleWrapper(this.solution);
6279
+ let wrapper = new ModuleWrapper_1.ModuleWrapper(this.solution);
6174
6280
  root.content = wrapper.wrap(body);
6175
6281
  }
6176
6282
  getRootContent(root, outputDependencies) {
@@ -6211,8 +6317,7 @@ var _src_handlers_script_common_js_CommonJsPathResolver;
6211
6317
  Object.defineProperty(exports, "__esModule", { value: true });
6212
6318
  exports.CommonJsPathResolver = void 0;
6213
6319
  const BasePathResolver_1 = _src_handlers_base_BasePathResolver;
6214
- const path_1 = _src_utils_path;
6215
- const global_1 = _src_global;
6320
+ const npm_1 = _src_utils_npm;
6216
6321
  class CommonJsPathResolver extends BasePathResolver_1.BasePathResolver {
6217
6322
  accepts(includeData) {
6218
6323
  if (includeData.type !== 'js' || includeData.module !== 'commonjs') {
@@ -6227,7 +6332,7 @@ class CommonJsPathResolver extends BasePathResolver_1.BasePathResolver {
6227
6332
  return true;
6228
6333
  }
6229
6334
  resolve(includeData, parentResource) {
6230
- let filename = nodeModuleResolve(includeData.url, parentResource.directory);
6335
+ let filename = npm_1.Npm.resolveAppUrl(includeData.url, parentResource.directory, this.solution.opts);
6231
6336
  if (filename) {
6232
6337
  let url = this.solution.opts.toAppUrl(filename);
6233
6338
  this.solution.opts.mappings[includeData.url] = url;
@@ -6243,49 +6348,49 @@ const nodeCoreModules = [
6243
6348
  'process', 'punycode', 'querystring', 'readline', 'repl', 'stream', 'string_decoder', 'sys', 'timers',
6244
6349
  'tls', 'tty', 'url', 'util', 'vm', 'zlib'
6245
6350
  ];
6246
- function nodeModuleResolve(path, location_) {
6247
- let location = location_.replace(/[\\\/]+$/, '');
6248
- let name = /^([\w\-]+)/.exec(path)[0];
6249
- let resource = path.substring(name.length + 1);
6250
- let current = location;
6251
- let root_ = current + '/node_modules/' + name + '/';
6252
- while (true) {
6253
- let nodeModules = (0, path_1.path_combine)(current, '/node_modules/' + name + '/');
6254
- let pckg = nodeModules + 'package.json';
6255
- if (global_1.io.File.exists(pckg) === false) {
6256
- let next = current.replace(/[^\/\\]+[\/\\]?$/, '');
6257
- if (next === current) {
6258
- return root_ + 'package.json';
6259
- }
6260
- current = next;
6261
- continue;
6262
- }
6263
- if (resource) {
6264
- let path = nodeModules + resource;
6265
- if (hasExt(path) === false) {
6266
- let likelyTs = path.includes('/src/');
6267
- if (likelyTs) {
6268
- if (global_1.io.File.exists(path + '.ts')) {
6269
- return path + '.ts';
6270
- }
6271
- }
6272
- return path + '.js';
6273
- }
6274
- return path;
6275
- }
6276
- let json = global_1.io.File.read(pckg);
6277
- if (typeof json === 'string') {
6278
- json = JSON.parse(json);
6279
- }
6280
- if (json.main) {
6281
- return (0, path_1.path_combine)(nodeModules, json.main);
6282
- }
6283
- return nodeModules + 'index.js';
6284
- }
6285
- }
6286
- function hasExt(path) {
6287
- return /\.[\w]{1,8}($|\?)/.test(path);
6288
- }
6351
+ // function nodeModuleResolve(path, location_){
6352
+ // let location = location_.replace(/[\\\/]+$/, '');
6353
+ // let name = /^([\w\-]+)/.exec(path)[0];
6354
+ // let resource = path.substring(name.length + 1);
6355
+ // let current = location;
6356
+ // let root_ = current + '/node_modules/' + name + '/';
6357
+ // while (true) {
6358
+ // let nodeModules = path_combine(current, '/node_modules/' + name + '/');
6359
+ // let pkg = nodeModules + 'package.json';
6360
+ // if (io.File.exists(pkg) === false) {
6361
+ // let next = current.replace(/[^\/\\]+[\/\\]?$/, '');
6362
+ // if (next === current) {
6363
+ // return root_ + 'package.json';
6364
+ // }
6365
+ // current = next;
6366
+ // continue;
6367
+ // }
6368
+ // if (resource) {
6369
+ // let path = nodeModules + resource;
6370
+ // if (hasExt(path) === false) {
6371
+ // let likelyTs = path.includes('/src/');
6372
+ // if (likelyTs) {
6373
+ // if (io.File.exists(path + '.ts')) {
6374
+ // return path + '.ts';
6375
+ // }
6376
+ // }
6377
+ // return path + '.js';
6378
+ // }
6379
+ // return path;
6380
+ // }
6381
+ // let json = io.File.read(pkg);
6382
+ // if (typeof json === 'string') {
6383
+ // json = JSON.parse(json);
6384
+ // }
6385
+ // if (json.main) {
6386
+ // return path_combine(nodeModules, json.main)
6387
+ // }
6388
+ // return nodeModules + 'index.js';
6389
+ // }
6390
+ // }
6391
+ // function hasExt(path) {
6392
+ // return /\.[\w]{1,8}($|\?)/.test(path);
6393
+ // }
6289
6394
  //# sourceMappingURL=CommonJsPathResolver.js.map
6290
6395
  //# sourceMappingURL=CommonJsPathResolver.ts.map;
6291
6396
 
@@ -7877,8 +7982,11 @@ class DataInliner extends BaseRewriter_1.BaseRewriter {
7877
7982
  rewritePartial(content, ownerResource) {
7878
7983
  }
7879
7984
  async rewriteResource(resource) {
7985
+ if (resource.dependencies == null) {
7986
+ return;
7987
+ }
7880
7988
  for (let res of resource.dependencies) {
7881
- if (/(json|yml)$/.test(res.url) === false) {
7989
+ if (/\.(json|yml)$/.test(res.url) === false) {
7882
7990
  continue;
7883
7991
  }
7884
7992
  if (res.import != null) {
@@ -7909,6 +8017,7 @@ class DataInliner extends BaseRewriter_1.BaseRewriter {
7909
8017
  let i = resource.dependencies.indexOf(dep);
7910
8018
  resource.dependencies.splice(i, 1);
7911
8019
  this.solution.outputResources.remove(dep.resource);
8020
+ this.solution.reporter.info(`Inlining import data from ${dep.url}`);
7912
8021
  }
7913
8022
  rewriteRequire(resource, dep) {
7914
8023
  let rgx = new RegExp(`require\\s*\\(\\s*['"]${dep.url}['"]\\s*\\)\\s*;?`);
@@ -7927,6 +8036,7 @@ class DataInliner extends BaseRewriter_1.BaseRewriter {
7927
8036
  let i = resource.dependencies.indexOf(dep);
7928
8037
  resource.dependencies.splice(i, 1);
7929
8038
  this.solution.outputResources.remove(dep.resource);
8039
+ this.solution.reporter.info(`Inlining require data from ${dep.url}`);
7930
8040
  }
7931
8041
  }
7932
8042
  exports.DataInliner = DataInliner;
@@ -11753,6 +11863,13 @@ var ResourceLoader;
11753
11863
  loader.process();
11754
11864
  }
11755
11865
  else {
11866
+ // Merge aliases to the current cached resource
11867
+ if (resource.aliases.length > 0) {
11868
+ loader.resource.aliases = (0, alot_1.default)([
11869
+ ...loader.resource.aliases,
11870
+ ...resource.aliases
11871
+ ]).distinct().toArray();
11872
+ }
11756
11873
  // Try to find the resource in ancestors
11757
11874
  let res = tryGetCyclicRoot(resource);
11758
11875
  if (res != null) {
@@ -11900,12 +12017,13 @@ var ResourceLoader;
11900
12017
  resources.forEach((res, i) => {
11901
12018
  let dep = deps[i];
11902
12019
  if (res.isMapped) {
11903
- let str = this.resource.content.replace(dep.url, res.url);
11904
- if (str === this.resource.content) {
11905
- throw new Error(`Mapped url was not replaced: ${dep.url}`);
11906
- }
11907
- this.resource.content = str;
11908
- dep.url = res.url;
12020
+ // do not replace in source
12021
+ // let str = this.resource.content.replace(dep.url, res.url);
12022
+ // if (str === this.resource.content) {
12023
+ // throw new Error(`Mapped url was not replaced: ${dep.url}`);
12024
+ // }
12025
+ // this.resource.content = str;
12026
+ // dep.url = res.url;
11909
12027
  }
11910
12028
  });
11911
12029
  this.resource.resources.push(...resources);
@@ -12142,8 +12260,8 @@ exports.Builder = {
12142
12260
  .then(buildRoot)
12143
12261
  .then(() => solution.outputResources.getAll());
12144
12262
  });
12145
- function rewriteDependenciesInternal(resources) {
12146
- let promises = resources.map(resource => {
12263
+ async function rewriteDependenciesInternal(resources) {
12264
+ await (0, alot_1.default)(resources).forEachAsync(async (resource, i) => {
12147
12265
  let ext = (0, path_1.path_getExtension)(resource.url);
12148
12266
  let handler = solution.handlers.find(x => x.rewriter.accepts(ext));
12149
12267
  if (handler == null) {
@@ -12152,9 +12270,8 @@ exports.Builder = {
12152
12270
  if (handler == null) {
12153
12271
  throw Error('Rewriter not found for the resource: ' + resource.url);
12154
12272
  }
12155
- return handler.rewriter.rewriteResource(resource);
12156
- });
12157
- return (0, async_1.async_whenAll)(promises);
12273
+ await handler.rewriter.rewriteResource(resource);
12274
+ }).toArrayAsync({ threads: 1 });
12158
12275
  }
12159
12276
  function rewriteRoot() {
12160
12277
  return (0, async_1.async_run)(() => {
@@ -12395,7 +12512,7 @@ class Bundler extends atma_utils_1.class_EventEmitter {
12395
12512
  if (typeof content !== 'string') {
12396
12513
  content = JSON.stringify(content, null, 2);
12397
12514
  }
12398
- File_1.FileActions.writeFile(res.filename, content, { skipHooks: true });
12515
+ File_1.FileActions.writeFile(res.filename, content, { skipHooks: false });
12399
12516
  });
12400
12517
  return solution
12401
12518
  .assetsManager
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "app-bundler",
3
- "version": "0.2.16",
3
+ "version": "0.2.18",
4
4
  "description": "",
5
5
  "main": "lib/bundler.js",
6
6
  "bin": {
@@ -9,7 +9,8 @@
9
9
  "scripts": {
10
10
  "test": "atma test",
11
11
  "watch": "atma run tools/build --watch",
12
- "build": "atma run tools/build && atma run tools/build --cli",
12
+ "build": "atma run tools/build && atma run tools/build --cli && npm run cp",
13
+ "cp": "copy \"lib\\cli.js\" \"D:\\eth\\0xweb\\node_modules\\app-bundler\\lib\\cli.js\"",
13
14
  "server": "atma server",
14
15
  "release": "echo \"Run atma pub -m \"message\"\""
15
16
  },