@nativescript/webpack
Advanced tools
Comparing version
@@ -7,2 +7,3 @@ "use strict"; | ||
const path_1 = require("path"); | ||
const semver_1 = require("semver"); | ||
const fs_1 = require("fs"); | ||
@@ -160,8 +161,8 @@ const typescript_1 = require("../helpers/typescript"); | ||
}); | ||
const buildAngularMajorVersion = getBuildAngularMajorVersion(); | ||
if (buildAngularMajorVersion) { | ||
const buildAngularVersion = (0, dependencies_1.getDependencyVersion)('@angular-devkit/build-angular'); | ||
if (buildAngularVersion) { | ||
const buildAngularOptions = { | ||
aot: !disableAOT, | ||
}; | ||
if (buildAngularMajorVersion < 15) { | ||
if ((0, semver_1.satisfies)(buildAngularVersion, '<15.0.0')) { | ||
const tsConfig = (0, typescript_1.readTsConfig)(tsConfigPath); | ||
@@ -267,18 +268,2 @@ const { ScriptTarget } = (0, typescript_1.getTypescript)(); | ||
} | ||
const MAJOR_VER_RE = /^(\d+)\./; | ||
function getBuildAngularMajorVersion() { | ||
const buildAngularPath = (0, dependencies_1.getDependencyPath)('@angular-devkit/build-angular'); | ||
if (!buildAngularPath) { | ||
return null; | ||
} | ||
try { | ||
const buildAngularVersion = require(`${buildAngularPath}/package.json`).version; | ||
const [_, majorStr] = buildAngularVersion.match(MAJOR_VER_RE); | ||
return Number(majorStr); | ||
} | ||
catch (err) { | ||
// ignore | ||
} | ||
return null; | ||
} | ||
function tryRequireResolve(path) { | ||
@@ -293,7 +278,7 @@ try { | ||
function getWebpackLoaderPath() { | ||
return (tryRequireResolve('@angular-devkit/build-angular/src/babel/webpack-loader') || | ||
tryRequireResolve('@angular-devkit/build-angular/src/tools/babel/webpack-loader') || | ||
// fallback to angular 16.1+ | ||
'@angular-devkit/build-angular/src/tools/babel/webpack-loader'); | ||
var _a, _b; | ||
return ((_b = (_a = tryRequireResolve('@angular-devkit/build-angular/src/babel/webpack-loader')) !== null && _a !== void 0 ? _a : tryRequireResolve('@angular-devkit/build-angular/src/tools/babel/webpack-loader')) !== null && _b !== void 0 ? _b : | ||
// fallback to angular 16.1+ | ||
'@angular-devkit/build-angular/src/tools/babel/webpack-loader'); | ||
} | ||
//# sourceMappingURL=angular.js.map |
@@ -8,2 +8,3 @@ "use strict"; | ||
const webpack_1 = require("webpack"); | ||
const semver_1 = require("semver"); | ||
const fs_1 = require("fs"); | ||
@@ -14,2 +15,3 @@ const fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin")); | ||
const project_1 = require("../helpers/project"); | ||
const dependencies_1 = require("../helpers/dependencies"); | ||
const PlatformSuffixPlugin_1 = require("../plugins/PlatformSuffixPlugin"); | ||
@@ -19,3 +21,2 @@ const fileReplacements_1 = require("../helpers/fileReplacements"); | ||
const WatchStatePlugin_1 = require("../plugins/WatchStatePlugin"); | ||
const dependencies_1 = require("../helpers/dependencies"); | ||
const dotEnv_1 = require("../helpers/dotEnv"); | ||
@@ -434,6 +435,8 @@ const index_1 = require("../index"); | ||
const platform = (0, platform_1.getPlatformName)(); | ||
// todo: check if core modules are external | ||
// todo: check if we are testing | ||
return platform === 'ios' || platform === 'android'; | ||
const coreVersion = (0, dependencies_1.getDependencyVersion)('@nativescript/core'); | ||
if (coreVersion && (0, semver_1.satisfies)(coreVersion, '>=8.7.0')) { | ||
return platform === 'ios' || platform === 'android'; | ||
} | ||
return platform === 'ios'; | ||
} | ||
//# sourceMappingURL=base.js.map |
@@ -22,1 +22,8 @@ /** | ||
export declare function getDependencyPath(dependencyName: string): string | null; | ||
/** | ||
* Utility to get the version of a dependency. | ||
* | ||
* @param dependencyName | ||
* @returns string | null - version of the dependency or null if not found | ||
*/ | ||
export declare function getDependencyVersion(dependencyName: string): string | null; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getDependencyPath = exports.hasDependency = exports.getAllDependencies = void 0; | ||
exports.getDependencyVersion = exports.getDependencyPath = exports.hasDependency = exports.getAllDependencies = void 0; | ||
const path_1 = __importDefault(require("path")); | ||
@@ -56,2 +56,22 @@ const project_1 = require("./project"); | ||
exports.getDependencyPath = getDependencyPath; | ||
/** | ||
* Utility to get the version of a dependency. | ||
* | ||
* @param dependencyName | ||
* @returns string | null - version of the dependency or null if not found | ||
*/ | ||
function getDependencyVersion(dependencyName) { | ||
const dependencyPath = getDependencyPath(dependencyName); | ||
if (!dependencyPath) { | ||
return null; | ||
} | ||
try { | ||
return require(`${dependencyPath}/package.json`).version; | ||
} | ||
catch (err) { | ||
// ignore | ||
} | ||
return null; | ||
} | ||
exports.getDependencyVersion = getDependencyVersion; | ||
//# sourceMappingURL=dependencies.js.map |
{ | ||
"name": "@nativescript/webpack", | ||
"version": "5.0.20", | ||
"version": "5.0.21", | ||
"private": false, | ||
@@ -44,2 +44,3 @@ "main": "dist/index.js", | ||
"sax": "^1.0.0", | ||
"semver": "^7.0.0 || ^6.0.0", | ||
"source-map": "^0.7.0", | ||
@@ -46,0 +47,0 @@ "terser-webpack-plugin": "^5.0.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
234074
0.31%3803
0.4%37
2.78%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed