From bf0d46625cc2ccee3b30a923d3ce1bddf339e141 Mon Sep 17 00:00:00 2001 From: Barak Ben Noon Date: Sun, 28 Mar 2021 14:07:26 -0400 Subject: [PATCH 01/11] setBundleVersion in program --- cli/asc.js | 1 + example/test.ts | 7 +++++++ src/compiler.ts | 6 ++++-- src/index.ts | 6 ++++++ src/program.ts | 5 +++-- 5 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 example/test.ts diff --git a/cli/asc.js b/cli/asc.js index 931c17a31c..a4e995890e 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -422,6 +422,7 @@ exports.main = function main(argv, options, callback) { assemblyscript.setPedantic(compilerOptions, opts.pedantic); assemblyscript.setLowMemoryLimit(compilerOptions, opts.lowMemoryLimit >>> 0); assemblyscript.setExportRuntime(compilerOptions, opts.exportRuntime); + assemblyscript.setBundleVersion(compilerOptions, exports.version); if (!opts.stackSize && opts.runtime == "incremental") { opts.stackSize = assemblyscript.DEFAULT_STACK_SIZE; } diff --git a/example/test.ts b/example/test.ts new file mode 100644 index 0000000000..807149c323 --- /dev/null +++ b/example/test.ts @@ -0,0 +1,7 @@ +const imports = { + "assembly/index": { + declaredImportedFunction: function() { + + } + } +}; diff --git a/src/compiler.ts b/src/compiler.ts index c7ea707feb..802679e161 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -251,6 +251,8 @@ export class Options { exportRuntime: bool = false; /** Stack size in bytes, if using a stack. */ stackSize: i32 = 0; + /* Bundle version from the root package.json */ + bundleVersion: string = "0.0.0"; /** Hinted optimize level. Not applied by the compiler itself. */ optimizeLevelHint: i32 = 0; @@ -1509,7 +1511,7 @@ export class Compiler extends DiagnosticEmitter { if (!this.compileFunctionBody(instance, stmts)) { stmts.push(module.unreachable()); } - + this.currentFlow = previousFlow; // create the function @@ -7533,7 +7535,7 @@ export class Compiler extends DiagnosticEmitter { expr = module.local_tee(local.index, expr, ftype.isManaged); } } - + return expr; } diff --git a/src/index.ts b/src/index.ts index 9ae88ab49d..deec29c351 100644 --- a/src/index.ts +++ b/src/index.ts @@ -140,6 +140,12 @@ export const DEFAULT_STACK_SIZE = 16384; /** Sets the `stackSize` option. */ export function setStackSize(options: Options, stackSize: i32): void { options.stackSize = stackSize; + +} + +/** Sets the bundle version. */ +export function setBundleVersion(options: Options, bundleVersion: string): void { + options.bundleVersion = bundleVersion; } /** Sign extension operations. */ diff --git a/src/program.ts b/src/program.ts index 833a9682d4..e833818dc3 100644 --- a/src/program.ts +++ b/src/program.ts @@ -942,6 +942,7 @@ export class Program extends DiagnosticEmitter { this.initialized = true; var options = this.options; + console.log("bundleVersion", options.bundleVersion); // register native types this.registerNativeType(CommonNames.i8, Type.i8); @@ -3084,8 +3085,8 @@ export class File extends Element { /** Creates an imported namespace from this file. */ asAliasNamespace( - name: string, - parent: Element, + name: string, + parent: Element, localIdentifier: IdentifierExpression ): Namespace { var declaration = this.program.makeNativeNamespaceDeclaration(name); From b79ee5f1d8ccf6c0bf1e0b76530109f31557bb7d Mon Sep 17 00:00:00 2001 From: Barak Ben Noon Date: Sun, 28 Mar 2021 14:15:26 -0400 Subject: [PATCH 02/11] Add global variables --- src/common.ts | 4 ++++ src/program.ts | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/common.ts b/src/common.ts index 0beb11c26b..d3f60c392f 100644 --- a/src/common.ts +++ b/src/common.ts @@ -178,6 +178,10 @@ export namespace CommonNames { export const ASC_FEATURE_MULTI_VALUE = "ASC_FEATURE_MULTI_VALUE"; export const ASC_FEATURE_GC = "ASC_FEATURE_GC"; export const ASC_FEATURE_MEMORY64 = "ASC_FEATURE_MEMORY64"; + export const ASC_VERSION = "ASC_VERSION"; + export const ASC_VERSION_MAJOR = "ASC_VERSION_MAJOR"; + export const ASC_VERSION_MINOR = "ASC_VERSION_MINOR"; + export const ASC_VERSION_PATCH = "ASC_VERSION_PATCH"; // classes export const I8 = "I8"; export const I16 = "I16"; diff --git a/src/program.ts b/src/program.ts index e833818dc3..0d0ecd959f 100644 --- a/src/program.ts +++ b/src/program.ts @@ -1014,6 +1014,14 @@ export class Program extends DiagnosticEmitter { i64_new(options.lowMemoryLimit, 0)); this.registerConstantInteger(CommonNames.ASC_EXPORT_RUNTIME, Type.bool, i64_new(options.exportRuntime ? 1 : 0, 0)); + this.registerConstantInteger(CommonNames.ASC_VERSION, Type.i32, + i64_new(234)); + this.registerConstantInteger(CommonNames.ASC_VERSION_MAJOR, Type.i32, + i64_new(123)); + this.registerConstantInteger(CommonNames.ASC_VERSION_MINOR, Type.i32, + i64_new(567)); + this.registerConstantInteger(CommonNames.ASC_VERSION_PATCH, Type.i32, + i64_new(789)); // register feature hints this.registerConstantInteger(CommonNames.ASC_FEATURE_SIGN_EXTENSION, Type.bool, From 7416310b698890142f449c128b86c103b95b118b Mon Sep 17 00:00:00 2001 From: Barak Ben Noon Date: Sun, 28 Mar 2021 14:44:18 -0400 Subject: [PATCH 03/11] Test verions working --- src/program.ts | 12 ++++++------ src/util/index.ts | 1 + src/util/version.ts | 18 ++++++++++++++++++ tests/compiler/asc-constants.ts | 4 ++++ tests/compiler/asc-constants.untouched.wat | 9 +++++++++ 5 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 src/util/version.ts diff --git a/src/program.ts b/src/program.ts index 0d0ecd959f..1a3c6445a9 100644 --- a/src/program.ts +++ b/src/program.ts @@ -129,7 +129,8 @@ import { writeF64, writeI64, writeI32AsI64, - writeI64AsI32 + writeI64AsI32, + getSemanticVersion } from "./util"; import { @@ -998,6 +999,7 @@ export class Program extends DiagnosticEmitter { this.registerNativeType(CommonNames.dataref, Type.dataref); // register compiler hints + const semanticVersion = getSemanticVersion(options.bundleVersion); this.registerConstantInteger(CommonNames.ASC_TARGET, Type.i32, i64_new(options.isWasm64 ? Target.WASM64 : Target.WASM32)); this.registerConstantInteger(CommonNames.ASC_NO_ASSERT, Type.bool, @@ -1014,14 +1016,12 @@ export class Program extends DiagnosticEmitter { i64_new(options.lowMemoryLimit, 0)); this.registerConstantInteger(CommonNames.ASC_EXPORT_RUNTIME, Type.bool, i64_new(options.exportRuntime ? 1 : 0, 0)); - this.registerConstantInteger(CommonNames.ASC_VERSION, Type.i32, - i64_new(234)); this.registerConstantInteger(CommonNames.ASC_VERSION_MAJOR, Type.i32, - i64_new(123)); + i64_new(semanticVersion.major)); this.registerConstantInteger(CommonNames.ASC_VERSION_MINOR, Type.i32, - i64_new(567)); + i64_new(semanticVersion.minor)); this.registerConstantInteger(CommonNames.ASC_VERSION_PATCH, Type.i32, - i64_new(789)); + i64_new(semanticVersion.patch)); // register feature hints this.registerConstantInteger(CommonNames.ASC_FEATURE_SIGN_EXTENSION, Type.bool, diff --git a/src/util/index.ts b/src/util/index.ts index 5900f8c1ca..952840570a 100644 --- a/src/util/index.ts +++ b/src/util/index.ts @@ -10,3 +10,4 @@ export * from "./path"; export * from "./terminal"; export * from "./text"; export * from "./vector"; +export * from "./version"; diff --git a/src/util/version.ts b/src/util/version.ts new file mode 100644 index 0000000000..e846935b17 --- /dev/null +++ b/src/util/version.ts @@ -0,0 +1,18 @@ +export interface SemanticVersion { + major: i16, + minor: i16, + patch: i16 +} + +export function getSemanticVersion(_version: string): SemanticVersion { + let version = _version; + if (!version.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)/)) { + version = "0.0.0"; + } + const versionParts = version.split("."); + return { + major: parseInt(versionParts[0]), + minor: parseInt(versionParts[1]), + patch: parseInt(versionParts[2]), + }; +} diff --git a/tests/compiler/asc-constants.ts b/tests/compiler/asc-constants.ts index 3b007986a3..049e86b33b 100644 --- a/tests/compiler/asc-constants.ts +++ b/tests/compiler/asc-constants.ts @@ -16,3 +16,7 @@ ASC_FEATURE_REFERENCE_TYPES; ASC_FEATURE_MULTI_VALUE; ASC_FEATURE_GC; ASC_FEATURE_MEMORY64; + +ASC_VERSION_MAJOR; +ASC_VERSION_MINOR; +ASC_VERSION_PATCH; diff --git a/tests/compiler/asc-constants.untouched.wat b/tests/compiler/asc-constants.untouched.wat index b57c8e0d6e..c17173ce8a 100644 --- a/tests/compiler/asc-constants.untouched.wat +++ b/tests/compiler/asc-constants.untouched.wat @@ -19,6 +19,9 @@ (global $~lib/ASC_FEATURE_MULTI_VALUE i32 (i32.const 0)) (global $~lib/ASC_FEATURE_GC i32 (i32.const 0)) (global $~lib/ASC_FEATURE_MEMORY64 i32 (i32.const 0)) + (global $~lib/ASC_VERSION_MAJOR i32 (i32.const 0)) + (global $~lib/ASC_VERSION_MINOR i32 (i32.const 0)) + (global $~lib/ASC_VERSION_PATCH i32 (i32.const 0)) (global $~lib/memory/__data_end i32 (i32.const 8)) (global $~lib/memory/__stack_pointer (mut i32) (i32.const 16392)) (global $~lib/memory/__heap_base i32 (i32.const 16392)) @@ -59,6 +62,12 @@ drop i32.const 0 drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop ) (func $~start call $start:asc-constants From 680839815b564fc430b61c07d4044517802ff205 Mon Sep 17 00:00:00 2001 From: Barak Ben Noon Date: Sun, 28 Mar 2021 14:46:13 -0400 Subject: [PATCH 04/11] clean up --- example/test.ts | 7 ------- src/common.ts | 1 - 2 files changed, 8 deletions(-) delete mode 100644 example/test.ts diff --git a/example/test.ts b/example/test.ts deleted file mode 100644 index 807149c323..0000000000 --- a/example/test.ts +++ /dev/null @@ -1,7 +0,0 @@ -const imports = { - "assembly/index": { - declaredImportedFunction: function() { - - } - } -}; diff --git a/src/common.ts b/src/common.ts index d3f60c392f..6a67b3fd05 100644 --- a/src/common.ts +++ b/src/common.ts @@ -178,7 +178,6 @@ export namespace CommonNames { export const ASC_FEATURE_MULTI_VALUE = "ASC_FEATURE_MULTI_VALUE"; export const ASC_FEATURE_GC = "ASC_FEATURE_GC"; export const ASC_FEATURE_MEMORY64 = "ASC_FEATURE_MEMORY64"; - export const ASC_VERSION = "ASC_VERSION"; export const ASC_VERSION_MAJOR = "ASC_VERSION_MAJOR"; export const ASC_VERSION_MINOR = "ASC_VERSION_MINOR"; export const ASC_VERSION_PATCH = "ASC_VERSION_PATCH"; From a2627f4ee5eab3887d077e53b2f76afbace28e8f Mon Sep 17 00:00:00 2001 From: Barak Ben Noon Date: Sun, 28 Mar 2021 14:54:22 -0400 Subject: [PATCH 05/11] add bnbarak to NOTICE --- NOTICE | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NOTICE b/NOTICE index 6b1a795506..1836dd6c2d 100644 --- a/NOTICE +++ b/NOTICE @@ -36,6 +36,7 @@ under the licensing terms detailed in LICENSE: * Peter Salomonsen * ookangzheng * yjhmelody +* bnbarak Portions of this software are derived from third-party works licensed under the following terms: @@ -61,6 +62,6 @@ the following terms: The 3-Clause BSD License (https://opensource.org/licenses/BSD-3-Clause) * Arm Optimized Routines: https://github.com/ARM-software/optimized-routines - + Copyright (c) Arm Limited The MIT License (https://opensource.org/licenses/MIT) From c11e6e321fdad07e349a513cddd38b29636627fe Mon Sep 17 00:00:00 2001 From: Barak Ben Noon Date: Sun, 28 Mar 2021 14:59:31 -0400 Subject: [PATCH 06/11] remove console.log --- src/program.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/program.ts b/src/program.ts index 1a3c6445a9..cd71441f96 100644 --- a/src/program.ts +++ b/src/program.ts @@ -943,7 +943,6 @@ export class Program extends DiagnosticEmitter { this.initialized = true; var options = this.options; - console.log("bundleVersion", options.bundleVersion); // register native types this.registerNativeType(CommonNames.i8, Type.i8); From 80486aa61286b338f0be06a078c7fd69efca2c26 Mon Sep 17 00:00:00 2001 From: Barak Ben Noon Date: Sun, 28 Mar 2021 15:01:44 -0400 Subject: [PATCH 07/11] clean up --- src/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index deec29c351..6336001fa0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -140,7 +140,6 @@ export const DEFAULT_STACK_SIZE = 16384; /** Sets the `stackSize` option. */ export function setStackSize(options: Options, stackSize: i32): void { options.stackSize = stackSize; - } /** Sets the bundle version. */ From 2142c1fbb0f54ab8498f300af8efbff1e98d2539 Mon Sep 17 00:00:00 2001 From: Barak Ben Noon Date: Sun, 28 Mar 2021 22:21:34 -0400 Subject: [PATCH 08/11] remove regex check and inline the semantic version logic into initialize() --- src/program.ts | 19 +++++++++++++------ src/util/index.ts | 1 - src/util/version.ts | 18 ------------------ 3 files changed, 13 insertions(+), 25 deletions(-) delete mode 100644 src/util/version.ts diff --git a/src/program.ts b/src/program.ts index cd71441f96..c1a69579cc 100644 --- a/src/program.ts +++ b/src/program.ts @@ -129,8 +129,7 @@ import { writeF64, writeI64, writeI32AsI64, - writeI64AsI32, - getSemanticVersion + writeI64AsI32 } from "./util"; import { @@ -944,6 +943,15 @@ export class Program extends DiagnosticEmitter { var options = this.options; + // Semantic version from root package.json + let bundleMinorVersion = 0, bundleMajorVersion = 0, bundlePatchVersion = 0; + const versionParts = (options.bundleVersion || "").split("."); + if(versionParts.length === 3) { + bundleMajorVersion = i32(parseInt(versionParts[0])); + bundleMinorVersion = i32(parseInt(versionParts[1])); + bundlePatchVersion = i32(parseInt(versionParts[2])); + } + // register native types this.registerNativeType(CommonNames.i8, Type.i8); this.registerNativeType(CommonNames.i16, Type.i16); @@ -998,7 +1006,6 @@ export class Program extends DiagnosticEmitter { this.registerNativeType(CommonNames.dataref, Type.dataref); // register compiler hints - const semanticVersion = getSemanticVersion(options.bundleVersion); this.registerConstantInteger(CommonNames.ASC_TARGET, Type.i32, i64_new(options.isWasm64 ? Target.WASM64 : Target.WASM32)); this.registerConstantInteger(CommonNames.ASC_NO_ASSERT, Type.bool, @@ -1016,11 +1023,11 @@ export class Program extends DiagnosticEmitter { this.registerConstantInteger(CommonNames.ASC_EXPORT_RUNTIME, Type.bool, i64_new(options.exportRuntime ? 1 : 0, 0)); this.registerConstantInteger(CommonNames.ASC_VERSION_MAJOR, Type.i32, - i64_new(semanticVersion.major)); + i64_new(bundleMajorVersion)); this.registerConstantInteger(CommonNames.ASC_VERSION_MINOR, Type.i32, - i64_new(semanticVersion.minor)); + i64_new(bundleMinorVersion)); this.registerConstantInteger(CommonNames.ASC_VERSION_PATCH, Type.i32, - i64_new(semanticVersion.patch)); + i64_new(bundlePatchVersion)); // register feature hints this.registerConstantInteger(CommonNames.ASC_FEATURE_SIGN_EXTENSION, Type.bool, diff --git a/src/util/index.ts b/src/util/index.ts index 952840570a..5900f8c1ca 100644 --- a/src/util/index.ts +++ b/src/util/index.ts @@ -10,4 +10,3 @@ export * from "./path"; export * from "./terminal"; export * from "./text"; export * from "./vector"; -export * from "./version"; diff --git a/src/util/version.ts b/src/util/version.ts deleted file mode 100644 index e846935b17..0000000000 --- a/src/util/version.ts +++ /dev/null @@ -1,18 +0,0 @@ -export interface SemanticVersion { - major: i16, - minor: i16, - patch: i16 -} - -export function getSemanticVersion(_version: string): SemanticVersion { - let version = _version; - if (!version.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)/)) { - version = "0.0.0"; - } - const versionParts = version.split("."); - return { - major: parseInt(versionParts[0]), - minor: parseInt(versionParts[1]), - patch: parseInt(versionParts[2]), - }; -} From 8c39c080571d8ee61cb339c440ca0bbf83197687 Mon Sep 17 00:00:00 2001 From: Barak Ben Noon Date: Mon, 29 Mar 2021 11:45:15 -0400 Subject: [PATCH 09/11] Refactor the version splitting to asc.js so we only pass numbers to program.ts --- cli/asc.js | 11 ++++++++++- src/compiler.ts | 8 ++++++-- src/index.ts | 13 ++++++++++--- src/program.ts | 15 +++------------ 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index a4e995890e..617c5406d0 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -245,6 +245,15 @@ exports.main = function main(argv, options, callback) { options = {}; } + // Bundle semantic version + let bundleMinorVersion = 0, bundleMajorVersion = 0, bundlePatchVersion = 0; + const versionParts = (exports.version || "").split("."); + if(versionParts.length === 3) { + bundleMajorVersion = parseInt(versionParts[0]); + bundleMinorVersion = parseInt(versionParts[1]); + bundlePatchVersion = parseInt(versionParts[2]); + } + const stdout = options.stdout || process.stdout; const stderr = options.stderr || process.stderr; const readFile = options.readFile || readFileNode; @@ -422,7 +431,7 @@ exports.main = function main(argv, options, callback) { assemblyscript.setPedantic(compilerOptions, opts.pedantic); assemblyscript.setLowMemoryLimit(compilerOptions, opts.lowMemoryLimit >>> 0); assemblyscript.setExportRuntime(compilerOptions, opts.exportRuntime); - assemblyscript.setBundleVersion(compilerOptions, exports.version); + assemblyscript.setBundleVersion(compilerOptions, bundleMajorVersion, bundleMinorVersion, bundlePatchVersion); if (!opts.stackSize && opts.runtime == "incremental") { opts.stackSize = assemblyscript.DEFAULT_STACK_SIZE; } diff --git a/src/compiler.ts b/src/compiler.ts index 802679e161..786f3619f0 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -251,8 +251,12 @@ export class Options { exportRuntime: bool = false; /** Stack size in bytes, if using a stack. */ stackSize: i32 = 0; - /* Bundle version from the root package.json */ - bundleVersion: string = "0.0.0"; + /** Semantic major bundle version from root package.json */ + bundleMajorVersion: i32 = 0; + /** Semantic minor bundle version from root package.json */ + bundleMinorVersion: i32 = 0; + /** Semantic patch bundle version from root package.json */ + bundlePatchVersion: i32 = 0; /** Hinted optimize level. Not applied by the compiler itself. */ optimizeLevelHint: i32 = 0; diff --git a/src/index.ts b/src/index.ts index 6336001fa0..93019b838c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -142,9 +142,16 @@ export function setStackSize(options: Options, stackSize: i32): void { options.stackSize = stackSize; } -/** Sets the bundle version. */ -export function setBundleVersion(options: Options, bundleVersion: string): void { - options.bundleVersion = bundleVersion; +/** Sets the bundle semantic version. */ +export function setBundleVersion( + options: Options, + bundleMajorVersion: i32, + bundleMinorVersion: i32, + bundlePatchVersion: i32, +): void { + options.bundleMajorVersion = bundleMajorVersion; + options.bundleMinorVersion = bundleMinorVersion; + options.bundlePatchVersion = bundlePatchVersion; } /** Sign extension operations. */ diff --git a/src/program.ts b/src/program.ts index c1a69579cc..8e38b2686f 100644 --- a/src/program.ts +++ b/src/program.ts @@ -943,15 +943,6 @@ export class Program extends DiagnosticEmitter { var options = this.options; - // Semantic version from root package.json - let bundleMinorVersion = 0, bundleMajorVersion = 0, bundlePatchVersion = 0; - const versionParts = (options.bundleVersion || "").split("."); - if(versionParts.length === 3) { - bundleMajorVersion = i32(parseInt(versionParts[0])); - bundleMinorVersion = i32(parseInt(versionParts[1])); - bundlePatchVersion = i32(parseInt(versionParts[2])); - } - // register native types this.registerNativeType(CommonNames.i8, Type.i8); this.registerNativeType(CommonNames.i16, Type.i16); @@ -1023,11 +1014,11 @@ export class Program extends DiagnosticEmitter { this.registerConstantInteger(CommonNames.ASC_EXPORT_RUNTIME, Type.bool, i64_new(options.exportRuntime ? 1 : 0, 0)); this.registerConstantInteger(CommonNames.ASC_VERSION_MAJOR, Type.i32, - i64_new(bundleMajorVersion)); + i64_new(options.bundleMajorVersion)); this.registerConstantInteger(CommonNames.ASC_VERSION_MINOR, Type.i32, - i64_new(bundleMinorVersion)); + i64_new(options.bundleMinorVersion)); this.registerConstantInteger(CommonNames.ASC_VERSION_PATCH, Type.i32, - i64_new(bundlePatchVersion)); + i64_new(options.bundlePatchVersion)); // register feature hints this.registerConstantInteger(CommonNames.ASC_FEATURE_SIGN_EXTENSION, Type.bool, From ca9c1a55e6d05f54fbd1eeedfa4f108dd89b3bb7 Mon Sep 17 00:00:00 2001 From: Barak Ben Noon Date: Mon, 29 Mar 2021 11:53:50 -0400 Subject: [PATCH 10/11] Update cli/asc.js Co-authored-by: Max Graey --- cli/asc.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index 617c5406d0..8a5a0b2843 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -249,9 +249,9 @@ exports.main = function main(argv, options, callback) { let bundleMinorVersion = 0, bundleMajorVersion = 0, bundlePatchVersion = 0; const versionParts = (exports.version || "").split("."); if(versionParts.length === 3) { - bundleMajorVersion = parseInt(versionParts[0]); - bundleMinorVersion = parseInt(versionParts[1]); - bundlePatchVersion = parseInt(versionParts[2]); + bundleMajorVersion = parseInt(versionParts[0]) | 0; + bundleMinorVersion = parseInt(versionParts[1]) | 0; + bundlePatchVersion = parseInt(versionParts[2]) | 0; } const stdout = options.stdout || process.stdout; From 653027ce64bb3de216b5f42384b8fc8bcbb1a0bb Mon Sep 17 00:00:00 2001 From: Max Graey Date: Mon, 29 Mar 2021 19:08:17 +0300 Subject: [PATCH 11/11] Update cli/asc.js --- cli/asc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.js b/cli/asc.js index 8a5a0b2843..f9c8a86b7e 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -248,7 +248,7 @@ exports.main = function main(argv, options, callback) { // Bundle semantic version let bundleMinorVersion = 0, bundleMajorVersion = 0, bundlePatchVersion = 0; const versionParts = (exports.version || "").split("."); - if(versionParts.length === 3) { + if (versionParts.length === 3) { bundleMajorVersion = parseInt(versionParts[0]) | 0; bundleMinorVersion = parseInt(versionParts[1]) | 0; bundlePatchVersion = parseInt(versionParts[2]) | 0;