app-bundler 0.1.13 → 0.1.15
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 +41 -35
- package/lib/cli.js +41 -35
- package/package.json +1 -1
package/lib/bundler.js
CHANGED
|
@@ -1281,51 +1281,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
1281
1281
|
exports.Npm = void 0;
|
|
1282
1282
|
const path_1 = _src_utils_path;
|
|
1283
1283
|
const global_1 = _src_global;
|
|
1284
|
+
const atma_io_1 = require("atma-io");
|
|
1284
1285
|
var Npm;
|
|
1285
1286
|
(function (Npm) {
|
|
1286
1287
|
function resolveAppUrl(path, currentLocation, base) {
|
|
1287
1288
|
let name = /^(@?[^\\\/]+)/.exec(path)[0];
|
|
1288
1289
|
let resource = path.substring(name.length + 1);
|
|
1289
1290
|
while (path != null) {
|
|
1290
|
-
let dirname = (0, path_1.path_combine)(currentLocation, 'node_modules', name);
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
let json = global_1.io.File.read(pckg);
|
|
1296
|
-
if (json) {
|
|
1297
|
-
main = json.main;
|
|
1298
|
-
}
|
|
1291
|
+
let dirname = (0, path_1.path_combine)(currentLocation, 'node_modules', name, '/');
|
|
1292
|
+
if (atma_io_1.Directory.exists(dirname) === false) {
|
|
1293
|
+
let next = currentLocation.replace(/[^\/]+\/?$/, '');
|
|
1294
|
+
if (next === currentLocation) {
|
|
1295
|
+
return null;
|
|
1299
1296
|
}
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1297
|
+
currentLocation = next;
|
|
1298
|
+
continue;
|
|
1299
|
+
}
|
|
1300
|
+
if (path.startsWith('@') && resource.length > 0) {
|
|
1301
|
+
let subPackageMatch = /[^/\\]+/.exec(resource);
|
|
1302
|
+
let subPackage = subPackageMatch[0];
|
|
1303
|
+
dirname = (0, path_1.path_combine)(dirname, `/${subPackage}`, '/');
|
|
1304
|
+
resource = resource.substring(subPackage.length + 1);
|
|
1305
|
+
}
|
|
1306
|
+
if (resource === '') {
|
|
1307
|
+
let pkg = (0, path_1.path_combine)(dirname, 'package.json');
|
|
1308
|
+
let json = global_1.io.File.read(pkg);
|
|
1309
|
+
if (json) {
|
|
1310
|
+
resource = json.main;
|
|
1314
1311
|
}
|
|
1315
1312
|
}
|
|
1316
|
-
let
|
|
1317
|
-
if (
|
|
1318
|
-
|
|
1313
|
+
let filename = combineMain(dirname, resource);
|
|
1314
|
+
if (base) {
|
|
1315
|
+
if (base.endsWith('/') === false) {
|
|
1316
|
+
// Base path must be a folder
|
|
1317
|
+
base += '/';
|
|
1318
|
+
}
|
|
1319
|
+
// in-case CWD path is not equal to BASE path, make sure resolved FS module path is relative to BASE folder
|
|
1320
|
+
let relative = global_1.io.env.currentDir.toRelativeString(base);
|
|
1321
|
+
if (relative) {
|
|
1322
|
+
filename = (0, path_1.path_combine)(relative, filename);
|
|
1323
|
+
}
|
|
1319
1324
|
}
|
|
1320
|
-
|
|
1325
|
+
return filename;
|
|
1321
1326
|
}
|
|
1322
1327
|
return null;
|
|
1323
1328
|
}
|
|
1324
1329
|
Npm.resolveAppUrl = resolveAppUrl;
|
|
1325
1330
|
function combineMain(directory, filename) {
|
|
1326
|
-
|
|
1327
|
-
filename = 'index.js';
|
|
1328
|
-
}
|
|
1331
|
+
filename !== null && filename !== void 0 ? filename : (filename = 'index.js');
|
|
1329
1332
|
let path = (0, path_1.path_combine)(directory, filename);
|
|
1330
1333
|
if (hasExt(path) === false) {
|
|
1331
1334
|
let likelyTs = path.includes('/src/');
|
|
@@ -2602,8 +2605,8 @@ class SolutionOpts extends SolutionOptsBase {
|
|
|
2602
2605
|
middlewares: null,
|
|
2603
2606
|
varDefs: null,
|
|
2604
2607
|
parserIgnoreDependencies: [
|
|
2605
|
-
'\\/bower_components\\/',
|
|
2606
|
-
'\\/node_modules\\/(?!.+\\.ts\\b)',
|
|
2608
|
+
// '\\/bower_components\\/',
|
|
2609
|
+
// '\\/node_modules\\/(?!.+\\.ts\\b)',
|
|
2607
2610
|
'\\.min\\.'
|
|
2608
2611
|
],
|
|
2609
2612
|
dynamicDependencies: [],
|
|
@@ -11651,8 +11654,7 @@ class Bundler extends atma_utils_1.class_EventEmitter {
|
|
|
11651
11654
|
.on('changed', rebuild);
|
|
11652
11655
|
}
|
|
11653
11656
|
return build(resource)
|
|
11654
|
-
.then((result) => solution.onBuildReady(result))
|
|
11655
|
-
.then((result) => solution.runScripts('postbuild', result));
|
|
11657
|
+
.then((result) => solution.onBuildReady(result));
|
|
11656
11658
|
});
|
|
11657
11659
|
}
|
|
11658
11660
|
return solution
|
|
@@ -11673,7 +11675,11 @@ class Bundler extends atma_utils_1.class_EventEmitter {
|
|
|
11673
11675
|
.assetsManager
|
|
11674
11676
|
.flush()
|
|
11675
11677
|
.then(() => {
|
|
11676
|
-
return
|
|
11678
|
+
return solution
|
|
11679
|
+
.runScripts('postbuild')
|
|
11680
|
+
.then(() => {
|
|
11681
|
+
return Promise.resolve(solution);
|
|
11682
|
+
});
|
|
11677
11683
|
});
|
|
11678
11684
|
}
|
|
11679
11685
|
if (opts && opts.watch === true) {
|
package/lib/cli.js
CHANGED
|
@@ -1283,51 +1283,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
1283
1283
|
exports.Npm = void 0;
|
|
1284
1284
|
const path_1 = _src_utils_path;
|
|
1285
1285
|
const global_1 = _src_global;
|
|
1286
|
+
const atma_io_1 = require("atma-io");
|
|
1286
1287
|
var Npm;
|
|
1287
1288
|
(function (Npm) {
|
|
1288
1289
|
function resolveAppUrl(path, currentLocation, base) {
|
|
1289
1290
|
let name = /^(@?[^\\\/]+)/.exec(path)[0];
|
|
1290
1291
|
let resource = path.substring(name.length + 1);
|
|
1291
1292
|
while (path != null) {
|
|
1292
|
-
let dirname = (0, path_1.path_combine)(currentLocation, 'node_modules', name);
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
let json = global_1.io.File.read(pckg);
|
|
1298
|
-
if (json) {
|
|
1299
|
-
main = json.main;
|
|
1300
|
-
}
|
|
1293
|
+
let dirname = (0, path_1.path_combine)(currentLocation, 'node_modules', name, '/');
|
|
1294
|
+
if (atma_io_1.Directory.exists(dirname) === false) {
|
|
1295
|
+
let next = currentLocation.replace(/[^\/]+\/?$/, '');
|
|
1296
|
+
if (next === currentLocation) {
|
|
1297
|
+
return null;
|
|
1301
1298
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1299
|
+
currentLocation = next;
|
|
1300
|
+
continue;
|
|
1301
|
+
}
|
|
1302
|
+
if (path.startsWith('@') && resource.length > 0) {
|
|
1303
|
+
let subPackageMatch = /[^/\\]+/.exec(resource);
|
|
1304
|
+
let subPackage = subPackageMatch[0];
|
|
1305
|
+
dirname = (0, path_1.path_combine)(dirname, `/${subPackage}`, '/');
|
|
1306
|
+
resource = resource.substring(subPackage.length + 1);
|
|
1307
|
+
}
|
|
1308
|
+
if (resource === '') {
|
|
1309
|
+
let pkg = (0, path_1.path_combine)(dirname, 'package.json');
|
|
1310
|
+
let json = global_1.io.File.read(pkg);
|
|
1311
|
+
if (json) {
|
|
1312
|
+
resource = json.main;
|
|
1316
1313
|
}
|
|
1317
1314
|
}
|
|
1318
|
-
let
|
|
1319
|
-
if (
|
|
1320
|
-
|
|
1315
|
+
let filename = combineMain(dirname, resource);
|
|
1316
|
+
if (base) {
|
|
1317
|
+
if (base.endsWith('/') === false) {
|
|
1318
|
+
// Base path must be a folder
|
|
1319
|
+
base += '/';
|
|
1320
|
+
}
|
|
1321
|
+
// in-case CWD path is not equal to BASE path, make sure resolved FS module path is relative to BASE folder
|
|
1322
|
+
let relative = global_1.io.env.currentDir.toRelativeString(base);
|
|
1323
|
+
if (relative) {
|
|
1324
|
+
filename = (0, path_1.path_combine)(relative, filename);
|
|
1325
|
+
}
|
|
1321
1326
|
}
|
|
1322
|
-
|
|
1327
|
+
return filename;
|
|
1323
1328
|
}
|
|
1324
1329
|
return null;
|
|
1325
1330
|
}
|
|
1326
1331
|
Npm.resolveAppUrl = resolveAppUrl;
|
|
1327
1332
|
function combineMain(directory, filename) {
|
|
1328
|
-
|
|
1329
|
-
filename = 'index.js';
|
|
1330
|
-
}
|
|
1333
|
+
filename !== null && filename !== void 0 ? filename : (filename = 'index.js');
|
|
1331
1334
|
let path = (0, path_1.path_combine)(directory, filename);
|
|
1332
1335
|
if (hasExt(path) === false) {
|
|
1333
1336
|
let likelyTs = path.includes('/src/');
|
|
@@ -2604,8 +2607,8 @@ class SolutionOpts extends SolutionOptsBase {
|
|
|
2604
2607
|
middlewares: null,
|
|
2605
2608
|
varDefs: null,
|
|
2606
2609
|
parserIgnoreDependencies: [
|
|
2607
|
-
'\\/bower_components\\/',
|
|
2608
|
-
'\\/node_modules\\/(?!.+\\.ts\\b)',
|
|
2610
|
+
// '\\/bower_components\\/',
|
|
2611
|
+
// '\\/node_modules\\/(?!.+\\.ts\\b)',
|
|
2609
2612
|
'\\.min\\.'
|
|
2610
2613
|
],
|
|
2611
2614
|
dynamicDependencies: [],
|
|
@@ -11653,8 +11656,7 @@ class Bundler extends atma_utils_1.class_EventEmitter {
|
|
|
11653
11656
|
.on('changed', rebuild);
|
|
11654
11657
|
}
|
|
11655
11658
|
return build(resource)
|
|
11656
|
-
.then((result) => solution.onBuildReady(result))
|
|
11657
|
-
.then((result) => solution.runScripts('postbuild', result));
|
|
11659
|
+
.then((result) => solution.onBuildReady(result));
|
|
11658
11660
|
});
|
|
11659
11661
|
}
|
|
11660
11662
|
return solution
|
|
@@ -11675,7 +11677,11 @@ class Bundler extends atma_utils_1.class_EventEmitter {
|
|
|
11675
11677
|
.assetsManager
|
|
11676
11678
|
.flush()
|
|
11677
11679
|
.then(() => {
|
|
11678
|
-
return
|
|
11680
|
+
return solution
|
|
11681
|
+
.runScripts('postbuild')
|
|
11682
|
+
.then(() => {
|
|
11683
|
+
return Promise.resolve(solution);
|
|
11684
|
+
});
|
|
11679
11685
|
});
|
|
11680
11686
|
}
|
|
11681
11687
|
if (opts && opts.watch === true) {
|