@swc/core 1.2.118 → 1.2.122

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +3487 -0
  2. package/{LICENSE-APACHE → LICENSE} +0 -0
  3. package/index.js +4 -1
  4. package/package.json +18 -13
  5. package/types.d.ts +1 -1
  6. package/LICENSE-MIT +0 -25
  7. package/jest.config.js +0 -11
  8. package/packages/swc-helpers/package.json +0 -31
  9. package/packages/swc-helpers/src/_apply_decorated_descriptor.js +0 -28
  10. package/packages/swc-helpers/src/_array_with_holes.js +0 -3
  11. package/packages/swc-helpers/src/_array_without_holes.js +0 -9
  12. package/packages/swc-helpers/src/_assert_this_initialized.js +0 -7
  13. package/packages/swc-helpers/src/_async_generator.js +0 -98
  14. package/packages/swc-helpers/src/_async_generator_delegate.js +0 -51
  15. package/packages/swc-helpers/src/_async_iterator.js +0 -17
  16. package/packages/swc-helpers/src/_async_to_generator.js +0 -35
  17. package/packages/swc-helpers/src/_await_async_generator.js +0 -5
  18. package/packages/swc-helpers/src/_await_value.js +0 -3
  19. package/packages/swc-helpers/src/_class_call_check.js +0 -5
  20. package/packages/swc-helpers/src/_class_name_tdz_error.js +0 -3
  21. package/packages/swc-helpers/src/_class_private_field_get.js +0 -7
  22. package/packages/swc-helpers/src/_class_private_field_loose_base.js +0 -7
  23. package/packages/swc-helpers/src/_class_private_field_set.js +0 -14
  24. package/packages/swc-helpers/src/_class_private_method_get.js +0 -7
  25. package/packages/swc-helpers/src/_class_private_method_set.js +0 -3
  26. package/packages/swc-helpers/src/_class_static_private_field_spec_get.js +0 -7
  27. package/packages/swc-helpers/src/_class_static_private_field_spec_set.js +0 -12
  28. package/packages/swc-helpers/src/_construct.js +0 -33
  29. package/packages/swc-helpers/src/_create_class.js +0 -15
  30. package/packages/swc-helpers/src/_create_super.js +0 -18
  31. package/packages/swc-helpers/src/_decorate.js +0 -423
  32. package/packages/swc-helpers/src/_defaults.js +0 -14
  33. package/packages/swc-helpers/src/_define_enumerable_properties.js +0 -22
  34. package/packages/swc-helpers/src/_define_property.js +0 -14
  35. package/packages/swc-helpers/src/_extends.js +0 -21
  36. package/packages/swc-helpers/src/_get.js +0 -25
  37. package/packages/swc-helpers/src/_get_prototype_of.js +0 -10
  38. package/packages/swc-helpers/src/_inherits.js +0 -16
  39. package/packages/swc-helpers/src/_inherits_loose.js +0 -5
  40. package/packages/swc-helpers/src/_initializer_define_property.js +0 -9
  41. package/packages/swc-helpers/src/_initializer_warning_helper.js +0 -3
  42. package/packages/swc-helpers/src/_instanceof.js +0 -7
  43. package/packages/swc-helpers/src/_interop_require_default.js +0 -5
  44. package/packages/swc-helpers/src/_interop_require_wildcard.js +0 -24
  45. package/packages/swc-helpers/src/_is_native_function.js +0 -3
  46. package/packages/swc-helpers/src/_is_native_reflect_construct.js +0 -11
  47. package/packages/swc-helpers/src/_iterable_to_array.js +0 -3
  48. package/packages/swc-helpers/src/_iterable_to_array_limit.js +0 -25
  49. package/packages/swc-helpers/src/_iterable_to_array_limit_loose.js +0 -11
  50. package/packages/swc-helpers/src/_jsx.js +0 -47
  51. package/packages/swc-helpers/src/_new_arrow_check.js +0 -5
  52. package/packages/swc-helpers/src/_non_iterable_rest.js +0 -3
  53. package/packages/swc-helpers/src/_non_iterable_spread.js +0 -3
  54. package/packages/swc-helpers/src/_object_spread.js +0 -20
  55. package/packages/swc-helpers/src/_object_without_properties.js +0 -20
  56. package/packages/swc-helpers/src/_object_without_properties_loose.js +0 -14
  57. package/packages/swc-helpers/src/_possible_constructor_return.js +0 -10
  58. package/packages/swc-helpers/src/_read_only_error.js +0 -3
  59. package/packages/swc-helpers/src/_set.js +0 -51
  60. package/packages/swc-helpers/src/_set_prototype_of.js +0 -12
  61. package/packages/swc-helpers/src/_skip_first_generator_next.js +0 -7
  62. package/packages/swc-helpers/src/_sliced_to_array.js +0 -7
  63. package/packages/swc-helpers/src/_sliced_to_array_loose.js +0 -7
  64. package/packages/swc-helpers/src/_super_prop_base.js +0 -10
  65. package/packages/swc-helpers/src/_tagged_template_literal.js +0 -11
  66. package/packages/swc-helpers/src/_tagged_template_literal_loose.js +0 -8
  67. package/packages/swc-helpers/src/_throw.js +0 -3
  68. package/packages/swc-helpers/src/_to_array.js +0 -7
  69. package/packages/swc-helpers/src/_to_consumable_array.js +0 -7
  70. package/packages/swc-helpers/src/_to_primitive.js +0 -14
  71. package/packages/swc-helpers/src/_to_property_key.js +0 -7
  72. package/packages/swc-helpers/src/_type_of.js +0 -3
  73. package/packages/swc-helpers/src/_wrap_async_generator.js +0 -7
  74. package/packages/swc-helpers/src/_wrap_native_super.js +0 -42
  75. package/packages/swc-helpers/src/index.js +0 -66
