app-bundler 0.1.6 → 0.1.7

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 +20 -11
  2. package/lib/cli.js +20 -11
  3. package/package.json +1 -1
package/lib/bundler.js CHANGED
@@ -1285,16 +1285,19 @@ var Npm;
1285
1285
  function resolveAppUrl(path, currentLocation, base) {
1286
1286
  let name = /^(@?[^\\\/]+)/.exec(path)[0];
1287
1287
  let resource = path.substring(name.length + 1);
1288
- if (resource && hasExt(resource) === false) {
1289
- resource += '.js';
1290
- }
1291
1288
  while (path != null) {
1292
1289
  let dirname = (0, path_1.path_combine)(currentLocation, 'node_modules', name);
1293
1290
  let pckg = (0, path_1.path_combine)(dirname, 'package.json');
1294
1291
  if (global_1.io.File.exists(pckg)) {
1295
- let json = global_1.io.File.read(pckg);
1296
- if (json) {
1297
- let filename = combineMain(dirname, json.main);
1292
+ let main = resource;
1293
+ if (main === '') {
1294
+ let json = global_1.io.File.read(pckg);
1295
+ if (json) {
1296
+ main = json.main;
1297
+ }
1298
+ }
1299
+ if (main) {
1300
+ let filename = combineMain(dirname, main);
1298
1301
  if (base) {
1299
1302
  if (base.endsWith('/') === false) {
1300
1303
  // Base path must be a folder
@@ -1318,14 +1321,20 @@ var Npm;
1318
1321
  return null;
1319
1322
  }
1320
1323
  Npm.resolveAppUrl = resolveAppUrl;
1321
- function combineMain(cwd, filename) {
1324
+ function combineMain(directory, filename) {
1322
1325
  if (filename == null) {
1323
1326
  filename = 'index.js';
1324
1327
  }
1325
- if (hasExt(filename) === false) {
1326
- filename += '.js';
1328
+ let path = (0, path_1.path_combine)(directory, filename);
1329
+ if (hasExt(path) === false) {
1330
+ let likelyTs = path.includes('/src/');
1331
+ if (likelyTs) {
1332
+ if (global_1.io.File.exists(path + '.ts')) {
1333
+ return path + '.ts';
1334
+ }
1335
+ }
1336
+ path += '.js';
1327
1337
  }
1328
- var path = (0, path_1.path_combine)(cwd, filename);
1329
1338
  if (global_1.io.File.exists(path)) {
1330
1339
  return path;
1331
1340
  }
@@ -2593,7 +2602,7 @@ class SolutionOpts extends SolutionOptsBase {
2593
2602
  varDefs: null,
2594
2603
  parserIgnoreDependencies: [
2595
2604
  '\\/bower_components\\/',
2596
- '\\/node_modules\\/',
2605
+ '\\/node_modules\\/(?!.+\\.ts\\b)',
2597
2606
  '\\.min\\.'
2598
2607
  ],
2599
2608
  dynamicDependencies: [],
package/lib/cli.js CHANGED
@@ -1287,16 +1287,19 @@ var Npm;
1287
1287
  function resolveAppUrl(path, currentLocation, base) {
1288
1288
  let name = /^(@?[^\\\/]+)/.exec(path)[0];
1289
1289
  let resource = path.substring(name.length + 1);
1290
- if (resource && hasExt(resource) === false) {
1291
- resource += '.js';
1292
- }
1293
1290
  while (path != null) {
1294
1291
  let dirname = (0, path_1.path_combine)(currentLocation, 'node_modules', name);
1295
1292
  let pckg = (0, path_1.path_combine)(dirname, 'package.json');
1296
1293
  if (global_1.io.File.exists(pckg)) {
1297
- let json = global_1.io.File.read(pckg);
1298
- if (json) {
1299
- let filename = combineMain(dirname, json.main);
1294
+ let main = resource;
1295
+ if (main === '') {
1296
+ let json = global_1.io.File.read(pckg);
1297
+ if (json) {
1298
+ main = json.main;
1299
+ }
1300
+ }
1301
+ if (main) {
1302
+ let filename = combineMain(dirname, main);
1300
1303
  if (base) {
1301
1304
  if (base.endsWith('/') === false) {
1302
1305
  // Base path must be a folder
@@ -1320,14 +1323,20 @@ var Npm;
1320
1323
  return null;
1321
1324
  }
1322
1325
  Npm.resolveAppUrl = resolveAppUrl;
1323
- function combineMain(cwd, filename) {
1326
+ function combineMain(directory, filename) {
1324
1327
  if (filename == null) {
1325
1328
  filename = 'index.js';
1326
1329
  }
1327
- if (hasExt(filename) === false) {
1328
- filename += '.js';
1330
+ let path = (0, path_1.path_combine)(directory, filename);
1331
+ if (hasExt(path) === false) {
1332
+ let likelyTs = path.includes('/src/');
1333
+ if (likelyTs) {
1334
+ if (global_1.io.File.exists(path + '.ts')) {
1335
+ return path + '.ts';
1336
+ }
1337
+ }
1338
+ path += '.js';
1329
1339
  }
1330
- var path = (0, path_1.path_combine)(cwd, filename);
1331
1340
  if (global_1.io.File.exists(path)) {
1332
1341
  return path;
1333
1342
  }
@@ -2595,7 +2604,7 @@ class SolutionOpts extends SolutionOptsBase {
2595
2604
  varDefs: null,
2596
2605
  parserIgnoreDependencies: [
2597
2606
  '\\/bower_components\\/',
2598
- '\\/node_modules\\/',
2607
+ '\\/node_modules\\/(?!.+\\.ts\\b)',
2599
2608
  '\\.min\\.'
2600
2609
  ],
2601
2610
  dynamicDependencies: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "app-bundler",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "",
5
5
  "main": "lib/bundler.js",
6
6
  "bin": {