app-bundler 0.1.5 → 0.1.6

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 +24 -17
  2. package/lib/cli.js +24 -17
  3. package/package.json +1 -1
package/lib/bundler.js CHANGED
@@ -5285,9 +5285,9 @@ class CommonJsPathResolver extends BasePathResolver_1.BasePathResolver {
5285
5285
  return true;
5286
5286
  }
5287
5287
  resolve(includeData, parentResource) {
5288
- var filename = nodeModuleResolve(includeData.url, parentResource.directory);
5288
+ let filename = nodeModuleResolve(includeData.url, parentResource.directory);
5289
5289
  if (filename) {
5290
- var url = this.solution.opts.toAppUrl(filename);
5290
+ let url = this.solution.opts.toAppUrl(filename);
5291
5291
  this.solution.opts.mappings[includeData.url] = url;
5292
5292
  }
5293
5293
  return filename;
@@ -5302,32 +5302,39 @@ const nodeCoreModules = [
5302
5302
  'tls', 'tty', 'url', 'util', 'vm', 'zlib'
5303
5303
  ];
5304
5304
  function nodeModuleResolve(path, location_) {
5305
- var location = location_.replace(/[\\\/]+$/, '');
5306
- var name = /^([\w\-]+)/.exec(path)[0];
5307
- var resource = path.substring(name.length + 1);
5308
- if (resource && hasExt(resource) === false) {
5309
- resource += '.js';
5310
- }
5311
- var current = location;
5312
- var root_ = current + '/node_modules/' + name + '/';
5305
+ let location = location_.replace(/[\\\/]+$/, '');
5306
+ let name = /^([\w\-]+)/.exec(path)[0];
5307
+ let resource = path.substring(name.length + 1);
5308
+ let current = location;
5309
+ let root_ = current + '/node_modules/' + name + '/';
5313
5310
  while (true) {
5314
- var nodeModules = (0, path_1.path_combine)(current, '/node_modules/' + name + '/');
5315
- var pckg = nodeModules + 'package.json';
5311
+ let nodeModules = (0, path_1.path_combine)(current, '/node_modules/' + name + '/');
5312
+ let pckg = nodeModules + 'package.json';
5316
5313
  if (global_1.io.File.exists(pckg) === false) {
5317
- var next = current.replace(/[^\/\\]+[\/\\]?$/, '');
5314
+ let next = current.replace(/[^\/\\]+[\/\\]?$/, '');
5318
5315
  if (next === current) {
5319
5316
  return root_ + 'package.json';
5320
5317
  }
5321
5318
  current = next;
5322
5319
  continue;
5323
5320
  }
5324
- var json = global_1.io.File.read(pckg);
5321
+ if (resource) {
5322
+ let path = nodeModules + resource;
5323
+ if (hasExt(path) === false) {
5324
+ let likelyTs = path.includes('/src/');
5325
+ if (likelyTs) {
5326
+ if (global_1.io.File.exists(path + '.ts')) {
5327
+ return path + '.ts';
5328
+ }
5329
+ }
5330
+ return path + '.js';
5331
+ }
5332
+ return path;
5333
+ }
5334
+ let json = global_1.io.File.read(pckg);
5325
5335
  if (typeof json === 'string') {
5326
5336
  json = JSON.parse(json);
5327
5337
  }
5328
- if (resource) {
5329
- return nodeModules + resource;
5330
- }
5331
5338
  if (json.main) {
5332
5339
  return (0, path_1.path_combine)(nodeModules, json.main);
5333
5340
  }
package/lib/cli.js CHANGED
@@ -5287,9 +5287,9 @@ class CommonJsPathResolver extends BasePathResolver_1.BasePathResolver {
5287
5287
  return true;
5288
5288
  }
5289
5289
  resolve(includeData, parentResource) {
5290
- var filename = nodeModuleResolve(includeData.url, parentResource.directory);
5290
+ let filename = nodeModuleResolve(includeData.url, parentResource.directory);
5291
5291
  if (filename) {
5292
- var url = this.solution.opts.toAppUrl(filename);
5292
+ let url = this.solution.opts.toAppUrl(filename);
5293
5293
  this.solution.opts.mappings[includeData.url] = url;
5294
5294
  }
5295
5295
  return filename;
@@ -5304,32 +5304,39 @@ const nodeCoreModules = [
5304
5304
  'tls', 'tty', 'url', 'util', 'vm', 'zlib'
5305
5305
  ];
5306
5306
  function nodeModuleResolve(path, location_) {
5307
- var location = location_.replace(/[\\\/]+$/, '');
5308
- var name = /^([\w\-]+)/.exec(path)[0];
5309
- var resource = path.substring(name.length + 1);
5310
- if (resource && hasExt(resource) === false) {
5311
- resource += '.js';
5312
- }
5313
- var current = location;
5314
- var root_ = current + '/node_modules/' + name + '/';
5307
+ let location = location_.replace(/[\\\/]+$/, '');
5308
+ let name = /^([\w\-]+)/.exec(path)[0];
5309
+ let resource = path.substring(name.length + 1);
5310
+ let current = location;
5311
+ let root_ = current + '/node_modules/' + name + '/';
5315
5312
  while (true) {
5316
- var nodeModules = (0, path_1.path_combine)(current, '/node_modules/' + name + '/');
5317
- var pckg = nodeModules + 'package.json';
5313
+ let nodeModules = (0, path_1.path_combine)(current, '/node_modules/' + name + '/');
5314
+ let pckg = nodeModules + 'package.json';
5318
5315
  if (global_1.io.File.exists(pckg) === false) {
5319
- var next = current.replace(/[^\/\\]+[\/\\]?$/, '');
5316
+ let next = current.replace(/[^\/\\]+[\/\\]?$/, '');
5320
5317
  if (next === current) {
5321
5318
  return root_ + 'package.json';
5322
5319
  }
5323
5320
  current = next;
5324
5321
  continue;
5325
5322
  }
5326
- var json = global_1.io.File.read(pckg);
5323
+ if (resource) {
5324
+ let path = nodeModules + resource;
5325
+ if (hasExt(path) === false) {
5326
+ let likelyTs = path.includes('/src/');
5327
+ if (likelyTs) {
5328
+ if (global_1.io.File.exists(path + '.ts')) {
5329
+ return path + '.ts';
5330
+ }
5331
+ }
5332
+ return path + '.js';
5333
+ }
5334
+ return path;
5335
+ }
5336
+ let json = global_1.io.File.read(pckg);
5327
5337
  if (typeof json === 'string') {
5328
5338
  json = JSON.parse(json);
5329
5339
  }
5330
- if (resource) {
5331
- return nodeModules + resource;
5332
- }
5333
5340
  if (json.main) {
5334
5341
  return (0, path_1.path_combine)(nodeModules, json.main);
5335
5342
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "app-bundler",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "",
5
5
  "main": "lib/bundler.js",
6
6
  "bin": {