File without changes
package/index.js CHANGED
@@ -31,10 +31,13 @@ var __rest = (this && this.__rest) || function (s, e) {
31
31
  };
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.DEFAULT_EXTENSIONS = exports.minifySync = exports.minify = exports.bundle = exports.transformFileSync = exports.transformFile = exports.transformSync = exports.transform = exports.printSync = exports.print = exports.parseFileSync = exports.parseFile = exports.parseSync = exports.parse = exports.Compiler = exports.plugins = exports.version = void 0;
34
+ const path_1 = require("path");
34
35
  __exportStar(require("./types"), exports);
35
36
  const spack_1 = require("./spack");
36
37
  const helper_1 = require("@node-rs/helper");
37
- const bindings = helper_1.loadBinding(__dirname, "swc", "@swc/core");
38
+ // Allow overrides to the location of the .node binding file
39
+ const bindingsOverride = process.env["SWC_BINARY_PATH"];
40
+ const bindings = !!bindingsOverride ? require(path_1.resolve(bindingsOverride)) : helper_1.loadBinding(__dirname, "swc", "@swc/core");
38
41
  /**
39
42
  * Version of the swc binding.
40
43
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swc/core",
3
- "version": "1.2.118",
3
+ "version": "1.2.122",
4
4
  "description": "Super-fast alternative for babel",
5
5
  "homepage": "https://swc.rs",
6
6
  "main": "./index.js",
@@ -50,21 +50,22 @@
50
50
  "@node-rs/helper": "^1.0.0"
51
51
  },
52
52
  "optionalDependencies": {
53
- "@swc/core-win32-x64-msvc": "^1.2.118",
54
- "@swc/core-darwin-x64": "^1.2.118",
55
- "@swc/core-linux-x64-gnu": "^1.2.118",
56
- "@swc/core-linux-x64-musl": "^1.2.118",
57
- "@swc/core-freebsd-x64": "^1.2.118",
58
- "@swc/core-win32-ia32-msvc": "^1.2.118",
59
- "@swc/core-linux-arm64-gnu": "^1.2.118",
60
- "@swc/core-linux-arm-gnueabihf": "^1.2.118",
61
- "@swc/core-darwin-arm64": "^1.2.118",
62
- "@swc/core-android-arm64": "^1.2.118",
63
- "@swc/core-linux-arm64-musl": "^1.2.118",
64
- "@swc/core-win32-arm64-msvc": "^1.2.118"
53
+ "@swc/core-win32-x64-msvc": "^1.2.122",
54
+ "@swc/core-darwin-x64": "^1.2.122",
55
+ "@swc/core-linux-x64-gnu": "^1.2.122",
56
+ "@swc/core-linux-x64-musl": "^1.2.122",
57
+ "@swc/core-freebsd-x64": "^1.2.122",
58
+ "@swc/core-win32-ia32-msvc": "^1.2.122",
59
+ "@swc/core-linux-arm64-gnu": "^1.2.122",
60
+ "@swc/core-linux-arm-gnueabihf": "^1.2.122",
61
+ "@swc/core-darwin-arm64": "^1.2.122",
62
+ "@swc/core-android-arm64": "^1.2.122",
63
+ "@swc/core-linux-arm64-musl": "^1.2.122",
64
+ "@swc/core-win32-arm64-msvc": "^1.2.122"
65
65
  },
66
66
  "types": "./index.d.ts",
67
67
  "scripts": {
68
+ "changelog": "git cliff --output CHANGELOG.md",
68
69
  "prepare": "husky install && git config feature.manyFiles true",
69
70
  "artifacts": "napi artifacts --dist scripts/npm",
70
71
  "prepublishOnly": "tsc -d && napi prepublish -p scripts/npm --tagstyle npm",
@@ -75,6 +76,7 @@
75
76
  "version": "napi version -p scripts/npm"
76
77
  },
77
78
  "devDependencies": {
79
+ "@babel/compat-data": "^7.16.4",
78
80
  "@babel/core": "^7.13.16",
79
81
  "@babel/plugin-proposal-class-properties": "^7.13.0",
80
82
  "@babel/plugin-proposal-decorators": "^7.13.15",
@@ -96,12 +98,15 @@
96
98
  "core-js": "^2.6.11",
97
99
  "cross-env": "^7.0.3",
98
100
  "cspell": "^5.12.3",
101
+ "expect": "^27.4.2",
99
102
  "husky": "^7.0.2",
100
103
  "jest": "^27.0.1",
101
104
  "lodash": "^4.17.21",
105
+ "mocha": "^9.1.3",
102
106
  "progress": "^2.0.3",
103
107
  "prop-types": "^15.7.2",
104
108
  "react": "^17.0.2",
109
+ "reflect-metadata": "^0.1.13",
105
110
  "regenerator-runtime": "^0.13.9",
106
111
  "source-map": "^0.7.3",
107
112
  "source-map-support": "^0.5.19",
package/types.d.ts CHANGED
@@ -1051,7 +1051,7 @@ export interface NamedExportSpecifier extends Node, HasSpan {
1051
1051
  /**
1052
1052
  * `Some(bar)` in `export { foo as bar }`
1053
1053
  */
