Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] V4 #1310

Open
wants to merge 387 commits into
base: master
Choose a base branch
from
Open

[WIP] V4 #1310

wants to merge 387 commits into from

Conversation

zloirock
Copy link
Owner

@zloirock zloirock commented Nov 27, 2023

  • Drop ancient engines support:
    • The baseline is engines about IE11, ES5 with some additions:
      • Basic WeakMap support (no matter bugs, for internal usage only, in polyfills could be fixed)
      • Basic Map and Set support (no matter bugs, for internal usage only, in polyfills could be fixed or completely replaced)
      • Basic %TypedArray%, ArrayBuffer and DataView constructors support (no matter bugs, in polyfills could be fixed)
      • A way setting of a prototype - Object.setPrototypeOf or __proto__
    • Examples of supported engines:
      • IE11
      • Chrome 38
      • Safari 7.1
      • FF15
      • Node 0.11
    • Examples of no longer supported engines:
      • IE10-
      • Android 4.4.3-
      • PhantomJS (~ IIRC Safari 6.0)
      • Opera Presto (12-)
      • Duktape
    • Code changes coming from this:
      • Allow unquoted keyword properties
      • Allow trailing commas in multiline object literals
      • Drop descriptors check
      • Consider strict mode as supported
      • Use native Array.isArray without fallbacks
      • Use native Array.prototype.{ forEach, every, some } without fallbacks
      • Use native Date.now without fallbacks
      • Use native Date.prototype.toISOString without fallbacks
      • Use native Function.prototype.bind without fallbacks
      • Use native Object.create without fallbacks in simple cases
      • Use native Object.getPrototypeOf without fallbacks in simple cases
      • Use native Object.{ defineProperty, defineProperties, getOwnPropertyDescriptor } without fallbacks in simple cases
      • Use native Object.keys without fallbacks in simple cases
      • Use native Object.getOwnPropertyNames without fallbacks in simple cases
      • Use native Object.{ freeze, seal, preventExtensions } without fallbacks in simple cases
      • Use native Object.{ isFrozen, isSealed, isExtensible } without fallbacks in simple cases
      • Consider base JSON methods as existent
      • Drop arguments fallback from Object#toString
      • Drop ES3-related Babel transforms from tests processing
      • Drop workarounds of non-enumerable string chars (IE8-, also affects V8 ~ Node 0.10-)
      • Allow brackets notation on strings instead of .charAt
      • Etc.

      • Consider basic support of WeakMap
      • Consider basic support of Map and Set
      • Consider basic support of ArrayBuffer, DataView and %TypedArray%
      • Consider a way setting of a prototype - Object.setPrototypeOf or __proto__ - as existent

      • Use native Error.prototype.toString without fallbacks (IE8-, V8 ~ Chrome 32-, FF10- bugs)
      • Drop workarounds of V8 ~ Chrome 36- Object.{ defineProperty, defineProperties } bug with prototype
      • Drop workarounds of V8 ~ Chrome 27- non-redefinable__proto__ bug
      • Drop fallbacks to ancient FF iterators (with '@@iterator' string key)
      • Drop a workaround of an IE bug with non-enumerable integer keys on null proto objects
      • Drop a workaround of ancient Nashorn Object.prototype.propertyIsEnumerable bug
      • Drop a workaround for ancient engines whose RegExp.prototype.exec methods don't consistently return undefined for NPCG
      • Drop many and many other fallbacks / workarounds of ancient engines bugs that now make no sense
  • Remove proposals:
  • Remove built-ins:
    • Array.prototype.filterOut (obsolete, replaced with Array.prototype.filterReject)
    • Array.prototype.group (obsolete, replaced with Object.groupBy)
    • Array.prototype.groupBy (obsolete, replaced with Object.groupBy)
    • Array.prototype.groupByToMap (obsolete, replaced with Map.groupBy)
    • Array.prototype.groupToMap (obsolete, replaced with Map.groupBy)
    • Array.prototype.lastIndex (withdrawn)
    • Array.prototype.lastItem (withdrawn in favor of Array.prototype.at)
    • AsyncIterator.prototype.asIndexedPairs (obsolete in favor of the usage counter argument methods callbacks)
    • AsyncIterator.prototype.indexed (obsolete in favor of the usage counter argument methods callbacks)
    • BigInt.range (obsolete, replaced with Iterator.range)
    • Function.isCallable (proposal is dead)
    • Function.isConstructor (proposal is dead)
    • Function.prototype.unThis (obsolete, replaced with Function.prototype.demethodize)
    • Iterator.prototype.asIndexedPairs (obsolete in favor of the usage counter argument methods callbacks)
    • Iterator.prototype.indexed (obsolete in favor of the usage counter argument methods callbacks)
    • Map.keyBy (proposal is dead)
    • Map.prototype.deleteAll (proposal is dead)
    • Map.prototype.every (proposal is dead)
    • Map.prototype.filter (proposal is dead)
    • Map.prototype.find (proposal is dead)
    • Map.prototype.findKey (proposal is dead)
    • Map.prototype.includes (proposal is dead)
    • Map.prototype.keyOf (proposal is dead)
    • Map.prototype.mapKeys (proposal is dead)
    • Map.prototype.mapValues (proposal is dead)
    • Map.prototype.merge (proposal is dead)
    • Map.prototype.reduce (proposal is dead)
    • Map.prototype.some (proposal is dead)
    • Map.prototype.update (proposal is dead)
    • Map.prototype.updateOrInsert (obsolete, replaced with Map.prototype.emplace)
    • Map.prototype.upsert (obsolete, replaced with Map.prototype.emplace)
    • Math.DEG_PER_RAD (withdrawn)
    • Math.RAD_PER_DEG (withdrawn)
    • Math.clamp (withdrawn)
    • Math.degrees (withdrawn)
    • Math.fscale (withdrawn)
    • Math.iaddh (withdrawn in favor of BigInts)
    • Math.imulh (withdrawn in favor of BigInts)
    • Math.isubh (withdrawn in favor of BigInts)
    • Math.radians (withdrawn)
    • Math.scale (withdrawn)
    • Math.seededPRNG (changing of the API, waiting for the spec text)
    • Math.signbit (withdrawn)
    • Math.umulh (withdrawn in favor of BigInts)
    • Number.fromString (proposal is dead)
    • Number.range (obsolete, replaced with Iterator.range)
    • Object.iterateEntries (withdrawn)
    • Object.iterateKeys (withdrawn)
    • Object.iterateValues (withdrawn)
    • Observable (will be replaced with this proposal in the future)
    • Reflect.defineMetadata (obsolete)
    • Reflect.getMetadata (obsolete)
    • Reflect.getOwnMetadata (obsolete)
    • Reflect.hasMetadata (obsolete)
    • Reflect.hasOwnMetadata(obsolete)
    • Reflect.deleteMetadata (obsolete)
    • Reflect.getMetadataKeys (obsolete)
    • Reflect.getOwnMetadataKeys (obsolete)
    • Reflect.metadata (obsolete)
    • Set.prototype.addAll (proposal is dead)
    • Set.prototype.deleteAll (proposal is dead)
    • Set.prototype.every (proposal is dead)
    • Set.prototype.filter (proposal is dead)
    • Set.prototype.find (proposal is dead)
    • Set.prototype.join (proposal is dead)
    • Set.prototype.map (proposal is dead)
    • Set.prototype.reduce (proposal is dead)
    • Set.prototype.some (proposal is dead)
    • String.prototype.codePoints (proposal is dead)
    • Symbol.isRegistered (obsolete, replaced with Symbol.isRegisteredSymbol)
    • Symbol.isWellKnown (obsolete, replaced with Symbol.isWellKnownSymbol)
    • Symbol.matcher (obsolete, replaced with Symbol.customMatcher)
    • Symbol.metadataKey (obsolete, replaced with Symbol.metadata)
    • Symbol.patternMatch (obsolete, replaced with Symbol.customMatcher)
    • Symbol.replaceAll (obsolete)
    • %TypedArray%.fromAsync (obsolete)
    • %TypedArray%.prototype.filterOut (obsolete, replaced with %TypedArray%.prototype.filterReject)
    • %TypedArray%.prototype.groupBy (obsolete, replaced with Object.groupBy)
    • %TypedArray%.prototype.toSpliced (obsolete)
    • WeakSet.prototype.addAll (proposal is dead)
    • WeakSet.prototype.deleteAll (proposal is dead)
    • WeakMap.prototype.deleteAll (proposal is dead)
    • WeakMap.prototype.upsert (obsolete, replaced with WeakMap.prototype.emplace)
    • compositeKey (proposal is dead)
    • compositeSymbol (proposal is dead)
  • Drop non-standard Symbol.{ useSetter, useSimple, withoutSetter } methods control of Symbol polyfill
  • Drop fallbacks to ancient FF iterators (with '@@iterator' string key)
  • Remove modules:
    • es.array.every (required for ES3 only)
    • es.array.for-each (required for ES3 only)
    • es.array.is-array (required for ES3 only)
    • es.array.some (required for ES3 only)
    • es.date.get-year (supported in all popular modern engines, required for IE8- only)
    • es.date.now (required for ES3 only)
    • es.date.set-year (supported in all popular modern engines)
    • es.date.to-iso-string (required for IE8- and other ancient engines)
    • es.date.to-gmt-string (supported in all popular modern engines)
    • es.date.to-string (required for IE8- only)
    • es.error.to-string (required for IE8-, V8 ~ Chrome 32-, FF10-)
    • es.escape (supported in all popular modern engines)
    • es.function.bind (required for ES3 only)
    • es.number.to-precision (required for ancient engines like IE8- or Android 4.3- only)
    • es.object.define-property (required for ES3 engines and V8 ~ Chrome 36- only)
    • es.object.define-properties (required for ES3 engines and V8 ~ Chrme 36- only)
    • es.object.create (required for ES3 only)
    • es.string.substr (supported in all popular modern engines)
    • es.unescape (supported in all popular modern engines)
    • esnext.aggregate-error (moved to stable ES)
    • esnext.array.at (moved to stable ES)
    • esnext.array.filter-out (obsolete)
    • esnext.array.find-last (moved to stable ES)
    • esnext.array.find-last-index (moved to stable ES)
    • esnext.array.group (obsolete)
    • esnext.array.group-by (obsolete)
    • esnext.array.group-by-to-map (obsolete)
    • esnext.array.group-to-map (obsolete)
    • esnext.array.last-index (withdrawn)
    • esnext.array.last-item (withdrawn in favor of Array.prototype.at)
    • esnext.array.to-reversed (moved to stable ES)
    • esnext.array.to-sorted (moved to stable ES)
    • esnext.array.to-spliced (moved to stable ES)
    • esnext.array.with (moved to stable ES)
    • esnext.async-iterator.as-indexed-pairs (obsolete)
    • esnext.async-iterator.indexed (obsolete)
    • esnext.bigint.range (obsolete)
    • esnext.composite-key (proposal is dead)
    • esnext.composite-symbol (proposal is dead)
    • esnext.function.is-callable (proposal is dead)
    • esnext.function.is-constructor (proposal is dead)
    • esnext.function.un-this (obsolete)
    • esnext.global-this (moved to stable ES)
    • esnext.iterator.as-indexed-pairs (obsolete)
    • esnext.iterator.indexed (obsolete)
    • esnext.map.delete-all (proposal is dead)
    • esnext.map.every (proposal is dead)
    • esnext.map.filter (proposal is dead)
    • esnext.map.find (proposal is dead)
    • esnext.map.find-key (proposal is dead)
    • esnext.map.group-by (moved to stable ES)
    • esnext.map.includes (proposal is dead)
    • esnext.map.key-by (proposal is dead)
    • esnext.map.key-of (proposal is dead)
    • esnext.map.map-keys (proposal is dead)
    • esnext.map.map-values (proposal is dead)
    • esnext.map.merge (proposal is dead)
    • esnext.map.reduce (proposal is dead)
    • esnext.map.some (proposal is dead)
    • esnext.map.update (proposal is dead)
    • esnext.map.update-or-insert (obsolete)
    • esnext.map.upsert (obsolete)
    • esnext.math.clamp (withdrawn)
    • esnext.math.deg-per-rad (withdrawn)
    • esnext.math.degrees (withdrawn)
    • esnext.math.fscale (withdrawn)
    • esnext.math.iaddh (withdrawn)
    • esnext.math.imulh (withdrawn)
    • esnext.math.isubh (withdrawn)
    • esnext.math.rad-per-deg (withdrawn)
    • esnext.math.radians (withdrawn)
    • esnext.math.scale (withdrawn)
    • esnext.math.seeded-prng (obsolete)
    • esnext.math.signbit (withdrawn)
    • esnext.math.umulh (withdrawn)
    • esnext.number.from-string (proposal is dead)
    • esnext.number.range (obsolete)
    • esnext.object.has-own (moved to stable ES)
    • esnext.object.iterate-entries (withdrawn)
    • esnext.object.iterate-keys (withdrawn)
    • esnext.object.iterate-values (withdrawn)
    • esnext.object.group-by (moved to stable ES)
    • esnext.observable (will be replaced with this proposal in the future)
    • esnext.promise.all-settled (moved to stable ES)
    • esnext.promise.any (moved to stable ES)
    • esnext.promise.with-resolvers (moved to stable ES)
    • esnext.reflect.define-metadata (obsolete)
    • esnext.reflect.delete-metadata (obsolete)
    • esnext.reflect.get-metadata (obsolete)
    • esnext.reflect.get-metadata-keys (obsolete)
    • esnext.reflect.get-own-metadata (obsolete)
    • esnext.reflect.get-own-metadata-keys (obsolete)
    • esnext.reflect.has-metadata (obsolete)
    • esnext.reflect.has-own-metadata (obsolete)
    • esnext.reflect.metadata (obsolete)
    • esnext.set.add-all (proposal is dead)
    • esnext.set.delete-all (proposal is dead)
    • esnext.set.difference (old version of proposal, updated and moved to stable ES)
    • esnext.set.difference.v2 (moved to stable ES)
    • esnext.set.every (proposal is dead)
    • esnext.set.filter (proposal is dead)
    • esnext.set.find (proposal is dead)
    • esnext.set.intersection (old version of proposal, updated and moved to stable ES)
    • esnext.set.intersection.v2 (moved to stable ES)
    • esnext.set.is-disjoint-from (old version of proposal, updated and moved to stable ES)
    • esnext.set.is-disjoint-from.v2 (moved to stable ES)
    • esnext.set.is-subset-of (old version of proposal, updated and moved to stable ES)
    • esnext.set.is-subset-of.v2 (moved to stable ES)
    • esnext.set.is-superset-of (old version of proposal, updated and moved to stable ES)
    • esnext.set.is-superset-of.v2 (moved to stable ES)
    • esnext.set.join (proposal is dead)
    • esnext.set.map (proposal is dead)
    • esnext.set.reduce (proposal is dead)
    • esnext.set.symmetric-difference (old version of proposal, updated and moved to stable ES)
    • esnext.set.symmetric-difference.v2 (moved to stable ES)
    • esnext.set.union (old version of proposal, updated and moved to stable ES)
    • esnext.set.union.v2 (moved to stable ES)
    • esnext.set.some (proposal is dead)
    • esnext.string.at (old version, replaced by module with the same name with actual behavior)
    • esnext.string.at-alternative (moved to stable ES)
    • esnext.string.code-points (proposal is dead)
    • esnext.string.is-well-formed (moved to stable ES)
    • esnext.string.match-all (moved to stable ES)
    • esnext.string.replace-all (moved to stable ES)
    • esnext.string.to-well-formed (moved to stable ES)
    • esnext.symbol.is-registered (obsolete)
    • esnext.symbol.is-well-known (obsolete)
    • esnext.symbol.matcher (obsolete)
    • esnext.symbol.metadata-key (obsolete)
    • esnext.symbol.pattern-match (obsolete)
    • esnext.symbol.replace-all (obsolete)
    • esnext.typed-array.from-async (obsolete)
    • esnext.typed-array.at (moved to stable ES)
    • esnext.typed-array.filter-out (obsolete)
    • esnext.typed-array.find-last (moved to stable ES)
    • esnext.typed-array.find-last-index (moved to stable ES)
    • esnext.typed-array.group-by (obsolete)
    • esnext.typed-array.to-reversed (moved to stable ES)
    • esnext.typed-array.to-sorted (moved to stable ES)
    • esnext.typed-array.to-spliced (obsolete)
    • esnext.typed-array.with (moved to stable ES)
    • esnext.weak-set.add-all (proposal is dead)
    • esnext.weak-set.delete-all (proposal is dead)
    • esnext.weak-map.delete-all (proposal is dead)
    • esnext.weak-map.upsert (obsolete)
    • web.timers (required for IE9- only)
  • Split and / or rename:
    • es.array.iterator to:
      • es.array.iterator
      • es.array.keys
      • es.array.values
      • es.array.entries
    • es.array-buffer.constructor to:
      • es.array-buffer.constructor
      • es.array-buffer.species
      • es.array-buffer.to-string-tag
    • Extracted from Typed Array constructor entries:
      • es.typed-array.species
      • es.typed-array.to-string-tag
    • es.typed-array.iterator to:
      • es.typed-array.iterator
      • es.typed-array.keys
      • es.typed-array.values
      • es.typed-array.entries
    • es.data-view to:
      • es.data-view.constructor
      • es.data-view.set-int8
      • es.data-view.set-uint8
      • es.data-view.to-string-tag
    • es.map to:
      • es.map.constructor
      • es.map.species
    • es.promise to:
      • es.promise.constructor
      • es.promise.all
      • es.promise.catch
      • es.promise.race
      • es.promise.reject
      • es.promise.resolve
    • es.set to:
      • es.set.constructor
      • es.set.species
    • es.string.at-alternative to:
      • es.string.at
    • es.string.trim-end and es.string.trim-start to:
      • es.string.trim-end
      • es.string.trim-left
      • es.string.trim-right
      • es.string.trim-start
    • es.symbol to:
      • es.symbol.constructor
      • es.symbol.for
      • es.symbol.key-for
      • es.symbol.to-primitive
      • es.object.get-own-property-symbols
    • Set methods:
      • es.set.difference.v2 -> es.set.difference
      • es.set.intersection.v2 -> es.set.intersection
      • es.set.is-disjoint-from.v2 -> es.set.is-disjoint-from
      • es.set.is-subset-of.v2 -> es.set.is-subset-of
      • es.set.is-superset-of.v2 -> es.set.is-superset-of
      • es.set.symmetric-difference.v2 -> es.set.symmetric-difference
      • es.set.union.v2 -> es.set.union
    • web.dom-collections.iterator to:
      • web.dom-collections.iterator
      • web.dom-collections.keys
      • web.dom-collections.values
      • web.dom-collections.entries
    • web.immediate to:
      • web.clear-immediate
      • web.set-immediate
    • Constructors:
      • es.aggregate-error -> es.aggregate-error.constructor
      • es.weak-map -> es.weak-map.constructor
      • es.weak-set -> es.weak-set.constructor
      • web.url -> es.url.constructor
      • web.url-search-params -> es.url-search-params.constructor
  • Complete refactoring of main library code. The modules that I saw in my nightmares have been completely rewritten.
  • Reduce minimalistic bundles size
    • Optimize export logic
      • Global version
      • Pure version
    • Optimize internal dependencies
  • Move dependencies of many modules to entry points for better optimization by tools like @core-js/builder, babel, swc
  • Automatically generate core-js entry points, get dependencies from entries definitions and direct declarations from modules - simplification of maintenance, reducing of potential errors and code size
  • Changes in entry points:
    • Make core-js entry an equal of core-js/actual
    • Actualize /proposals/ namespace - some proposals were renamed, some entries had some versions
    • Drop /features/ namespace in favor of /full/
    • Drop /web/ namespace as almost useless in favor of /stable/, /actual/, /full/
    • Drop /stage/4, /stage and /proposals entries without specifying a stage / a proposal as almost useless
    • Drop */virtual/index.js entries as useless
    • Drop some other entries that make no practical sense as separate, like /math/to-string-tag
    • /proposals/* entries now contain required modules with dependencies
    • /stage/* entries now include not only modules from the higher stages than the specified stage but also all stable ES modules
  • Add exports fields with all entries to package.json of packages
  • Drop configurable level of aggressiveness from core-js/configurator in favor of future / alternative approaches since the current way is too dangerous, inapplicable in most cases and almost no one uses it
  • No longer publish on deno.land/x since core-js is almost not used from this
  • Move to scoped packages:
    • core-js-compat -> @core-js/compat
    • core-js-builder -> @core-js/builder
    • core-js-bundle -> @core-js/bundle
    • core-js-pure -> @core-js/pure
  • Drop NodeJS < 18.12 support in @core-js/builder and @core-js/compat
  • Drop @core-js/compat modules-by-versions history for core-js@3
  • Make @core-js/compat / @core-js/builder default modules list an equal of core-js/actual for consistency with import 'core-js'
  • core-js version in @core-js/compat
  • Changes in @core-js/compat / @core-js/builder targets keys:
    • { chrome, firefox, opera }-android repaced with { chrome, firefox, opera }_mobile because of allowing 3rd party browsers on iOS in EU
    • react-native also replaced with react_native for consistency
    • _ is beter replacement for space than -, keys with _ could be used in object literals without quotes and those keys are consistent with related keys in other tools
    • Removed phantom since this engine is no longer supported by polyfill
    • Removed oculus in favor of quest
    • Removed other data by legacy keys from compat data
  • Drop @core-js/compat filter deprecated option in favor of modules
  • Drop @core-js/builder blacklist deprecated option in favor of exclude
  • Make @core-js/builder return an object (for future extensions)
  • Update @core-js/builder dependencies (Node 8 support no longer block that)
  • Add minify option to @core-js/builder, bundles minified by default
  • Add built-in definitions to compat data

That's part of the planned changes, many of the already-done moments are not documented, the rest will be added later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants