Initializer and version-coercion fixes. (Also updated the tests and the makefile)
This commit is contained in:
parent
5dbb90ede3
commit
9c9f830ac0
6
Makefile
6
Makefile
@ -199,6 +199,12 @@ new-version:
|
|||||||
git pull --rebase
|
git pull --rebase
|
||||||
yarn lerna version --force-publish=$(FORCE_PUBLISH)
|
yarn lerna version --force-publish=$(FORCE_PUBLISH)
|
||||||
|
|
||||||
|
version-cerxes:
|
||||||
|
yarn lerna version prerelease --allow-branch initializers-fix --preid csx
|
||||||
|
|
||||||
|
publish-cerxes: prepublish
|
||||||
|
yarn lerna publish --registry="https://npm.cerxes.net" --force-publish --allow-branch initializers-fix --canary --preid csx --dist-tag csx
|
||||||
|
|
||||||
# NOTE: Run make new-version first
|
# NOTE: Run make new-version first
|
||||||
publish: prepublish
|
publish: prepublish
|
||||||
yarn lerna publish from-git
|
yarn lerna publish from-git
|
||||||
|
|||||||
@ -70,7 +70,7 @@ function assertVersion(range: string | number): void {
|
|||||||
throw new Error("Expected string or integer value.");
|
throw new Error("Expected string or integer value.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (semver.satisfies(coreVersion, range)) return;
|
if (semver.satisfies(semver.coerce(coreVersion).raw, range)) return;
|
||||||
|
|
||||||
const limit = Error.stackTraceLimit;
|
const limit = Error.stackTraceLimit;
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,8 @@
|
|||||||
"@babel/helper-optimise-call-expression": "^7.7.4",
|
"@babel/helper-optimise-call-expression": "^7.7.4",
|
||||||
"@babel/helper-plugin-utils": "^7.0.0",
|
"@babel/helper-plugin-utils": "^7.0.0",
|
||||||
"@babel/helper-replace-supers": "^7.7.4",
|
"@babel/helper-replace-supers": "^7.7.4",
|
||||||
"@babel/helper-split-export-declaration": "^7.7.4"
|
"@babel/helper-split-export-declaration": "^7.7.4",
|
||||||
|
"semver": "^5.5.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@babel/core": "^7.0.0"
|
"@babel/core": "^7.0.0"
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import nameFunction from "@babel/helper-function-name";
|
import nameFunction from "@babel/helper-function-name";
|
||||||
import splitExportDeclaration from "@babel/helper-split-export-declaration";
|
import splitExportDeclaration from "@babel/helper-split-export-declaration";
|
||||||
|
import semver from "semver";
|
||||||
import {
|
import {
|
||||||
buildPrivateNamesNodes,
|
buildPrivateNamesNodes,
|
||||||
buildPrivateNamesMap,
|
buildPrivateNamesMap,
|
||||||
@ -27,7 +28,10 @@ export { FEATURES, injectInitialization };
|
|||||||
// as 70000100005. This method is easier than using a semver-parsing
|
// as 70000100005. This method is easier than using a semver-parsing
|
||||||
// package, but it breaks if we release x.y.z where x, y or z are
|
// package, but it breaks if we release x.y.z where x, y or z are
|
||||||
// greater than 99_999.
|
// greater than 99_999.
|
||||||
const version = pkg.version.split(".").reduce((v, x) => v * 1e5 + +x, 0);
|
const version = semver
|
||||||
|
.coerce(pkg.version)
|
||||||
|
.raw.split(".")
|
||||||
|
.reduce((v, x) => v * 1e5 + +x, 0);
|
||||||
const versionKey = "@babel/plugin-class-features/version";
|
const versionKey = "@babel/plugin-class-features/version";
|
||||||
|
|
||||||
export function createClassFeaturePlugin({
|
export function createClassFeaturePlugin({
|
||||||
|
|||||||
@ -19,7 +19,8 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/helper-regex": "^7.4.4",
|
"@babel/helper-regex": "^7.4.4",
|
||||||
"regexpu-core": "^4.6.0"
|
"regexpu-core": "^4.6.0",
|
||||||
|
"semver": "^5.5.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@babel/core": "^7.0.0"
|
"@babel/core": "^7.0.0"
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import semver from "semver";
|
||||||
import rewritePattern from "regexpu-core";
|
import rewritePattern from "regexpu-core";
|
||||||
import {
|
import {
|
||||||
featuresKey,
|
featuresKey,
|
||||||
@ -16,7 +17,10 @@ import { pullFlag } from "@babel/helper-regex";
|
|||||||
// as 70000100005. This method is easier than using a semver-parsing
|
// as 70000100005. This method is easier than using a semver-parsing
|
||||||
// package, but it breaks if we release x.y.z where x, y or z are
|
// package, but it breaks if we release x.y.z where x, y or z are
|
||||||
// greater than 99_999.
|
// greater than 99_999.
|
||||||
const version = pkg.version.split(".").reduce((v, x) => v * 1e5 + +x, 0);
|
const version = semver
|
||||||
|
.coerce(pkg.version)
|
||||||
|
.raw.split(".")
|
||||||
|
.reduce((v, x) => v * 1e5 + +x, 0);
|
||||||
const versionKey = "@babel/plugin-regexp-features/version";
|
const versionKey = "@babel/plugin-regexp-features/version";
|
||||||
|
|
||||||
export function createRegExpFeaturePlugin({ name, feature, options = {} }) {
|
export function createRegExpFeaturePlugin({ name, feature, options = {} }) {
|
||||||
|
|||||||
@ -1053,15 +1053,19 @@ helpers.initializerWarningHelper = helper("7.0.0-beta.0")`
|
|||||||
* Add a helper to call as a replacement for class property definition.
|
* Add a helper to call as a replacement for class property definition.
|
||||||
*/
|
*/
|
||||||
helpers.initializerDefineProperty = helper("7.0.0-beta.0")`
|
helpers.initializerDefineProperty = helper("7.0.0-beta.0")`
|
||||||
export default function _initializerDefineProperty(target, property, descriptor, context){
|
export default function _initializerDefineProperty(target, property, descriptor, context) {
|
||||||
if (!descriptor) return;
|
if (!descriptor) return;
|
||||||
|
|
||||||
Object.defineProperty(target, property, {
|
if(descriptor.initializer){
|
||||||
enumerable: descriptor.enumerable,
|
if(descriptor.set){
|
||||||
configurable: descriptor.configurable,
|
descriptor.set.call(context, descriptor.initializer.call(context));
|
||||||
writable: descriptor.writable,
|
}else{
|
||||||
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0,
|
descriptor.value = descriptor.initializer.call(context);
|
||||||
});
|
}
|
||||||
|
delete descriptor.initializer;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(target, property, descriptor);
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
var _class, _descriptor, _descriptor2, _temp;
|
var _class, _descriptor, _descriptor2, _temp;
|
||||||
|
|
||||||
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; if (descriptor.initializer) { if (descriptor.set) { descriptor.set.call(context, descriptor.initializer.call(context)); } else { descriptor.value = descriptor.initializer.call(context); } delete descriptor.initializer; } Object.defineProperty(target, property, descriptor); }
|
||||||
|
|
||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
var _class, _descriptor, _descriptor2, _temp;
|
var _class, _descriptor, _descriptor2, _temp;
|
||||||
|
|
||||||
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; if (descriptor.initializer) { if (descriptor.set) { descriptor.set.call(context, descriptor.initializer.call(context)); } else { descriptor.value = descriptor.initializer.call(context); } delete descriptor.initializer; } Object.defineProperty(target, property, descriptor); }
|
||||||
|
|
||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
var _class, _descriptor, _descriptor2, _temp;
|
var _class, _descriptor, _descriptor2, _temp;
|
||||||
|
|
||||||
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; if (descriptor.initializer) { if (descriptor.set) { descriptor.set.call(context, descriptor.initializer.call(context)); } else { descriptor.value = descriptor.initializer.call(context); } delete descriptor.initializer; } Object.defineProperty(target, property, descriptor); }
|
||||||
|
|
||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ let _Symbol$search;
|
|||||||
|
|
||||||
var _class, _descriptor, _temp;
|
var _class, _descriptor, _temp;
|
||||||
|
|
||||||
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; if (descriptor.initializer) { if (descriptor.set) { descriptor.set.call(context, descriptor.initializer.call(context)); } else { descriptor.value = descriptor.initializer.call(context); } delete descriptor.initializer; } Object.defineProperty(target, property, descriptor); }
|
||||||
|
|
||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import _Array$from from "../../core-js/array/from";
|
import _Array$from from "..\\../core-js/array/from";
|
||||||
import _isIterable from "../../core-js/is-iterable";
|
import _isIterable from "..\\../core-js/is-iterable";
|
||||||
export default function _iterableToArray(iter) {
|
export default function _iterableToArray(iter) {
|
||||||
if (_isIterable(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return _Array$from(iter);
|
if (_isIterable(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return _Array$from(iter);
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user