condenser 1.2 → 1.3
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.
- checksums.yaml +4 -4
- data/lib/condenser/asset.rb +19 -16
- data/lib/condenser/build_cache.rb +1 -1
- data/lib/condenser/context.rb +9 -25
- data/lib/condenser/helpers/parse_helpers.rb +1 -1
- data/lib/condenser/manifest.rb +3 -1
- data/lib/condenser/pipeline.rb +8 -3
- data/lib/condenser/processors/babel_processor.rb +1 -1
- data/lib/condenser/processors/css_media_combiner_processor.rb +81 -0
- data/lib/condenser/processors/js_analyzer.rb +0 -2
- data/lib/condenser/processors/purgecss_processor.rb +6 -4
- data/lib/condenser/processors/rollup_processor.rb +37 -35
- data/lib/condenser/resolve.rb +1 -3
- data/lib/condenser/templating_engine/ejs.rb +1 -1
- data/lib/condenser/transformers/dart_sass_transformer.rb +285 -0
- data/lib/condenser/transformers/jst_transformer.rb +67 -17
- data/lib/condenser/transformers/sass/functions.rb +133 -0
- data/lib/condenser/transformers/sass/importer.rb +48 -0
- data/lib/condenser/transformers/sass.rb +4 -0
- data/lib/condenser/transformers/sass_transformer.rb +124 -281
- data/lib/condenser/transformers/svg_transformer/base.rb +26 -0
- data/lib/condenser/transformers/svg_transformer/tag.rb +54 -0
- data/lib/condenser/transformers/svg_transformer/template.rb +151 -0
- data/lib/condenser/transformers/svg_transformer/template_error.rb +2 -0
- data/lib/condenser/transformers/svg_transformer/value.rb +13 -0
- data/lib/condenser/transformers/svg_transformer/var_generator.rb +10 -0
- data/lib/condenser/transformers/svg_transformer.rb +19 -0
- data/lib/condenser/version.rb +1 -1
- data/lib/condenser.rb +17 -5
- data/test/cache_test.rb +46 -2
- data/test/dependency_test.rb +2 -2
- data/test/manifest_test.rb +34 -0
- data/test/minifiers/terser_minifier_test.rb +0 -1
- data/test/minifiers/uglify_minifier_test.rb +0 -1
- data/test/postprocessors/css_media_combiner_test.rb +107 -0
- data/test/postprocessors/purgecss_test.rb +62 -0
- data/test/preprocessor/babel_test.rb +693 -299
- data/test/preprocessor/js_analyzer_test.rb +0 -2
- data/test/processors/rollup_test.rb +50 -20
- data/test/resolve_test.rb +8 -9
- data/test/server_test.rb +6 -1
- data/test/templates/ejs_test.rb +2 -11
- data/test/templates/erb_test.rb +0 -5
- data/test/test_helper.rb +3 -1
- data/test/transformers/dart_scss_test.rb +139 -0
- data/test/transformers/jst_test.rb +165 -21
- data/test/transformers/scss_test.rb +14 -0
- data/test/transformers/svg_test.rb +40 -0
- metadata +23 -6
- data/lib/condenser/transformers/sass_transformer/importer.rb +0 -50
@@ -4,6 +4,10 @@ class CondenserBabelTest < ActiveSupport::TestCase
|
|
4
4
|
|
5
5
|
def setup
|
6
6
|
super
|
7
|
+
@env.unregister_preprocessor('application/javascript', Condenser::JSAnalyzer)
|
8
|
+
@env.register_preprocessor 'application/javascript', Condenser::BabelProcessor.new(@npm_dir,
|
9
|
+
presets: [ ['@babel/preset-env', { modules: false, targets: { browsers: 'firefox > 41' } }] ]
|
10
|
+
)
|
7
11
|
@env.unregister_minifier 'application/javascript'
|
8
12
|
end
|
9
13
|
|
@@ -38,64 +42,12 @@ class CondenserBabelTest < ActiveSupport::TestCase
|
|
38
42
|
/assets/error.js: Unexpected token (3:13)
|
39
43
|
|
40
44
|
1 | console.log('this file has an error');
|
41
|
-
2 |
|
45
|
+
2 |
|
42
46
|
> 3 | var error = {;
|
43
47
|
| ^
|
44
|
-
4 |
|
48
|
+
4 |
|
45
49
|
ERROR
|
46
50
|
end
|
47
|
-
|
48
|
-
test 'not duplicating babel-helpers' do
|
49
|
-
file 'a.js', <<-JS
|
50
|
-
export default class {
|
51
|
-
constructor(height, width) {
|
52
|
-
console.log('A');
|
53
|
-
}
|
54
|
-
};
|
55
|
-
JS
|
56
|
-
file 'b.js', <<-JS
|
57
|
-
export default class {
|
58
|
-
constructor(height, width) {
|
59
|
-
console.log('B');
|
60
|
-
}
|
61
|
-
};
|
62
|
-
JS
|
63
|
-
file 'c.js', <<~JS
|
64
|
-
import a from 'a';
|
65
|
-
import b from 'b';
|
66
|
-
|
67
|
-
new a();
|
68
|
-
new b();
|
69
|
-
JS
|
70
|
-
|
71
|
-
assert_exported_file 'c.js', 'application/javascript', <<~JS
|
72
|
-
(function () {
|
73
|
-
'use strict';
|
74
|
-
|
75
|
-
function _classCallCheck(instance, Constructor) {
|
76
|
-
if (!(instance instanceof Constructor)) {
|
77
|
-
throw new TypeError("Cannot call a class as a function");
|
78
|
-
}
|
79
|
-
}
|
80
|
-
|
81
|
-
var _default = function _default(height, width) {
|
82
|
-
_classCallCheck(this, _default);
|
83
|
-
|
84
|
-
console.log('A');
|
85
|
-
};
|
86
|
-
|
87
|
-
var _default$1 = function _default(height, width) {
|
88
|
-
_classCallCheck(this, _default);
|
89
|
-
|
90
|
-
console.log('B');
|
91
|
-
};
|
92
|
-
|
93
|
-
new _default();
|
94
|
-
new _default$1();
|
95
|
-
|
96
|
-
}());
|
97
|
-
JS
|
98
|
-
end
|
99
51
|
|
100
52
|
test 'not duplicating polyfills' do
|
101
53
|
file 'a.js', <<-JS
|
@@ -122,21 +74,27 @@ class CondenserBabelTest < ActiveSupport::TestCase
|
|
122
74
|
|
123
75
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
124
76
|
|
77
|
+
function getDefaultExportFromCjs (x) {
|
78
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
79
|
+
}
|
80
|
+
|
125
81
|
var check = function (it) {
|
126
|
-
return it && it.Math
|
82
|
+
return it && it.Math === Math && it;
|
127
83
|
};
|
128
84
|
|
129
85
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
130
|
-
var
|
131
|
-
// eslint-disable-next-line no-
|
86
|
+
var global$9 =
|
87
|
+
// eslint-disable-next-line es/no-global-this -- safe
|
132
88
|
check(typeof globalThis == 'object' && globalThis) ||
|
133
89
|
check(typeof window == 'object' && window) ||
|
90
|
+
// eslint-disable-next-line no-restricted-globals -- safe
|
134
91
|
check(typeof self == 'object' && self) ||
|
135
92
|
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
|
136
|
-
|
93
|
+
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
|
94
|
+
// eslint-disable-next-line no-new-func -- fallback
|
137
95
|
(function () { return this; })() || Function('return this')();
|
138
96
|
|
139
|
-
var fails = function (exec) {
|
97
|
+
var fails$8 = function (exec) {
|
140
98
|
try {
|
141
99
|
return !!exec();
|
142
100
|
} catch (error) {
|
@@ -144,29 +102,115 @@ class CondenserBabelTest < ActiveSupport::TestCase
|
|
144
102
|
}
|
145
103
|
};
|
146
104
|
|
147
|
-
|
148
|
-
|
149
|
-
|
105
|
+
var fails$7 = fails$8;
|
106
|
+
|
107
|
+
var functionBindNative = !fails$7(function () {
|
108
|
+
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
109
|
+
var test = (function () { /* empty */ }).bind();
|
110
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
111
|
+
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
112
|
+
});
|
113
|
+
|
114
|
+
var NATIVE_BIND$3 = functionBindNative;
|
115
|
+
|
116
|
+
var FunctionPrototype$1 = Function.prototype;
|
117
|
+
var apply$1 = FunctionPrototype$1.apply;
|
118
|
+
var call$6 = FunctionPrototype$1.call;
|
119
|
+
|
120
|
+
// eslint-disable-next-line es/no-reflect -- safe
|
121
|
+
var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$3 ? call$6.bind(apply$1) : function () {
|
122
|
+
return call$6.apply(apply$1, arguments);
|
123
|
+
});
|
124
|
+
|
125
|
+
var NATIVE_BIND$2 = functionBindNative;
|
126
|
+
|
127
|
+
var FunctionPrototype = Function.prototype;
|
128
|
+
var call$5 = FunctionPrototype.call;
|
129
|
+
var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype.bind.bind(call$5, call$5);
|
130
|
+
|
131
|
+
var functionUncurryThis = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
|
132
|
+
return function () {
|
133
|
+
return call$5.apply(fn, arguments);
|
134
|
+
};
|
135
|
+
};
|
136
|
+
|
137
|
+
var uncurryThis$9 = functionUncurryThis;
|
138
|
+
|
139
|
+
var toString$1 = uncurryThis$9({}.toString);
|
140
|
+
var stringSlice = uncurryThis$9(''.slice);
|
141
|
+
|
142
|
+
var classofRaw$1 = function (it) {
|
143
|
+
return stringSlice(toString$1(it), 8, -1);
|
144
|
+
};
|
145
|
+
|
146
|
+
var classofRaw = classofRaw$1;
|
147
|
+
var uncurryThis$8 = functionUncurryThis;
|
148
|
+
|
149
|
+
var functionUncurryThisClause = function (fn) {
|
150
|
+
// Nashorn bug:
|
151
|
+
// https://github.com/zloirock/core-js/issues/1128
|
152
|
+
// https://github.com/zloirock/core-js/issues/1130
|
153
|
+
if (classofRaw(fn) === 'Function') return uncurryThis$8(fn);
|
154
|
+
};
|
155
|
+
|
156
|
+
var documentAll$2 = typeof document == 'object' && document.all;
|
157
|
+
|
158
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
159
|
+
// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
|
160
|
+
var IS_HTMLDDA = typeof documentAll$2 == 'undefined' && documentAll$2 !== undefined;
|
161
|
+
|
162
|
+
var documentAll_1 = {
|
163
|
+
all: documentAll$2,
|
164
|
+
IS_HTMLDDA: IS_HTMLDDA
|
165
|
+
};
|
166
|
+
|
167
|
+
var $documentAll$1 = documentAll_1;
|
168
|
+
|
169
|
+
var documentAll$1 = $documentAll$1.all;
|
170
|
+
|
171
|
+
// `IsCallable` abstract operation
|
172
|
+
// https://tc39.es/ecma262/#sec-iscallable
|
173
|
+
var isCallable$7 = $documentAll$1.IS_HTMLDDA ? function (argument) {
|
174
|
+
return typeof argument == 'function' || argument === documentAll$1;
|
175
|
+
} : function (argument) {
|
176
|
+
return typeof argument == 'function';
|
177
|
+
};
|
178
|
+
|
179
|
+
var objectGetOwnPropertyDescriptor = {};
|
180
|
+
|
181
|
+
var fails$6 = fails$8;
|
182
|
+
|
183
|
+
// Detect IE8's incomplete defineProperty implementation
|
184
|
+
var descriptors = !fails$6(function () {
|
185
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
186
|
+
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
|
150
187
|
});
|
151
188
|
|
152
|
-
var
|
153
|
-
|
189
|
+
var NATIVE_BIND$1 = functionBindNative;
|
190
|
+
|
191
|
+
var call$4 = Function.prototype.call;
|
192
|
+
|
193
|
+
var functionCall = NATIVE_BIND$1 ? call$4.bind(call$4) : function () {
|
194
|
+
return call$4.apply(call$4, arguments);
|
195
|
+
};
|
196
|
+
|
197
|
+
var objectPropertyIsEnumerable = {};
|
198
|
+
|
199
|
+
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
200
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
201
|
+
var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
154
202
|
|
155
203
|
// Nashorn ~ JDK8 bug
|
156
|
-
var NASHORN_BUG = getOwnPropertyDescriptor &&
|
204
|
+
var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
|
157
205
|
|
158
206
|
// `Object.prototype.propertyIsEnumerable` method implementation
|
159
|
-
// https://tc39.
|
160
|
-
|
161
|
-
var descriptor = getOwnPropertyDescriptor(this, V);
|
207
|
+
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
208
|
+
objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
209
|
+
var descriptor = getOwnPropertyDescriptor$1(this, V);
|
162
210
|
return !!descriptor && descriptor.enumerable;
|
163
|
-
} :
|
164
|
-
|
165
|
-
var objectPropertyIsEnumerable = {
|
166
|
-
f: f
|
167
|
-
};
|
211
|
+
} : $propertyIsEnumerable;
|
168
212
|
|
169
|
-
var createPropertyDescriptor = function (bitmap, value) {
|
213
|
+
var createPropertyDescriptor$2 = function (bitmap, value) {
|
170
214
|
return {
|
171
215
|
enumerable: !(bitmap & 1),
|
172
216
|
configurable: !(bitmap & 2),
|
@@ -175,211 +219,521 @@ class CondenserBabelTest < ActiveSupport::TestCase
|
|
175
219
|
};
|
176
220
|
};
|
177
221
|
|
178
|
-
var
|
222
|
+
var uncurryThis$7 = functionUncurryThis;
|
223
|
+
var fails$5 = fails$8;
|
224
|
+
var classof = classofRaw$1;
|
179
225
|
|
180
|
-
var
|
181
|
-
|
182
|
-
};
|
183
|
-
|
184
|
-
var split = ''.split;
|
226
|
+
var $Object$2 = Object;
|
227
|
+
var split = uncurryThis$7(''.split);
|
185
228
|
|
186
229
|
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
187
|
-
var indexedObject = fails(function () {
|
230
|
+
var indexedObject = fails$5(function () {
|
188
231
|
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
189
|
-
// eslint-disable-next-line no-prototype-builtins
|
190
|
-
return
|
232
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
233
|
+
return !$Object$2('z').propertyIsEnumerable(0);
|
191
234
|
}) ? function (it) {
|
192
|
-
return
|
193
|
-
} : Object;
|
235
|
+
return classof(it) === 'String' ? split(it, '') : $Object$2(it);
|
236
|
+
} : $Object$2;
|
237
|
+
|
238
|
+
// we can't use just `it == null` since of `document.all` special case
|
239
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
|
240
|
+
var isNullOrUndefined$2 = function (it) {
|
241
|
+
return it === null || it === undefined;
|
242
|
+
};
|
243
|
+
|
244
|
+
var isNullOrUndefined$1 = isNullOrUndefined$2;
|
245
|
+
|
246
|
+
var $TypeError$5 = TypeError;
|
194
247
|
|
195
248
|
// `RequireObjectCoercible` abstract operation
|
196
|
-
// https://tc39.
|
197
|
-
var requireObjectCoercible = function (it) {
|
198
|
-
if (it
|
249
|
+
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
250
|
+
var requireObjectCoercible$2 = function (it) {
|
251
|
+
if (isNullOrUndefined$1(it)) throw new $TypeError$5("Can't call method on " + it);
|
199
252
|
return it;
|
200
253
|
};
|
201
254
|
|
202
255
|
// toObject with fallback for non-array-like ES3 strings
|
256
|
+
var IndexedObject$1 = indexedObject;
|
257
|
+
var requireObjectCoercible$1 = requireObjectCoercible$2;
|
203
258
|
|
259
|
+
var toIndexedObject$3 = function (it) {
|
260
|
+
return IndexedObject$1(requireObjectCoercible$1(it));
|
261
|
+
};
|
204
262
|
|
263
|
+
var isCallable$6 = isCallable$7;
|
264
|
+
var $documentAll = documentAll_1;
|
205
265
|
|
206
|
-
var
|
207
|
-
|
266
|
+
var documentAll = $documentAll.all;
|
267
|
+
|
268
|
+
var isObject$4 = $documentAll.IS_HTMLDDA ? function (it) {
|
269
|
+
return typeof it == 'object' ? it !== null : isCallable$6(it) || it === documentAll;
|
270
|
+
} : function (it) {
|
271
|
+
return typeof it == 'object' ? it !== null : isCallable$6(it);
|
272
|
+
};
|
273
|
+
|
274
|
+
var path$3 = {};
|
275
|
+
|
276
|
+
var path$2 = path$3;
|
277
|
+
var global$8 = global$9;
|
278
|
+
var isCallable$5 = isCallable$7;
|
279
|
+
|
280
|
+
var aFunction = function (variable) {
|
281
|
+
return isCallable$5(variable) ? variable : undefined;
|
208
282
|
};
|
209
283
|
|
210
|
-
var
|
211
|
-
return
|
284
|
+
var getBuiltIn$1 = function (namespace, method) {
|
285
|
+
return arguments.length < 2 ? aFunction(path$2[namespace]) || aFunction(global$8[namespace])
|
286
|
+
: path$2[namespace] && path$2[namespace][method] || global$8[namespace] && global$8[namespace][method];
|
212
287
|
};
|
213
288
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
var
|
219
|
-
|
289
|
+
var uncurryThis$6 = functionUncurryThis;
|
290
|
+
|
291
|
+
var objectIsPrototypeOf = uncurryThis$6({}.isPrototypeOf);
|
292
|
+
|
293
|
+
var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
|
294
|
+
|
295
|
+
var global$7 = global$9;
|
296
|
+
var userAgent = engineUserAgent;
|
297
|
+
|
298
|
+
var process = global$7.process;
|
299
|
+
var Deno = global$7.Deno;
|
300
|
+
var versions = process && process.versions || Deno && Deno.version;
|
301
|
+
var v8 = versions && versions.v8;
|
302
|
+
var match, version;
|
303
|
+
|
304
|
+
if (v8) {
|
305
|
+
match = v8.split('.');
|
306
|
+
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
307
|
+
// but their correct versions are not interesting for us
|
308
|
+
version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
309
|
+
}
|
310
|
+
|
311
|
+
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
312
|
+
// so check `userAgent` even if `.v8` exists, but 0
|
313
|
+
if (!version && userAgent) {
|
314
|
+
match = userAgent.match(/Edge\\/(\\d+)/);
|
315
|
+
if (!match || match[1] >= 74) {
|
316
|
+
match = userAgent.match(/Chrome\\/(\\d+)/);
|
317
|
+
if (match) version = +match[1];
|
318
|
+
}
|
319
|
+
}
|
320
|
+
|
321
|
+
var engineV8Version = version;
|
322
|
+
|
323
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
324
|
+
var V8_VERSION = engineV8Version;
|
325
|
+
var fails$4 = fails$8;
|
326
|
+
var global$6 = global$9;
|
327
|
+
|
328
|
+
var $String$2 = global$6.String;
|
329
|
+
|
330
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
331
|
+
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$4(function () {
|
332
|
+
var symbol = Symbol('symbol detection');
|
333
|
+
// Chrome 38 Symbol has incorrect toString conversion
|
334
|
+
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
335
|
+
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
336
|
+
// of course, fail.
|
337
|
+
return !$String$2(symbol) || !(Object(symbol) instanceof Symbol) ||
|
338
|
+
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
339
|
+
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
340
|
+
});
|
341
|
+
|
342
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
343
|
+
var NATIVE_SYMBOL$1 = symbolConstructorDetection;
|
344
|
+
|
345
|
+
var useSymbolAsUid = NATIVE_SYMBOL$1
|
346
|
+
&& !Symbol.sham
|
347
|
+
&& typeof Symbol.iterator == 'symbol';
|
348
|
+
|
349
|
+
var getBuiltIn = getBuiltIn$1;
|
350
|
+
var isCallable$4 = isCallable$7;
|
351
|
+
var isPrototypeOf = objectIsPrototypeOf;
|
352
|
+
var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
|
353
|
+
|
354
|
+
var $Object$1 = Object;
|
355
|
+
|
356
|
+
var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
|
357
|
+
return typeof it == 'symbol';
|
358
|
+
} : function (it) {
|
359
|
+
var $Symbol = getBuiltIn('Symbol');
|
360
|
+
return isCallable$4($Symbol) && isPrototypeOf($Symbol.prototype, $Object$1(it));
|
361
|
+
};
|
362
|
+
|
363
|
+
var $String$1 = String;
|
364
|
+
|
365
|
+
var tryToString$1 = function (argument) {
|
366
|
+
try {
|
367
|
+
return $String$1(argument);
|
368
|
+
} catch (error) {
|
369
|
+
return 'Object';
|
370
|
+
}
|
371
|
+
};
|
372
|
+
|
373
|
+
var isCallable$3 = isCallable$7;
|
374
|
+
var tryToString = tryToString$1;
|
375
|
+
|
376
|
+
var $TypeError$4 = TypeError;
|
377
|
+
|
378
|
+
// `Assert: IsCallable(argument) is true`
|
379
|
+
var aCallable$2 = function (argument) {
|
380
|
+
if (isCallable$3(argument)) return argument;
|
381
|
+
throw new $TypeError$4(tryToString(argument) + ' is not a function');
|
382
|
+
};
|
383
|
+
|
384
|
+
var aCallable$1 = aCallable$2;
|
385
|
+
var isNullOrUndefined = isNullOrUndefined$2;
|
386
|
+
|
387
|
+
// `GetMethod` abstract operation
|
388
|
+
// https://tc39.es/ecma262/#sec-getmethod
|
389
|
+
var getMethod$1 = function (V, P) {
|
390
|
+
var func = V[P];
|
391
|
+
return isNullOrUndefined(func) ? undefined : aCallable$1(func);
|
392
|
+
};
|
393
|
+
|
394
|
+
var call$3 = functionCall;
|
395
|
+
var isCallable$2 = isCallable$7;
|
396
|
+
var isObject$3 = isObject$4;
|
397
|
+
|
398
|
+
var $TypeError$3 = TypeError;
|
399
|
+
|
400
|
+
// `OrdinaryToPrimitive` abstract operation
|
401
|
+
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
402
|
+
var ordinaryToPrimitive$1 = function (input, pref) {
|
220
403
|
var fn, val;
|
221
|
-
if (
|
222
|
-
if (
|
223
|
-
if (
|
224
|
-
throw TypeError("Can't convert object to primitive value");
|
404
|
+
if (pref === 'string' && isCallable$2(fn = input.toString) && !isObject$3(val = call$3(fn, input))) return val;
|
405
|
+
if (isCallable$2(fn = input.valueOf) && !isObject$3(val = call$3(fn, input))) return val;
|
406
|
+
if (pref !== 'string' && isCallable$2(fn = input.toString) && !isObject$3(val = call$3(fn, input))) return val;
|
407
|
+
throw new $TypeError$3("Can't convert object to primitive value");
|
408
|
+
};
|
409
|
+
|
410
|
+
var shared$1 = {exports: {}};
|
411
|
+
|
412
|
+
var global$5 = global$9;
|
413
|
+
|
414
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
415
|
+
var defineProperty$1 = Object.defineProperty;
|
416
|
+
|
417
|
+
var defineGlobalProperty$1 = function (key, value) {
|
418
|
+
try {
|
419
|
+
defineProperty$1(global$5, key, { value: value, configurable: true, writable: true });
|
420
|
+
} catch (error) {
|
421
|
+
global$5[key] = value;
|
422
|
+
} return value;
|
225
423
|
};
|
226
424
|
|
227
|
-
var
|
425
|
+
var global$4 = global$9;
|
426
|
+
var defineGlobalProperty = defineGlobalProperty$1;
|
427
|
+
|
428
|
+
var SHARED = '__core-js_shared__';
|
429
|
+
var store$1 = global$4[SHARED] || defineGlobalProperty(SHARED, {});
|
430
|
+
|
431
|
+
var sharedStore = store$1;
|
432
|
+
|
433
|
+
var store = sharedStore;
|
434
|
+
|
435
|
+
(shared$1.exports = function (key, value) {
|
436
|
+
return store[key] || (store[key] = value !== undefined ? value : {});
|
437
|
+
})('versions', []).push({
|
438
|
+
version: '3.34.0',
|
439
|
+
mode: 'pure' ,
|
440
|
+
copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
|
441
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.34.0/LICENSE',
|
442
|
+
source: 'https://github.com/zloirock/core-js'
|
443
|
+
});
|
444
|
+
|
445
|
+
var sharedExports = shared$1.exports;
|
446
|
+
|
447
|
+
var requireObjectCoercible = requireObjectCoercible$2;
|
448
|
+
|
449
|
+
var $Object = Object;
|
450
|
+
|
451
|
+
// `ToObject` abstract operation
|
452
|
+
// https://tc39.es/ecma262/#sec-toobject
|
453
|
+
var toObject$2 = function (argument) {
|
454
|
+
return $Object(requireObjectCoercible(argument));
|
455
|
+
};
|
456
|
+
|
457
|
+
var uncurryThis$5 = functionUncurryThis;
|
458
|
+
var toObject$1 = toObject$2;
|
459
|
+
|
460
|
+
var hasOwnProperty = uncurryThis$5({}.hasOwnProperty);
|
228
461
|
|
229
|
-
|
230
|
-
|
462
|
+
// `HasOwnProperty` abstract operation
|
463
|
+
// https://tc39.es/ecma262/#sec-hasownproperty
|
464
|
+
// eslint-disable-next-line es/no-object-hasown -- safe
|
465
|
+
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
466
|
+
return hasOwnProperty(toObject$1(it), key);
|
231
467
|
};
|
232
468
|
|
233
|
-
var
|
469
|
+
var uncurryThis$4 = functionUncurryThis;
|
470
|
+
|
471
|
+
var id = 0;
|
472
|
+
var postfix = Math.random();
|
473
|
+
var toString = uncurryThis$4(1.0.toString);
|
474
|
+
|
475
|
+
var uid$1 = function (key) {
|
476
|
+
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
|
477
|
+
};
|
478
|
+
|
479
|
+
var global$3 = global$9;
|
480
|
+
var shared = sharedExports;
|
481
|
+
var hasOwn$3 = hasOwnProperty_1;
|
482
|
+
var uid = uid$1;
|
483
|
+
var NATIVE_SYMBOL = symbolConstructorDetection;
|
484
|
+
var USE_SYMBOL_AS_UID = useSymbolAsUid;
|
485
|
+
|
486
|
+
var Symbol$1 = global$3.Symbol;
|
487
|
+
var WellKnownSymbolsStore = shared('wks');
|
488
|
+
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
|
489
|
+
|
490
|
+
var wellKnownSymbol$1 = function (name) {
|
491
|
+
if (!hasOwn$3(WellKnownSymbolsStore, name)) {
|
492
|
+
WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$3(Symbol$1, name)
|
493
|
+
? Symbol$1[name]
|
494
|
+
: createWellKnownSymbol('Symbol.' + name);
|
495
|
+
} return WellKnownSymbolsStore[name];
|
496
|
+
};
|
497
|
+
|
498
|
+
var call$2 = functionCall;
|
499
|
+
var isObject$2 = isObject$4;
|
500
|
+
var isSymbol$1 = isSymbol$2;
|
501
|
+
var getMethod = getMethod$1;
|
502
|
+
var ordinaryToPrimitive = ordinaryToPrimitive$1;
|
503
|
+
var wellKnownSymbol = wellKnownSymbol$1;
|
504
|
+
|
505
|
+
var $TypeError$2 = TypeError;
|
506
|
+
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
507
|
+
|
508
|
+
// `ToPrimitive` abstract operation
|
509
|
+
// https://tc39.es/ecma262/#sec-toprimitive
|
510
|
+
var toPrimitive$1 = function (input, pref) {
|
511
|
+
if (!isObject$2(input) || isSymbol$1(input)) return input;
|
512
|
+
var exoticToPrim = getMethod(input, TO_PRIMITIVE);
|
513
|
+
var result;
|
514
|
+
if (exoticToPrim) {
|
515
|
+
if (pref === undefined) pref = 'default';
|
516
|
+
result = call$2(exoticToPrim, input, pref);
|
517
|
+
if (!isObject$2(result) || isSymbol$1(result)) return result;
|
518
|
+
throw new $TypeError$2("Can't convert object to primitive value");
|
519
|
+
}
|
520
|
+
if (pref === undefined) pref = 'number';
|
521
|
+
return ordinaryToPrimitive(input, pref);
|
522
|
+
};
|
523
|
+
|
524
|
+
var toPrimitive = toPrimitive$1;
|
525
|
+
var isSymbol = isSymbol$2;
|
526
|
+
|
527
|
+
// `ToPropertyKey` abstract operation
|
528
|
+
// https://tc39.es/ecma262/#sec-topropertykey
|
529
|
+
var toPropertyKey$2 = function (argument) {
|
530
|
+
var key = toPrimitive(argument, 'string');
|
531
|
+
return isSymbol(key) ? key : key + '';
|
532
|
+
};
|
533
|
+
|
534
|
+
var global$2 = global$9;
|
535
|
+
var isObject$1 = isObject$4;
|
536
|
+
|
537
|
+
var document$1 = global$2.document;
|
234
538
|
// typeof document.createElement is 'object' in old IE
|
235
|
-
var EXISTS = isObject(document) && isObject(document.createElement);
|
539
|
+
var EXISTS = isObject$1(document$1) && isObject$1(document$1.createElement);
|
236
540
|
|
237
541
|
var documentCreateElement = function (it) {
|
238
|
-
return EXISTS ? document.createElement(it) : {};
|
542
|
+
return EXISTS ? document$1.createElement(it) : {};
|
239
543
|
};
|
240
544
|
|
241
|
-
|
242
|
-
var
|
243
|
-
|
545
|
+
var DESCRIPTORS$5 = descriptors;
|
546
|
+
var fails$3 = fails$8;
|
547
|
+
var createElement = documentCreateElement;
|
548
|
+
|
549
|
+
// Thanks to IE8 for its funny defineProperty
|
550
|
+
var ie8DomDefine = !DESCRIPTORS$5 && !fails$3(function () {
|
551
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
552
|
+
return Object.defineProperty(createElement('div'), 'a', {
|
244
553
|
get: function () { return 7; }
|
245
|
-
}).a
|
554
|
+
}).a !== 7;
|
246
555
|
});
|
247
556
|
|
248
|
-
var
|
557
|
+
var DESCRIPTORS$4 = descriptors;
|
558
|
+
var call$1 = functionCall;
|
559
|
+
var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
|
560
|
+
var createPropertyDescriptor$1 = createPropertyDescriptor$2;
|
561
|
+
var toIndexedObject$2 = toIndexedObject$3;
|
562
|
+
var toPropertyKey$1 = toPropertyKey$2;
|
563
|
+
var hasOwn$2 = hasOwnProperty_1;
|
564
|
+
var IE8_DOM_DEFINE$1 = ie8DomDefine;
|
565
|
+
|
566
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
567
|
+
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
249
568
|
|
250
569
|
// `Object.getOwnPropertyDescriptor` method
|
251
|
-
// https://tc39.
|
252
|
-
|
253
|
-
O = toIndexedObject(O);
|
254
|
-
P =
|
255
|
-
if (
|
256
|
-
return
|
570
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
571
|
+
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$4 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
572
|
+
O = toIndexedObject$2(O);
|
573
|
+
P = toPropertyKey$1(P);
|
574
|
+
if (IE8_DOM_DEFINE$1) try {
|
575
|
+
return $getOwnPropertyDescriptor$1(O, P);
|
257
576
|
} catch (error) { /* empty */ }
|
258
|
-
if (
|
577
|
+
if (hasOwn$2(O, P)) return createPropertyDescriptor$1(!call$1(propertyIsEnumerableModule$1.f, O, P), O[P]);
|
259
578
|
};
|
260
579
|
|
261
|
-
var
|
262
|
-
|
263
|
-
};
|
580
|
+
var fails$2 = fails$8;
|
581
|
+
var isCallable$1 = isCallable$7;
|
264
582
|
|
265
583
|
var replacement = /#|\\.prototype\\./;
|
266
584
|
|
267
|
-
var isForced = function (feature, detection) {
|
585
|
+
var isForced$1 = function (feature, detection) {
|
268
586
|
var value = data[normalize(feature)];
|
269
|
-
return value
|
270
|
-
: value
|
271
|
-
:
|
587
|
+
return value === POLYFILL ? true
|
588
|
+
: value === NATIVE ? false
|
589
|
+
: isCallable$1(detection) ? fails$2(detection)
|
272
590
|
: !!detection;
|
273
591
|
};
|
274
592
|
|
275
|
-
var normalize = isForced.normalize = function (string) {
|
593
|
+
var normalize = isForced$1.normalize = function (string) {
|
276
594
|
return String(string).replace(replacement, '.').toLowerCase();
|
277
595
|
};
|
278
596
|
|
279
|
-
var data = isForced.data = {};
|
280
|
-
var NATIVE = isForced.NATIVE = 'N';
|
281
|
-
var POLYFILL = isForced.POLYFILL = 'P';
|
597
|
+
var data = isForced$1.data = {};
|
598
|
+
var NATIVE = isForced$1.NATIVE = 'N';
|
599
|
+
var POLYFILL = isForced$1.POLYFILL = 'P';
|
282
600
|
|
283
|
-
var isForced_1 = isForced;
|
601
|
+
var isForced_1 = isForced$1;
|
284
602
|
|
285
|
-
var
|
603
|
+
var uncurryThis$3 = functionUncurryThisClause;
|
604
|
+
var aCallable = aCallable$2;
|
605
|
+
var NATIVE_BIND = functionBindNative;
|
286
606
|
|
287
|
-
var
|
288
|
-
if (typeof it != 'function') {
|
289
|
-
throw TypeError(String(it) + ' is not a function');
|
290
|
-
} return it;
|
291
|
-
};
|
607
|
+
var bind$1 = uncurryThis$3(uncurryThis$3.bind);
|
292
608
|
|
293
609
|
// optional / simple context binding
|
294
|
-
var functionBindContext = function (fn, that
|
295
|
-
|
296
|
-
|
297
|
-
switch (length) {
|
298
|
-
case 0: return function () {
|
299
|
-
return fn.call(that);
|
300
|
-
};
|
301
|
-
case 1: return function (a) {
|
302
|
-
return fn.call(that, a);
|
303
|
-
};
|
304
|
-
case 2: return function (a, b) {
|
305
|
-
return fn.call(that, a, b);
|
306
|
-
};
|
307
|
-
case 3: return function (a, b, c) {
|
308
|
-
return fn.call(that, a, b, c);
|
309
|
-
};
|
310
|
-
}
|
311
|
-
return function (/* ...args */) {
|
610
|
+
var functionBindContext = function (fn, that) {
|
611
|
+
aCallable(fn);
|
612
|
+
return that === undefined ? fn : NATIVE_BIND ? bind$1(fn, that) : function (/* ...args */) {
|
312
613
|
return fn.apply(that, arguments);
|
313
614
|
};
|
314
615
|
};
|
315
616
|
|
316
|
-
var
|
317
|
-
|
318
|
-
|
319
|
-
|
617
|
+
var objectDefineProperty = {};
|
618
|
+
|
619
|
+
var DESCRIPTORS$3 = descriptors;
|
620
|
+
var fails$1 = fails$8;
|
621
|
+
|
622
|
+
// V8 ~ Chrome 36-
|
623
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
624
|
+
var v8PrototypeDefineBug = DESCRIPTORS$3 && fails$1(function () {
|
625
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
626
|
+
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
627
|
+
value: 42,
|
628
|
+
writable: false
|
629
|
+
}).prototype !== 42;
|
630
|
+
});
|
631
|
+
|
632
|
+
var isObject = isObject$4;
|
633
|
+
|
634
|
+
var $String = String;
|
635
|
+
var $TypeError$1 = TypeError;
|
636
|
+
|
637
|
+
// `Assert: Type(argument) is Object`
|
638
|
+
var anObject$1 = function (argument) {
|
639
|
+
if (isObject(argument)) return argument;
|
640
|
+
throw new $TypeError$1($String(argument) + ' is not an object');
|
320
641
|
};
|
321
642
|
|
322
|
-
var
|
643
|
+
var DESCRIPTORS$2 = descriptors;
|
644
|
+
var IE8_DOM_DEFINE = ie8DomDefine;
|
645
|
+
var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
|
646
|
+
var anObject = anObject$1;
|
647
|
+
var toPropertyKey = toPropertyKey$2;
|
648
|
+
|
649
|
+
var $TypeError = TypeError;
|
650
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
651
|
+
var $defineProperty = Object.defineProperty;
|
652
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
653
|
+
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
654
|
+
var ENUMERABLE = 'enumerable';
|
655
|
+
var CONFIGURABLE = 'configurable';
|
656
|
+
var WRITABLE = 'writable';
|
323
657
|
|
324
658
|
// `Object.defineProperty` method
|
325
|
-
// https://tc39.
|
326
|
-
|
659
|
+
// https://tc39.es/ecma262/#sec-object.defineproperty
|
660
|
+
objectDefineProperty.f = DESCRIPTORS$2 ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
|
661
|
+
anObject(O);
|
662
|
+
P = toPropertyKey(P);
|
663
|
+
anObject(Attributes);
|
664
|
+
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
|
665
|
+
var current = $getOwnPropertyDescriptor(O, P);
|
666
|
+
if (current && current[WRITABLE]) {
|
667
|
+
O[P] = Attributes.value;
|
668
|
+
Attributes = {
|
669
|
+
configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
|
670
|
+
enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
|
671
|
+
writable: false
|
672
|
+
};
|
673
|
+
}
|
674
|
+
} return $defineProperty(O, P, Attributes);
|
675
|
+
} : $defineProperty : function defineProperty(O, P, Attributes) {
|
327
676
|
anObject(O);
|
328
|
-
P =
|
677
|
+
P = toPropertyKey(P);
|
329
678
|
anObject(Attributes);
|
330
|
-
if (
|
331
|
-
return
|
679
|
+
if (IE8_DOM_DEFINE) try {
|
680
|
+
return $defineProperty(O, P, Attributes);
|
332
681
|
} catch (error) { /* empty */ }
|
333
|
-
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
|
682
|
+
if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported');
|
334
683
|
if ('value' in Attributes) O[P] = Attributes.value;
|
335
684
|
return O;
|
336
685
|
};
|
337
686
|
|
338
|
-
var
|
339
|
-
|
340
|
-
|
687
|
+
var DESCRIPTORS$1 = descriptors;
|
688
|
+
var definePropertyModule = objectDefineProperty;
|
689
|
+
var createPropertyDescriptor = createPropertyDescriptor$2;
|
341
690
|
|
342
|
-
var createNonEnumerableProperty =
|
343
|
-
return
|
691
|
+
var createNonEnumerableProperty$1 = DESCRIPTORS$1 ? function (object, key, value) {
|
692
|
+
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
344
693
|
} : function (object, key, value) {
|
345
694
|
object[key] = value;
|
346
695
|
return object;
|
347
696
|
};
|
348
697
|
|
349
|
-
var
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
698
|
+
var global$1 = global$9;
|
699
|
+
var apply = functionApply;
|
700
|
+
var uncurryThis$2 = functionUncurryThisClause;
|
701
|
+
var isCallable = isCallable$7;
|
702
|
+
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
703
|
+
var isForced = isForced_1;
|
704
|
+
var path$1 = path$3;
|
705
|
+
var bind = functionBindContext;
|
706
|
+
var createNonEnumerableProperty = createNonEnumerableProperty$1;
|
707
|
+
var hasOwn$1 = hasOwnProperty_1;
|
355
708
|
|
356
709
|
var wrapConstructor = function (NativeConstructor) {
|
357
710
|
var Wrapper = function (a, b, c) {
|
358
|
-
if (this instanceof
|
711
|
+
if (this instanceof Wrapper) {
|
359
712
|
switch (arguments.length) {
|
360
713
|
case 0: return new NativeConstructor();
|
361
714
|
case 1: return new NativeConstructor(a);
|
362
715
|
case 2: return new NativeConstructor(a, b);
|
363
716
|
} return new NativeConstructor(a, b, c);
|
364
|
-
} return
|
717
|
+
} return apply(NativeConstructor, this, arguments);
|
365
718
|
};
|
366
719
|
Wrapper.prototype = NativeConstructor.prototype;
|
367
720
|
return Wrapper;
|
368
721
|
};
|
369
722
|
|
370
723
|
/*
|
371
|
-
options.target
|
372
|
-
options.global
|
373
|
-
options.stat
|
374
|
-
options.proto
|
375
|
-
options.real
|
376
|
-
options.forced
|
377
|
-
options.bind
|
378
|
-
options.wrap
|
379
|
-
options.unsafe
|
380
|
-
options.sham
|
381
|
-
options.enumerable
|
382
|
-
options.
|
724
|
+
options.target - name of the target object
|
725
|
+
options.global - target is the global object
|
726
|
+
options.stat - export as static methods of target
|
727
|
+
options.proto - export as prototype methods of target
|
728
|
+
options.real - real prototype method for the `pure` version
|
729
|
+
options.forced - export even if the native feature is available
|
730
|
+
options.bind - bind methods to the target, required for the `pure` version
|
731
|
+
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
732
|
+
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
733
|
+
options.sham - add a flag to not completely full polyfills
|
734
|
+
options.enumerable - export as enumerable property
|
735
|
+
options.dontCallGetSet - prevent calling a getter on target
|
736
|
+
options.name - the .name of the function if it does not match the key
|
383
737
|
*/
|
384
738
|
var _export = function (options, source) {
|
385
739
|
var TARGET = options.target;
|
@@ -387,37 +741,37 @@ class CondenserBabelTest < ActiveSupport::TestCase
|
|
387
741
|
var STATIC = options.stat;
|
388
742
|
var PROTO = options.proto;
|
389
743
|
|
390
|
-
var nativeSource = GLOBAL ?
|
744
|
+
var nativeSource = GLOBAL ? global$1 : STATIC ? global$1[TARGET] : (global$1[TARGET] || {}).prototype;
|
391
745
|
|
392
|
-
var target = GLOBAL ? path : path[TARGET] || (path
|
746
|
+
var target = GLOBAL ? path$1 : path$1[TARGET] || createNonEnumerableProperty(path$1, TARGET, {})[TARGET];
|
393
747
|
var targetPrototype = target.prototype;
|
394
748
|
|
395
749
|
var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
|
396
750
|
var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
|
397
751
|
|
398
752
|
for (key in source) {
|
399
|
-
FORCED =
|
753
|
+
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
400
754
|
// contains in native
|
401
|
-
USE_NATIVE = !FORCED && nativeSource &&
|
755
|
+
USE_NATIVE = !FORCED && nativeSource && hasOwn$1(nativeSource, key);
|
402
756
|
|
403
757
|
targetProperty = target[key];
|
404
758
|
|
405
|
-
if (USE_NATIVE) if (options.
|
406
|
-
descriptor = getOwnPropertyDescriptor
|
759
|
+
if (USE_NATIVE) if (options.dontCallGetSet) {
|
760
|
+
descriptor = getOwnPropertyDescriptor(nativeSource, key);
|
407
761
|
nativeProperty = descriptor && descriptor.value;
|
408
762
|
} else nativeProperty = nativeSource[key];
|
409
763
|
|
410
764
|
// export native or implementation
|
411
765
|
sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key];
|
412
766
|
|
413
|
-
if (USE_NATIVE && typeof targetProperty
|
767
|
+
if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue;
|
414
768
|
|
415
|
-
// bind
|
416
|
-
if (options.bind && USE_NATIVE) resultProperty =
|
417
|
-
// wrap global constructors for prevent
|
769
|
+
// bind methods to global for calling from export context
|
770
|
+
if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global$1);
|
771
|
+
// wrap global constructors for prevent changes in this version
|
418
772
|
else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
|
419
773
|
// make static versions for prototype methods
|
420
|
-
else if (PROTO &&
|
774
|
+
else if (PROTO && isCallable(sourceProperty)) resultProperty = uncurryThis$2(sourceProperty);
|
421
775
|
// default case
|
422
776
|
else resultProperty = sourceProperty;
|
423
777
|
|
@@ -426,17 +780,17 @@ class CondenserBabelTest < ActiveSupport::TestCase
|
|
426
780
|
createNonEnumerableProperty(resultProperty, 'sham', true);
|
427
781
|
}
|
428
782
|
|
429
|
-
target
|
783
|
+
createNonEnumerableProperty(target, key, resultProperty);
|
430
784
|
|
431
785
|
if (PROTO) {
|
432
786
|
VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
|
433
|
-
if (!
|
434
|
-
createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});
|
787
|
+
if (!hasOwn$1(path$1, VIRTUAL_PROTOTYPE)) {
|
788
|
+
createNonEnumerableProperty(path$1, VIRTUAL_PROTOTYPE, {});
|
435
789
|
}
|
436
790
|
// export virtual prototype methods
|
437
|
-
path[VIRTUAL_PROTOTYPE]
|
791
|
+
createNonEnumerableProperty(path$1[VIRTUAL_PROTOTYPE], key, sourceProperty);
|
438
792
|
// export real prototype methods
|
439
|
-
if (options.real && targetPrototype && !targetPrototype[key]) {
|
793
|
+
if (options.real && targetPrototype && (FORCED || !targetPrototype[key])) {
|
440
794
|
createNonEnumerableProperty(targetPrototype, key, sourceProperty);
|
441
795
|
}
|
442
796
|
}
|
@@ -446,44 +800,72 @@ class CondenserBabelTest < ActiveSupport::TestCase
|
|
446
800
|
var ceil = Math.ceil;
|
447
801
|
var floor = Math.floor;
|
448
802
|
|
449
|
-
// `
|
450
|
-
// https://tc39.
|
451
|
-
|
452
|
-
|
803
|
+
// `Math.trunc` method
|
804
|
+
// https://tc39.es/ecma262/#sec-math.trunc
|
805
|
+
// eslint-disable-next-line es/no-math-trunc -- safe
|
806
|
+
var mathTrunc = Math.trunc || function trunc(x) {
|
807
|
+
var n = +x;
|
808
|
+
return (n > 0 ? floor : ceil)(n);
|
453
809
|
};
|
454
810
|
|
455
|
-
var
|
811
|
+
var trunc = mathTrunc;
|
456
812
|
|
457
|
-
// `
|
458
|
-
// https://tc39.
|
459
|
-
var
|
460
|
-
|
813
|
+
// `ToIntegerOrInfinity` abstract operation
|
814
|
+
// https://tc39.es/ecma262/#sec-tointegerorinfinity
|
815
|
+
var toIntegerOrInfinity$2 = function (argument) {
|
816
|
+
var number = +argument;
|
817
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
818
|
+
return number !== number || number === 0 ? 0 : trunc(number);
|
461
819
|
};
|
462
820
|
|
821
|
+
var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
|
822
|
+
|
463
823
|
var max = Math.max;
|
464
824
|
var min$1 = Math.min;
|
465
825
|
|
466
826
|
// Helper for a popular repeating case of the spec:
|
467
827
|
// Let integer be ? ToInteger(index).
|
468
828
|
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
|
469
|
-
var toAbsoluteIndex = function (index, length) {
|
470
|
-
var integer =
|
829
|
+
var toAbsoluteIndex$1 = function (index, length) {
|
830
|
+
var integer = toIntegerOrInfinity$1(index);
|
471
831
|
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
472
832
|
};
|
473
833
|
|
834
|
+
var toIntegerOrInfinity = toIntegerOrInfinity$2;
|
835
|
+
|
836
|
+
var min = Math.min;
|
837
|
+
|
838
|
+
// `ToLength` abstract operation
|
839
|
+
// https://tc39.es/ecma262/#sec-tolength
|
840
|
+
var toLength$1 = function (argument) {
|
841
|
+
return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
842
|
+
};
|
843
|
+
|
844
|
+
var toLength = toLength$1;
|
845
|
+
|
846
|
+
// `LengthOfArrayLike` abstract operation
|
847
|
+
// https://tc39.es/ecma262/#sec-lengthofarraylike
|
848
|
+
var lengthOfArrayLike$1 = function (obj) {
|
849
|
+
return toLength(obj.length);
|
850
|
+
};
|
851
|
+
|
852
|
+
var toIndexedObject$1 = toIndexedObject$3;
|
853
|
+
var toAbsoluteIndex = toAbsoluteIndex$1;
|
854
|
+
var lengthOfArrayLike = lengthOfArrayLike$1;
|
855
|
+
|
474
856
|
// `Array.prototype.{ indexOf, includes }` methods implementation
|
475
857
|
var createMethod = function (IS_INCLUDES) {
|
476
858
|
return function ($this, el, fromIndex) {
|
477
|
-
var O = toIndexedObject($this);
|
478
|
-
var length =
|
859
|
+
var O = toIndexedObject$1($this);
|
860
|
+
var length = lengthOfArrayLike(O);
|
479
861
|
var index = toAbsoluteIndex(fromIndex, length);
|
480
862
|
var value;
|
481
863
|
// Array#includes uses SameValueZero equality algorithm
|
482
|
-
// eslint-disable-next-line no-self-compare
|
483
|
-
if (IS_INCLUDES && el
|
864
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
865
|
+
if (IS_INCLUDES && el !== el) while (length > index) {
|
484
866
|
value = O[index++];
|
485
|
-
// eslint-disable-next-line no-self-compare
|
486
|
-
if (value
|
867
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
868
|
+
if (value !== value) return true;
|
487
869
|
// Array#indexOf ignores holes, Array#includes - not
|
488
870
|
} else for (;length > index; index++) {
|
489
871
|
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
@@ -493,33 +875,38 @@ class CondenserBabelTest < ActiveSupport::TestCase
|
|
493
875
|
|
494
876
|
var arrayIncludes = {
|
495
877
|
// `Array.prototype.includes` method
|
496
|
-
// https://tc39.
|
878
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
497
879
|
includes: createMethod(true),
|
498
880
|
// `Array.prototype.indexOf` method
|
499
|
-
// https://tc39.
|
881
|
+
// https://tc39.es/ecma262/#sec-array.prototype.indexof
|
500
882
|
indexOf: createMethod(false)
|
501
883
|
};
|
502
884
|
|
503
|
-
var hiddenKeys = {};
|
885
|
+
var hiddenKeys$1 = {};
|
504
886
|
|
887
|
+
var uncurryThis$1 = functionUncurryThis;
|
888
|
+
var hasOwn = hasOwnProperty_1;
|
889
|
+
var toIndexedObject = toIndexedObject$3;
|
505
890
|
var indexOf = arrayIncludes.indexOf;
|
891
|
+
var hiddenKeys = hiddenKeys$1;
|
506
892
|
|
893
|
+
var push = uncurryThis$1([].push);
|
507
894
|
|
508
895
|
var objectKeysInternal = function (object, names) {
|
509
896
|
var O = toIndexedObject(object);
|
510
897
|
var i = 0;
|
511
898
|
var result = [];
|
512
899
|
var key;
|
513
|
-
for (key in O) !
|
900
|
+
for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
|
514
901
|
// Don't enum bug & hidden keys
|
515
|
-
while (names.length > i) if (
|
516
|
-
~indexOf(result, key) ||
|
902
|
+
while (names.length > i) if (hasOwn(O, key = names[i++])) {
|
903
|
+
~indexOf(result, key) || push(result, key);
|
517
904
|
}
|
518
905
|
return result;
|
519
906
|
};
|
520
907
|
|
521
908
|
// IE8- don't enum bug keys
|
522
|
-
var enumBugKeys = [
|
909
|
+
var enumBugKeys$1 = [
|
523
910
|
'constructor',
|
524
911
|
'hasOwnProperty',
|
525
912
|
'isPrototypeOf',
|
@@ -529,32 +916,42 @@ class CondenserBabelTest < ActiveSupport::TestCase
|
|
529
916
|
'valueOf'
|
530
917
|
];
|
531
918
|
|
919
|
+
var internalObjectKeys = objectKeysInternal;
|
920
|
+
var enumBugKeys = enumBugKeys$1;
|
921
|
+
|
532
922
|
// `Object.keys` method
|
533
|
-
// https://tc39.
|
534
|
-
|
535
|
-
|
923
|
+
// https://tc39.es/ecma262/#sec-object.keys
|
924
|
+
// eslint-disable-next-line es/no-object-keys -- safe
|
925
|
+
var objectKeys$1 = Object.keys || function keys(O) {
|
926
|
+
return internalObjectKeys(O, enumBugKeys);
|
536
927
|
};
|
537
928
|
|
538
|
-
var
|
929
|
+
var objectGetOwnPropertySymbols = {};
|
539
930
|
|
540
|
-
|
541
|
-
|
542
|
-
};
|
931
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
932
|
+
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
|
543
933
|
|
544
|
-
|
545
|
-
|
546
|
-
var
|
547
|
-
|
548
|
-
|
934
|
+
var DESCRIPTORS = descriptors;
|
935
|
+
var uncurryThis = functionUncurryThis;
|
936
|
+
var call = functionCall;
|
937
|
+
var fails = fails$8;
|
938
|
+
var objectKeys = objectKeys$1;
|
939
|
+
var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
|
940
|
+
var propertyIsEnumerableModule = objectPropertyIsEnumerable;
|
941
|
+
var toObject = toObject$2;
|
942
|
+
var IndexedObject = indexedObject;
|
549
943
|
|
550
|
-
|
944
|
+
// eslint-disable-next-line es/no-object-assign -- safe
|
945
|
+
var $assign = Object.assign;
|
946
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
551
947
|
var defineProperty = Object.defineProperty;
|
948
|
+
var concat = uncurryThis([].concat);
|
552
949
|
|
553
950
|
// `Object.assign` method
|
554
|
-
// https://tc39.
|
555
|
-
var objectAssign =
|
951
|
+
// https://tc39.es/ecma262/#sec-object.assign
|
952
|
+
var objectAssign = !$assign || fails(function () {
|
556
953
|
// should have correct order of operations (Edge bug)
|
557
|
-
if (
|
954
|
+
if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
|
558
955
|
enumerable: true,
|
559
956
|
get: function () {
|
560
957
|
defineProperty(this, 'b', {
|
@@ -566,51 +963,61 @@ class CondenserBabelTest < ActiveSupport::TestCase
|
|
566
963
|
// should work with symbols and should have deterministic property order (V8 bug)
|
567
964
|
var A = {};
|
568
965
|
var B = {};
|
569
|
-
// eslint-disable-next-line no-
|
570
|
-
var symbol = Symbol();
|
966
|
+
// eslint-disable-next-line es/no-symbol -- safe
|
967
|
+
var symbol = Symbol('assign detection');
|
571
968
|
var alphabet = 'abcdefghijklmnopqrst';
|
572
969
|
A[symbol] = 7;
|
573
970
|
alphabet.split('').forEach(function (chr) { B[chr] = chr; });
|
574
|
-
return
|
575
|
-
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
|
971
|
+
return $assign({}, A)[symbol] !== 7 || objectKeys($assign({}, B)).join('') !== alphabet;
|
972
|
+
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
|
576
973
|
var T = toObject(target);
|
577
974
|
var argumentsLength = arguments.length;
|
578
975
|
var index = 1;
|
579
|
-
var getOwnPropertySymbols =
|
580
|
-
var propertyIsEnumerable =
|
976
|
+
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
977
|
+
var propertyIsEnumerable = propertyIsEnumerableModule.f;
|
581
978
|
while (argumentsLength > index) {
|
582
|
-
var S =
|
583
|
-
var keys = getOwnPropertySymbols ? objectKeys(S)
|
979
|
+
var S = IndexedObject(arguments[index++]);
|
980
|
+
var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
|
584
981
|
var length = keys.length;
|
585
982
|
var j = 0;
|
586
983
|
var key;
|
587
984
|
while (length > j) {
|
588
985
|
key = keys[j++];
|
589
|
-
if (!
|
986
|
+
if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
|
590
987
|
}
|
591
988
|
} return T;
|
592
|
-
} :
|
989
|
+
} : $assign;
|
990
|
+
|
991
|
+
var $ = _export;
|
992
|
+
var assign$3 = objectAssign;
|
593
993
|
|
594
994
|
// `Object.assign` method
|
595
|
-
// https://tc39.
|
596
|
-
|
597
|
-
|
995
|
+
// https://tc39.es/ecma262/#sec-object.assign
|
996
|
+
// eslint-disable-next-line es/no-object-assign -- required for testing
|
997
|
+
$({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign$3 }, {
|
998
|
+
assign: assign$3
|
598
999
|
});
|
599
1000
|
|
600
|
-
var
|
1001
|
+
var path = path$3;
|
1002
|
+
|
1003
|
+
var assign$2 = path.Object.assign;
|
1004
|
+
|
1005
|
+
var parent = assign$2;
|
1006
|
+
|
1007
|
+
var assign$1 = parent;
|
601
1008
|
|
602
|
-
var assign
|
1009
|
+
var assign = assign$1;
|
603
1010
|
|
604
|
-
var assign
|
1011
|
+
var _Object$assign = /*@__PURE__*/getDefaultExportFromCjs(assign);
|
605
1012
|
|
606
1013
|
function a () {
|
607
|
-
console.log(assign
|
1014
|
+
console.log(_Object$assign({}, {
|
608
1015
|
a: 1
|
609
1016
|
}));
|
610
1017
|
}
|
611
1018
|
|
612
1019
|
function b () {
|
613
|
-
console.log(assign
|
1020
|
+
console.log(_Object$assign({}, {
|
614
1021
|
b: 1
|
615
1022
|
}));
|
616
1023
|
}
|
@@ -618,48 +1025,35 @@ class CondenserBabelTest < ActiveSupport::TestCase
|
|
618
1025
|
a();
|
619
1026
|
b();
|
620
1027
|
|
621
|
-
}()
|
1028
|
+
})();
|
622
1029
|
JS
|
623
1030
|
end
|
624
1031
|
|
625
1032
|
test 'npm modules also get babelized' do
|
626
1033
|
file "#{@npm_path}/module/name.js", <<~JS
|
627
|
-
export default
|
1034
|
+
export default function x(y) { return y?.z; }
|
628
1035
|
JS
|
629
|
-
|
1036
|
+
|
630
1037
|
file 'name.js', <<~JS
|
631
|
-
import
|
632
|
-
|
633
|
-
|
1038
|
+
import x from 'module/name';
|
1039
|
+
|
1040
|
+
var d = {};
|
1041
|
+
console.log(x(d?.z));
|
634
1042
|
JS
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
644
|
-
|
645
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(_Reflect$construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
646
|
-
|
647
|
-
import C from 'module/name';
|
648
|
-
|
649
|
-
var D = /*#__PURE__*/function (_C) {
|
650
|
-
_inherits(D, _C);
|
651
|
-
|
652
|
-
var _super = _createSuper(D);
|
653
|
-
|
654
|
-
function D() {
|
655
|
-
_classCallCheck(this, D);
|
656
|
-
|
657
|
-
return _super.apply(this, arguments);
|
1043
|
+
|
1044
|
+
assert_exported_file 'name.js', 'application/javascript', <<~JS
|
1045
|
+
(function () {
|
1046
|
+
'use strict';
|
1047
|
+
|
1048
|
+
function x(y) {
|
1049
|
+
return y === null || y === void 0 ? void 0 : y.z;
|
658
1050
|
}
|
659
|
-
|
660
|
-
|
661
|
-
|
1051
|
+
|
1052
|
+
var d = {};
|
1053
|
+
console.log(x(d === null || d === void 0 ? void 0 : d.z));
|
1054
|
+
|
1055
|
+
})();
|
662
1056
|
JS
|
663
|
-
|
1057
|
+
|
664
1058
|
end
|
665
1059
|
end
|