@nativescript/core 9.1.2-next.0 → 9.1.2-rc.0

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.
@@ -1,9 +1,7 @@
1
- import semver from 'semver';
2
-
3
1
  const webpackPackageName = "@nativescript/webpack";
4
2
 
5
3
  export default function ($staticConfig, hookArgs) {
6
- const cliVersion = semver.parse($staticConfig.version);
4
+ const cliVersion = parseMajorMinor($staticConfig.version);
7
5
  const platform = hookArgs.prepareData.platform;
8
6
  const projectData = hookArgs.projectData;
9
7
 
@@ -24,7 +22,20 @@ export default function ($staticConfig, hookArgs) {
24
22
  };
25
23
 
26
24
  /**
27
- * Checks if semver object satisifies a major/minor requirement. Pre-release versions are OK too!
25
+ * First `major.minor` in a version or range ("7.1.2", "~7.1.0", "^7.1", ">=7.1.0 <8"),
26
+ * which for the ranges package.json uses is the lower bound. Returns null when there is
27
+ * none (tags such as "next" or "rc"); the checks treat that as satisfied.
28
+ *
29
+ * This file runs from the app's node_modules, where only @nativescript/core's own
30
+ * dependencies are guaranteed to exist, so it must not import any package.
31
+ */
32
+ function parseMajorMinor(version) {
33
+ const match = /(\d+)\.(\d+)/.exec(String(version || ""));
34
+ return match ? { major: Number(match[1]), minor: Number(match[2]) } : null;
35
+ }
36
+
37
+ /**
38
+ * Checks if a parsed version satisifies a major/minor requirement. Pre-release versions are OK too!
28
39
  */
29
40
  function satisfiesRequiredVersion(actualVersion, requiredMajor, requiredMinor) {
30
41
  // Return true for null version to handle tags (ex. "next", "rc")
@@ -46,15 +57,5 @@ function satisfiesRequiredVersion(actualVersion, requiredMajor, requiredMinor) {
46
57
  function getMinWebpackVersion(projectData) {
47
58
  const devDependencies = projectData.devDependencies || {};
48
59
  const dependencies = projectData.dependencies || {};
49
- const webpackVer = dependencies[webpackPackageName] || devDependencies[webpackPackageName];
50
-
51
- let webpackMinVer = null;
52
-
53
- if (semver.valid(webpackVer)) {
54
- webpackMinVer = semver.parse(webpackVer);
55
- } else if (semver.validRange(webpackVer)) {
56
- webpackMinVer = semver.minVersion(webpackVer);
57
- }
58
-
59
- return webpackMinVer;
60
- }
60
+ return parseMajorMinor(dependencies[webpackPackageName] || devDependencies[webpackPackageName]);
61
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript/core",
3
- "version": "9.1.2-next.0",
3
+ "version": "9.1.2-rc.0",
4
4
  "description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.",
5
5
  "type": "module",
6
6
  "main": "index",