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