1054
- exported: Identifier;
1054
+ exported: Identifier | null;
1055
1055
  }
1056
1056
  interface HasInterpreter {
1057
1057
  /**
package/LICENSE-MIT DELETED
@@ -1,25 +0,0 @@
1
- Copyright (c) 2017 The swc Project Developers
2
-
3
- Permission is hereby granted, free of charge, to any
4
- person obtaining a copy of this software and associated
5
- documentation files (the "Software"), to deal in the
6
- Software without restriction, including without
7
- limitation the rights to use, copy, modify, merge,
8
- publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software
10
- is furnished to do so, subject to the following
11
- conditions:
12
-
13
- The above copyright notice and this permission notice
14
- shall be included in all copies or substantial portions
15
- of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
18
- ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
- TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
20
- PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
21
- SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
24
- IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
- DEALINGS IN THE SOFTWARE.
package/jest.config.js DELETED
@@ -1,11 +0,0 @@
1
- module.exports = {
2
- testMatch: ["**/__tests__/**/*.[jt]s?(x)", "**/__tests__/**/*.m[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"],
3
- transform: {
4
- },
5
- // transform: {
6
- // "^.+\\.jsx?$": "babel-jest",
7
- // "^.+\\.mjs$": "babel-jest",
8
- // },
9
- testPathIgnorePatterns: ["<rootDir>/build/", "<rootDir>/node_modules/"],
10
- moduleFileExtensions: ["js", "jsx", "mjs"]
11
- }
@@ -1,31 +0,0 @@
1
- {
2
- "name": "@swc/helpers",
3
- "version": "0.2.14",
4
- "description": "External helpers for the swc project.",
5
- "esnext": "src/index.js",
6
- "module": "src/index.js",
7
- "main": "lib/index.js",
8
- "sideEffects": false,
9
- "scripts": {
10
- "build": "swc -V && swc src -d lib",
11
- "prepublishOnly": "swc src -d lib"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "git+https://github.com/swc-project/swc.git"
16
- },
17
- "keywords": [
18
- "swc",
19
- "helpers"
20
- ],
21
- "author": "강동윤 <kdy1997.dev@gmail.com>",
22
- "license": "MIT",
23
- "bugs": {
24
- "url": "https://github.com/swc-project/swc/issues"
25
- },
26
- "homepage": "https://swc.rs",
27
- "devDependencies": {
28
- "@swc/cli": "^0.1.36",
29
- "@swc/core": "^1.2.58"
30
- }
31
- }
@@ -1,28 +0,0 @@
1
- export default function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
2
- var desc = {};
3
- Object['ke' + 'ys'](descriptor).forEach(function (key) {
4
- desc[key] = descriptor[key];
5
- });
6
- desc.enumerable = !!desc.enumerable;
7
- desc.configurable = !!desc.configurable;
8
-
9
- if ('value' in desc || desc.initializer) {
10
- desc.writable = true;
11
- }
12
-
13
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
14
- return decorator ? (decorator(target, property, desc) || desc) : desc;
15
- }, desc);
16
-
17
- if (context && desc.initializer !== void 0) {
18
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
19
- desc.initializer = undefined;
20
- }
21
-
22
- if (desc.initializer === void 0) {
23
- Object['define' + 'Property'](target, property, desc);
24
- desc = null;
25
- }
26
-
27
- return desc;
28
- }
@@ -1,3 +0,0 @@
1
- export default function _arrayWithHoles(arr) {
2
- if (Array.isArray(arr)) return arr;
3
- }
@@ -1,9 +0,0 @@
1
- export default function _arrayWithoutHoles(arr) {
2
- if (Array.isArray(arr)) {
3
- for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
4
- arr2[i] = arr[i];
5
- }
6
-
7
- return arr2;
8
- }
9
- }
@@ -1,7 +0,0 @@
1
- export default function _assertThisInitialized(self) {
2
- if (self === void 0) {
3
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4
- }
5
-
6
- return self;
7
- }
@@ -1,98 +0,0 @@
1
- import AwaitValue from './_await_value';
2
-
3
- export default function AsyncGenerator(gen) {
4
- var front, back;
5
-
6
- function send(key, arg) {
7
- return new Promise(function (resolve, reject) {
8
- var request = {
9
- key: key,
10
- arg: arg,
11
- resolve: resolve,
12
- reject: reject,
13
- next: null
14
- };
15
-
16
- if (back) {
17
- back = back.next = request;
18
- } else {
19
- front = back = request;
20
- resume(key, arg);
21
- }
22
- });
23
- }
24
-
25
- function resume(key, arg) {
26
- try {
27
- var result = gen[key](arg);
28
- var value = result.value;
29
- var wrappedAwait = value instanceof AwaitValue;
30
- Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) {
31
- if (wrappedAwait) {
32
- resume("next", arg);
33
- return;
34
- }
35
-
36
- settle(result.done ? "return" : "normal", arg);
37
- }, function (err) {
38
- resume("throw", err);
39
- });
40
- } catch (err) {
41
- settle("throw", err);
42
- }
43
- }
44
-
45
- function settle(type, value) {
46
- switch (type) {
47
- case "return":
48
- front.resolve({
49
- value: value,
50
- done: true
51
- });
52
- break;
53
-
54
- case "throw":
55
- front.reject(value);
56
- break;
57
-
58
- default:
59
- front.resolve({
60
- value: value,
61
- done: false
62
- });
63
- break;
64
- }
65
-
66
- front = front.next;
67
-
68
- if (front) {
69
- resume(front.key, front.arg);
70
- } else {
71
- back = null;
72
- }
73
- }
74
-
75
- this._invoke = send;
76
-
77
- if (typeof gen.return !== "function") {
78
- this.return = undefined;
79
- }
80
- }
81
-
82
- if (typeof Symbol === "function" && Symbol.asyncIterator) {
83
- AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
84
- return this;
85
- };
86
- }
87
-
88
- AsyncGenerator.prototype.next = function (arg) {
89
- return this._invoke("next", arg);
90
- };
91
-
92
- AsyncGenerator.prototype.throw = function (arg) {
93
- return this._invoke("throw", arg);
94
- };
95
-
96
- AsyncGenerator.prototype.return = function (arg) {
97
- return this._invoke("return", arg);
98
- };
@@ -1,51 +0,0 @@
1
- export default function _asyncGeneratorDelegate(inner, awaitWrap) {
2
- var iter = {},
3
- waiting = false;
4
-
5
- function pump(key, value) {
6
- waiting = true;
7
- value = new Promise(function (resolve) {
8
- resolve(inner[key](value));
9
- });
10
- return {
11
- done: false,
12
- value: awaitWrap(value)
13
- };
14
- }
15
-
16
- ;
17
-
18
- if (typeof Symbol === "function" && Symbol.iterator) {
19
- iter[Symbol.iterator] = function () {
20
- return this;
21
- };
22
- }
23
-
24
- iter.next = function (value) {
25
- if (waiting) {
26
- waiting = false;
27
- return value;
28
- }
29
-
30
- return pump("next", value);
31
- };
32
-
33
- if (typeof inner.throw === "function") {
34
- iter.throw = function (value) {
35
- if (waiting) {
36
- waiting = false;
37
- throw value;
38
- }
39
-
40
- return pump("throw", value);
41
- };
42
- }
43
-
44
- if (typeof inner.return === "function") {
45
- iter.return = function (value) {
46
- return pump("return", value);
47
- };
48
- }
49
-
50
- return iter;
51
- }
@@ -1,17 +0,0 @@
1
- export default function _asyncIterator(iterable) {
2
- var method;
3
-
4
- if (typeof Symbol === "function") {
5
- if (Symbol.asyncIterator) {
6
- method = iterable[Symbol.asyncIterator];
7
- if (method != null) return method.call(iterable);
8
- }
9
-
10
- if (Symbol.iterator) {
11
- method = iterable[Symbol.iterator];
12
- if (method != null) return method.call(iterable);
13
- }
14
- }
15
-
16
- throw new TypeError("Object is not async iterable");
17
- }
@@ -1,35 +0,0 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
- try {
3
- var info = gen[key](arg);
4
- var value = info.value;
5
- } catch (error) {
6
- reject(error);
7
- return;
8
- }
9
-
10
- if (info.done) {
11
- resolve(value);
12
- } else {
13
- Promise.resolve(value).then(_next, _throw);
14
- }
15
- }
16
-
17
- export default function _asyncToGenerator(fn) {
18
- return function () {
19
- var self = this,
20
- args = arguments;
21
- return new Promise(function (resolve, reject) {
22
- var gen = fn.apply(self, args);
23
-
24
- function _next(value) {
25
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
26
- }
27
-
28
- function _throw(err) {
29
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
30
- }
31
-
32
- _next(undefined);
33
- });
34
- };
35
- }
@@ -1,5 +0,0 @@
1
- import AwaitValue from './_await_value';
2
-
3
- export default function _awaitAsyncGenerator(value) {
4
- return new AwaitValue(value);
5
- }
@@ -1,3 +0,0 @@
1
- export default function _AwaitValue(value) {
2
- this.wrapped = value;
3
- }
@@ -1,5 +0,0 @@
1
- export default function _classCallCheck(instance, Constructor) {
2
- if (!(instance instanceof Constructor)) {
3
- throw new TypeError("Cannot call a class as a function");
4
- }
5
- }
@@ -1,3 +0,0 @@
1
- export default function _classNameTDZError(name) {
2
- throw new Error("Class \"" + name + "\" cannot be referenced in computed property keys.");
3
- }
@@ -1,7 +0,0 @@
1
- export default function _classPrivateFieldGet(receiver, privateMap) {
2
- if (!privateMap.has(receiver)) {
3
- throw new TypeError("attempted to get private field on non-instance");
4
- }
5
-
6
- return privateMap.get(receiver).value;
7
- }
@@ -1,7 +0,0 @@
1
- export default function _classPrivateFieldBase(receiver, privateKey) {
2
- if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
3
- throw new TypeError("attempted to use private field on non-instance");
4
- }
5
-
6
- return receiver;
7
- }
@@ -1,14 +0,0 @@
1
- export default function _classPrivateFieldSet(receiver, privateMap, value) {
2
- if (!privateMap.has(receiver)) {
3
- throw new TypeError("attempted to set private field on non-instance");
4
- }
5
-
6
- var descriptor = privateMap.get(receiver);
7
-
8
- if (!descriptor.writable) {
9
- throw new TypeError("attempted to set read only private field");
10
- }
11
-
12
- descriptor.value = value;
13
- return value;
14
- }
@@ -1,7 +0,0 @@
1
- export default function _classPrivateMethodGet(receiver, privateSet, fn) {
2
- if (!privateSet.has(receiver)) {
3
- throw new TypeError("attempted to get private field on non-instance");
4
- }
5
-
6
- return fn;
7
- }
@@ -1,3 +0,0 @@
1
- export default function _classPrivateMethodSet() {
2
- throw new TypeError("attempted to reassign private method");
3
- }
@@ -1,7 +0,0 @@
1
- export default function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
2
- if (receiver !== classConstructor) {
3
- throw new TypeError("Private static access of wrong provenance");
4
- }
5
-
6
- return descriptor.value;
7
- }
@@ -1,12 +0,0 @@
1
- export default function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) {
2
- if (receiver !== classConstructor) {
3
- throw new TypeError("Private static access of wrong provenance");
4
- }
5
-
6
- if (!descriptor.writable) {
7
- throw new TypeError("attempted to set read only private field");
8
- }
9
-
10
- descriptor.value = value;
11
- return value;
12
- }
@@ -1,33 +0,0 @@
1
- function isNativeReflectConstruct() {
2
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3
- if (Reflect.construct.sham) return false;
4
- if (typeof Proxy === "function") return true;
5
-
6
- try {
7
- Date.prototype.toString.call(Reflect.construct(Date, [], function () { }));
8
- return true;
9
- } catch (e) {
10
- return false;
11
- }
12
- }
13
-
14
- function construct(Parent, args, Class) {
15
- if (isNativeReflectConstruct()) {
16
- construct = Reflect.construct;
17
- } else {
18
- construct = function construct(Parent, args, Class) {
19
- var a = [null];
20
- a.push.apply(a, args);
21
- var Constructor = Function.bind.apply(Parent, a);
22
- var instance = new Constructor();
23
- if (Class) _setPrototypeOf(instance, Class.prototype);
24
- return instance;
25
- };
26
- }
27
-
28
- return construct.apply(null, arguments);
29
- }
30
-
31
- export default function _construct(Parent, args, Class) {
32
- return construct.apply(null, arguments);
33
- }
@@ -1,15 +0,0 @@
1
- function _defineProperties(target, props) {
2
- for (var i = 0; i < props.length; i++) {
3
- var descriptor = props[i];
4
- descriptor.enumerable = descriptor.enumerable || false;
5
- descriptor.configurable = true;
6
- if ("value" in descriptor) descriptor.writable = true;
7
- Object.defineProperty(target, descriptor.key, descriptor);
8
- }
9
- }
10
-
11
- export default function _createClass(Constructor, protoProps, staticProps) {
12
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
13
- if (staticProps) _defineProperties(Constructor, staticProps);
14
- return Constructor;
15
- }
@@ -1,18 +0,0 @@
1
- import _isNativeReflectConstruct from "./_is_native_reflect_construct";
2
- import _getPrototypeOf from "./_get_prototype_of";
3
- import _possibleConstructorReturn from './_possible_constructor_return';
4
-
5
- export default function _createSuper(Derived) {
6
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
7
- return function _createSuperInternal() {
8
- var Super = _getPrototypeOf(Derived),
9
- result;
10
- if (hasNativeReflectConstruct) {
11
- var NewTarget = _getPrototypeOf(this).constructor;
12
- result = Reflect.construct(Super, arguments, NewTarget);
13
- } else {
14
- result = Super.apply(this, arguments);
15
- }
16
- return _possibleConstructorReturn(this, result);
17
- };
18
- }