@nubjs/nub-linux-x64 0.0.5 → 0.0.8
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.
- package/bin/nub +0 -0
- package/package.json +1 -1
- package/runtime/addons/nub-native.node +0 -0
- package/runtime/cache-evict.mjs +69 -0
- package/runtime/node_modules/@js-temporal/polyfill/CHANGELOG.md +453 -0
- package/runtime/node_modules/@js-temporal/polyfill/LICENSE +13 -0
- package/runtime/node_modules/@js-temporal/polyfill/README.md +90 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.cjs +2 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.cjs.map +1 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.esm.js +2 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.esm.js.map +1 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.umd.js +2 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.umd.js.map +1 -0
- package/runtime/node_modules/@js-temporal/polyfill/index.d.cts +1215 -0
- package/runtime/node_modules/@js-temporal/polyfill/index.d.ts +1215 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/assert.ts +8 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/bigintmath.ts +39 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/calendar.ts +2424 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/debug.ts +7 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/duration.ts +438 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/durationformat.d.ts +93 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/ecmascript.ts +4973 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/index.ts +34 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/init.ts +43 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/instant.ts +138 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/internaltypes.d.ts +242 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/intl.ts +758 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/intrinsicclass.ts +162 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/legacydate.ts +17 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/math.ts +96 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/now.ts +48 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/plaindate.ts +212 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/plaindatetime.ts +274 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/plainmonthday.ts +110 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/plaintime.ts +154 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/plainyearmonth.ts +157 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/regex.ts +59 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/slots.ts +341 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/temporal.ts +10 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/timeduration.ts +149 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/zoneddatetime.ts +492 -0
- package/runtime/node_modules/@js-temporal/polyfill/package.json +143 -0
- package/runtime/node_modules/@oxc-parser/binding-linux-x64-gnu/README.md +3 -0
- package/runtime/node_modules/@oxc-parser/binding-linux-x64-gnu/package.json +42 -0
- package/runtime/node_modules/@oxc-parser/binding-linux-x64-gnu/parser.linux-x64-gnu.node +0 -0
- package/runtime/node_modules/@oxc-project/runtime/CHANGELOG.md +88 -0
- package/runtime/node_modules/@oxc-project/runtime/LICENSE +22 -0
- package/runtime/node_modules/@oxc-project/runtime/README.md +5 -0
- package/runtime/node_modules/@oxc-project/runtime/package.json +1066 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/AwaitValue.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecoratedDescriptor.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs.js +236 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2203.js +184 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2203R.js +191 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2301.js +222 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2305.js +133 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2311.js +124 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/arrayLikeToArray.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/arrayWithHoles.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/arrayWithoutHoles.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/assertClassBrand.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/assertThisInitialized.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/asyncGeneratorDelegate.js +24 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js +45 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/asyncToGenerator.js +26 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/callSuper.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/checkInRHS.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/checkPrivateRedeclaration.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classApplyDescriptorDestructureSet.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classApplyDescriptorGet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classApplyDescriptorSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classCallCheck.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classCheckPrivateStaticAccess.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classCheckPrivateStaticFieldDescriptor.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classExtractFieldDescriptor.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classNameTDZError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldDestructureSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldGet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldGet2.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldInitSpec.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldLooseBase.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldLooseKey.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldSet2.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateGetter.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateMethodGet.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateMethodInitSpec.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateMethodSet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateSetter.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateFieldDestructureSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateFieldSpecGet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateFieldSpecSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateMethodGet.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateMethodSet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/construct.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/createClass.js +13 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/createForOfIteratorHelper.js +50 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/createForOfIteratorHelperLoose.js +19 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/createSuper.js +16 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/decorate.js +23 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/decorateMetadata.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/decorateParam.js +11 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/defaults.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/defineAccessor.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/defineEnumerableProperties.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/dispose.js +28 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/AwaitValue.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/OverloadYield.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecoratedDescriptor.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs.js +236 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2203.js +184 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2203R.js +191 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2301.js +222 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2305.js +133 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2311.js +124 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/arrayLikeToArray.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/arrayWithHoles.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/arrayWithoutHoles.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/assertClassBrand.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/assertThisInitialized.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/asyncGeneratorDelegate.js +24 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/asyncIterator.js +45 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/asyncToGenerator.js +26 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/awaitAsyncGenerator.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/callSuper.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/checkInRHS.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/checkPrivateRedeclaration.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classApplyDescriptorDestructureSet.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classApplyDescriptorGet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classApplyDescriptorSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classCallCheck.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classCheckPrivateStaticAccess.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classExtractFieldDescriptor.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classNameTDZError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldDestructureSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldGet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldGet2.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldInitSpec.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldLooseBase.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldLooseKey.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldSet2.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateGetter.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateMethodGet.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateMethodInitSpec.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateMethodSet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateSetter.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateFieldDestructureSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateFieldSpecGet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateFieldSpecSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateMethodGet.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateMethodSet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/construct.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createClass.js +13 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createForOfIteratorHelper.js +50 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createForOfIteratorHelperLoose.js +19 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createSuper.js +16 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/decorate.js +21 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/decorateMetadata.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/decorateParam.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defaults.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defineAccessor.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defineEnumerableProperties.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defineProperty.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/dispose.js +28 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/extends.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/get.js +11 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/getPrototypeOf.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/identity.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/importDeferProxy.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/inherits.js +14 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/inheritsLoose.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/initializerDefineProperty.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/initializerWarningHelper.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/instanceof.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/interopRequireDefault.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/interopRequireWildcard.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/isNativeFunction.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/isNativeReflectConstruct.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/iterableToArray.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/iterableToArrayLimit.js +28 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/jsx.js +22 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/maybeArrayLike.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/newArrowCheck.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/nonIterableRest.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/nonIterableSpread.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/nullishReceiverError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectDestructuringEmpty.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectSpread.js +14 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectSpread2.js +23 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectWithoutProperties.js +13 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectWithoutPropertiesLoose.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/package.json +3 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/possibleConstructorReturn.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/readOnlyError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/regeneratorRuntime.js +304 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/set.js +22 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/setFunctionName.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/setPrototypeOf.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/skipFirstGeneratorNext.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/slicedToArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/superPropBase.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/superPropGet.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/superPropSet.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/taggedTemplateLiteral.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/taggedTemplateLiteralLoose.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/tdz.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/temporalRef.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/temporalUndefined.js +2 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toConsumableArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toPrimitive.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toPropertyKey.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toSetter.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/typeof.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/unsupportedIterableToArray.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/using.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/usingCtx.js +59 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/wrapAsyncGenerator.js +69 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/wrapNativeSuper.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/wrapRegExp.js +51 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/writeOnlyError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/extends.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/get.js +11 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/getPrototypeOf.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/identity.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/importDeferProxy.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/inherits.js +14 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/inheritsLoose.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/initializerDefineProperty.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/initializerWarningHelper.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/instanceof.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/interopRequireDefault.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/interopRequireWildcard.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/isNativeFunction.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/isNativeReflectConstruct.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/iterableToArray.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/iterableToArrayLimit.js +28 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/jsx.js +22 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/maybeArrayLike.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/newArrowCheck.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/nonIterableRest.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/nonIterableSpread.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/nullishReceiverError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectDestructuringEmpty.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectSpread.js +14 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js +23 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js +13 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/possibleConstructorReturn.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/readOnlyError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/regeneratorRuntime.js +304 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/set.js +22 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/setFunctionName.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/setPrototypeOf.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/skipFirstGeneratorNext.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/slicedToArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/superPropBase.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/superPropGet.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/superPropSet.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/taggedTemplateLiteral.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/taggedTemplateLiteralLoose.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/tdz.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/temporalRef.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/temporalUndefined.js +2 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/toArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/toConsumableArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/toSetter.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/typeof.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/unsupportedIterableToArray.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/using.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js +59 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js +69 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/wrapNativeSuper.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/wrapRegExp.js +51 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/writeOnlyError.js +4 -0
- package/runtime/node_modules/@oxc-project/types/LICENSE +22 -0
- package/runtime/node_modules/@oxc-project/types/README.md +3 -0
- package/runtime/node_modules/@oxc-project/types/package.json +26 -0
- package/runtime/node_modules/@oxc-project/types/types.d.ts +1912 -0
- package/runtime/node_modules/@petamoriken/float16/LICENSE +21 -0
- package/runtime/node_modules/@petamoriken/float16/README.md +413 -0
- package/runtime/node_modules/@petamoriken/float16/browser/float16.js +1340 -0
- package/runtime/node_modules/@petamoriken/float16/browser/float16.mjs +1325 -0
- package/runtime/node_modules/@petamoriken/float16/index.d.ts +546 -0
- package/runtime/node_modules/@petamoriken/float16/index.v5.6.d.ts +546 -0
- package/runtime/node_modules/@petamoriken/float16/index.v5.7.d.ts +555 -0
- package/runtime/node_modules/@petamoriken/float16/inspect/node.cjs +25 -0
- package/runtime/node_modules/@petamoriken/float16/inspect/node.mjs +23 -0
- package/runtime/node_modules/@petamoriken/float16/lib/DataView.cjs +16 -0
- package/runtime/node_modules/@petamoriken/float16/lib/Float16Array.cjs +690 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/arrayIterator.cjs +52 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/brand.cjs +27 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/converter.cjs +111 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/is.cjs +78 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/messages.cjs +18 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/primordials.cjs +150 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/spec.cjs +84 -0
- package/runtime/node_modules/@petamoriken/float16/lib/f16round.cjs +10 -0
- package/runtime/node_modules/@petamoriken/float16/lib/index.cjs +16 -0
- package/runtime/node_modules/@petamoriken/float16/lib/isTypedArray.cjs +11 -0
- package/runtime/node_modules/@petamoriken/float16/package.json +115 -0
- package/runtime/node_modules/@petamoriken/float16/src/DataView.mjs +35 -0
- package/runtime/node_modules/@petamoriken/float16/src/Float16Array.mjs +1194 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/arrayIterator.mjs +86 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/brand.mjs +31 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/converter.mjs +173 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/is.mjs +151 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/messages.mjs +22 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/primordials.mjs +254 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/spec.mjs +137 -0
- package/runtime/node_modules/@petamoriken/float16/src/f16round.mjs +10 -0
- package/runtime/node_modules/@petamoriken/float16/src/index.mjs +7 -0
- package/runtime/node_modules/@petamoriken/float16/src/isTypedArray.mjs +10 -0
- package/runtime/node_modules/jsbi/LICENSE +176 -0
- package/runtime/node_modules/jsbi/README.md +173 -0
- package/runtime/node_modules/jsbi/dist/jsbi-cjs.js +2 -0
- package/runtime/node_modules/jsbi/dist/jsbi-cjs.js.map +1 -0
- package/runtime/node_modules/jsbi/dist/jsbi-umd.js +2 -0
- package/runtime/node_modules/jsbi/dist/jsbi-umd.js.map +1 -0
- package/runtime/node_modules/jsbi/dist/jsbi.mjs +2 -0
- package/runtime/node_modules/jsbi/dist/jsbi.mjs.map +1 -0
- package/runtime/node_modules/jsbi/jsbi.d.ts +43 -0
- package/runtime/node_modules/jsbi/package.json +35 -0
- package/runtime/node_modules/oxc-parser/LICENSE +22 -0
- package/runtime/node_modules/oxc-parser/README.md +167 -0
- package/runtime/node_modules/oxc-parser/package.json +153 -0
- package/runtime/node_modules/oxc-parser/src-js/bindings.js +601 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/constants.js +105 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/js.js +5862 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/js_range.js +6403 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/ts.js +6154 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/ts_range.js +6723 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/lazy/constructors.js +13875 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/lazy/type_ids.js +191 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/lazy/walk.js +5810 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/keys.js +220 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/type_ids.js +177 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/visitor.d.ts +387 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/walk.js +2455 -0
- package/runtime/node_modules/oxc-parser/src-js/index.d.ts +312 -0
- package/runtime/node_modules/oxc-parser/src-js/index.js +108 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/common.js +301 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/eager.js +255 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/lazy-common.js +11 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/lazy.js +162 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/node-array.js +365 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/supported.js +52 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/visitor.js +127 -0
- package/runtime/node_modules/oxc-parser/src-js/visit/index.js +41 -0
- package/runtime/node_modules/oxc-parser/src-js/visit/visitor.js +405 -0
- package/runtime/node_modules/oxc-parser/src-js/wasm.js +13 -0
- package/runtime/node_modules/oxc-parser/src-js/webcontainer-fallback.cjs +21 -0
- package/runtime/node_modules/oxc-parser/src-js/wrap.js +57 -0
- package/runtime/node_modules/urlpattern-polyfill/LICENSE +19 -0
- package/runtime/node_modules/urlpattern-polyfill/README.md +242 -0
- package/runtime/node_modules/urlpattern-polyfill/dist/index.d.ts +9 -0
- package/runtime/node_modules/urlpattern-polyfill/dist/types.d.ts +49 -0
- package/runtime/node_modules/urlpattern-polyfill/dist/urlpattern.cjs +1 -0
- package/runtime/node_modules/urlpattern-polyfill/dist/urlpattern.js +1 -0
- package/runtime/node_modules/urlpattern-polyfill/index.cjs +7 -0
- package/runtime/node_modules/urlpattern-polyfill/index.js +7 -0
- package/runtime/node_modules/urlpattern-polyfill/package.json +149 -0
- package/runtime/polyfills.mjs +73 -97
- package/runtime/preload-async-hooks.mjs +50 -0
- package/runtime/preload.mjs +274 -320
- package/runtime/transform-core.mjs +762 -0
- package/runtime/version.mjs +12 -0
- package/runtime/worker-polyfill.mjs +147 -9
|
@@ -0,0 +1,758 @@
|
|
|
1
|
+
import { assert } from './assert';
|
|
2
|
+
import * as ES from './ecmascript';
|
|
3
|
+
import { MakeIntrinsicClass } from './intrinsicclass';
|
|
4
|
+
import {
|
|
5
|
+
CAL_ID,
|
|
6
|
+
CALENDAR,
|
|
7
|
+
CreateSlots,
|
|
8
|
+
DATE,
|
|
9
|
+
DATETIME,
|
|
10
|
+
DAYS,
|
|
11
|
+
EPOCHNANOSECONDS,
|
|
12
|
+
GetSlot,
|
|
13
|
+
HasSlot,
|
|
14
|
+
HOURS,
|
|
15
|
+
INST,
|
|
16
|
+
ISO_DATE,
|
|
17
|
+
ISO_DATE_TIME,
|
|
18
|
+
LOCALE,
|
|
19
|
+
MD,
|
|
20
|
+
MICROSECONDS,
|
|
21
|
+
MILLISECONDS,
|
|
22
|
+
MINUTES,
|
|
23
|
+
MONTHS,
|
|
24
|
+
NANOSECONDS,
|
|
25
|
+
OPTIONS,
|
|
26
|
+
ORIGINAL,
|
|
27
|
+
ResetSlot,
|
|
28
|
+
SECONDS,
|
|
29
|
+
SetSlot,
|
|
30
|
+
TIME,
|
|
31
|
+
TIME_FMT,
|
|
32
|
+
TZ_CANONICAL,
|
|
33
|
+
TZ_ORIGINAL,
|
|
34
|
+
WEEKS,
|
|
35
|
+
YEARS,
|
|
36
|
+
YM
|
|
37
|
+
} from './slots';
|
|
38
|
+
import type { Temporal } from '..';
|
|
39
|
+
import type { DateTimeFormatParams as Params, DateTimeFormatReturn as Return } from './internaltypes';
|
|
40
|
+
|
|
41
|
+
// Save the original Intl.DateTimeFormat, it will likely be overwritten
|
|
42
|
+
const OriginalIntlDateTimeFormat = Intl.DateTimeFormat;
|
|
43
|
+
|
|
44
|
+
type LazySlot = typeof DATE | typeof YM | typeof MD | typeof TIME_FMT | typeof DATETIME | typeof INST;
|
|
45
|
+
|
|
46
|
+
// Construction of built-in Intl.DateTimeFormat objects is sloooooow,
|
|
47
|
+
// so we'll only create those instances when we need them.
|
|
48
|
+
// See https://bugs.chromium.org/p/v8/issues/detail?id=6528
|
|
49
|
+
function getSlotLazy(obj: DateTimeFormatImpl, slot: LazySlot) {
|
|
50
|
+
let val = GetSlot(obj, slot);
|
|
51
|
+
if (typeof val === 'function') {
|
|
52
|
+
// If we get here, `val` is an "amender function". It will take the user's
|
|
53
|
+
// options and transform them into suitable options to be passed into the
|
|
54
|
+
// built-in (non-polyfill) Intl.DateTimeFormat constructor. These options
|
|
55
|
+
// will vary depending on the Temporal type, so that's why we store separate
|
|
56
|
+
// formatters in separate props on the polyfill's DateTimeFormat instances.
|
|
57
|
+
// The efficiency happens because we don't create an (expensive) formatter
|
|
58
|
+
// until the user calls toLocaleString for that Temporal type.
|
|
59
|
+
val = new OriginalIntlDateTimeFormat(GetSlot(obj, LOCALE), val(GetSlot(obj, OPTIONS)));
|
|
60
|
+
ResetSlot(obj, slot, val);
|
|
61
|
+
}
|
|
62
|
+
return val;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function createDateTimeFormat(
|
|
66
|
+
dtf: DateTimeFormatImpl,
|
|
67
|
+
locale: Params['constructor'][0],
|
|
68
|
+
optionsParam: Params['constructor'][1]
|
|
69
|
+
) {
|
|
70
|
+
const hasOptions = typeof optionsParam !== 'undefined';
|
|
71
|
+
let options: Intl.DateTimeFormatOptions;
|
|
72
|
+
if (hasOptions) {
|
|
73
|
+
// Read all the options in the expected order and copy them to a
|
|
74
|
+
// null-prototype object with which we can do further operations
|
|
75
|
+
// unobservably
|
|
76
|
+
const props: (keyof Intl.DateTimeFormatOptions)[] = [
|
|
77
|
+
'localeMatcher',
|
|
78
|
+
'calendar',
|
|
79
|
+
'numberingSystem',
|
|
80
|
+
'hour12',
|
|
81
|
+
'hourCycle',
|
|
82
|
+
'timeZone',
|
|
83
|
+
'weekday',
|
|
84
|
+
'era',
|
|
85
|
+
'year',
|
|
86
|
+
'month',
|
|
87
|
+
'day',
|
|
88
|
+
'dayPeriod',
|
|
89
|
+
'hour',
|
|
90
|
+
'minute',
|
|
91
|
+
'second',
|
|
92
|
+
'fractionalSecondDigits',
|
|
93
|
+
'timeZoneName',
|
|
94
|
+
'formatMatcher',
|
|
95
|
+
'dateStyle',
|
|
96
|
+
'timeStyle'
|
|
97
|
+
];
|
|
98
|
+
options = ES.ToObject(optionsParam);
|
|
99
|
+
const newOptions = Object.create(null);
|
|
100
|
+
for (let i = 0; i < props.length; i++) {
|
|
101
|
+
const prop = props[i];
|
|
102
|
+
if (Object.prototype.hasOwnProperty.call(options, prop)) {
|
|
103
|
+
newOptions[prop] = options[prop];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
options = newOptions;
|
|
107
|
+
} else {
|
|
108
|
+
options = Object.create(null);
|
|
109
|
+
}
|
|
110
|
+
const original = new OriginalIntlDateTimeFormat(locale, options);
|
|
111
|
+
const ro = original.resolvedOptions();
|
|
112
|
+
|
|
113
|
+
CreateSlots(dtf);
|
|
114
|
+
|
|
115
|
+
// DateTimeFormat instances are very expensive to create. Therefore, they will
|
|
116
|
+
// be lazily created only when needed, using the locale and options provided.
|
|
117
|
+
// But it's possible for callers to mutate those inputs before lazy creation
|
|
118
|
+
// happens. For this reason, we clone the inputs instead of caching the
|
|
119
|
+
// original objects. To avoid the complexity of deep cloning any inputs that
|
|
120
|
+
// are themselves objects (e.g. the locales array, or options property values
|
|
121
|
+
// that will be coerced to strings), we rely on `resolvedOptions()` to do the
|
|
122
|
+
// coercion and cloning for us. Unfortunately, we can't just use the resolved
|
|
123
|
+
// options as-is because our options-amending logic adds additional fields if
|
|
124
|
+
// the user doesn't supply any unit fields like year, month, day, hour, etc.
|
|
125
|
+
// Therefore, we limit the properties in the clone to properties that were
|
|
126
|
+
// present in the original input.
|
|
127
|
+
if (hasOptions) {
|
|
128
|
+
const clonedResolved = Object.assign(Object.create(null), ro);
|
|
129
|
+
for (const prop in clonedResolved) {
|
|
130
|
+
if (!Object.prototype.hasOwnProperty.call(options, prop)) {
|
|
131
|
+
delete clonedResolved[prop as keyof typeof clonedResolved];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// hour12/hourCycle don't show up in resolvedOptions() unless the chosen
|
|
135
|
+
// format includes an hour component, so copy them explicitly in case they
|
|
136
|
+
// would otherwise be lost
|
|
137
|
+
clonedResolved.hour12 = options.hour12;
|
|
138
|
+
clonedResolved.hourCycle = options.hourCycle;
|
|
139
|
+
SetSlot(dtf, OPTIONS, clonedResolved);
|
|
140
|
+
} else {
|
|
141
|
+
SetSlot(dtf, OPTIONS, options);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
SetSlot(dtf, LOCALE, ro.locale);
|
|
145
|
+
SetSlot(dtf, ORIGINAL, original);
|
|
146
|
+
SetSlot(dtf, TZ_CANONICAL, ro.timeZone);
|
|
147
|
+
SetSlot(dtf, CAL_ID, ro.calendar);
|
|
148
|
+
SetSlot(dtf, DATE, dateAmend);
|
|
149
|
+
SetSlot(dtf, YM, yearMonthAmend);
|
|
150
|
+
SetSlot(dtf, MD, monthDayAmend);
|
|
151
|
+
SetSlot(dtf, TIME_FMT, timeAmend);
|
|
152
|
+
SetSlot(dtf, DATETIME, datetimeAmend);
|
|
153
|
+
SetSlot(dtf, INST, instantAmend);
|
|
154
|
+
|
|
155
|
+
// Save the original time zone, for a few reasons:
|
|
156
|
+
// - Clearer error messages
|
|
157
|
+
// - More clearly follows the spec for InitializeDateTimeFormat
|
|
158
|
+
// - Because it follows the spec more closely, will make it easier to integrate
|
|
159
|
+
// support of offset strings and other potential changes like proposal-canonical-tz.
|
|
160
|
+
const timeZoneOption = hasOptions ? options.timeZone : undefined;
|
|
161
|
+
if (timeZoneOption === undefined) {
|
|
162
|
+
SetSlot(dtf, TZ_ORIGINAL, ro.timeZone);
|
|
163
|
+
} else {
|
|
164
|
+
const id = ES.ToString(timeZoneOption);
|
|
165
|
+
if (id.startsWith('−')) {
|
|
166
|
+
// The initial (Node 23) implementation of offset time zones allowed use
|
|
167
|
+
// of the Unicode minus sign, which was disallowed by a later spec change.
|
|
168
|
+
throw new RangeError('Unicode minus (U+2212) is not supported in time zone offsets');
|
|
169
|
+
}
|
|
170
|
+
// store a normalized identifier
|
|
171
|
+
SetSlot(dtf, TZ_ORIGINAL, ES.ToTemporalTimeZoneIdentifier(id));
|
|
172
|
+
}
|
|
173
|
+
return undefined; // TODO: I couldn't satisfy TS without adding this. Is there another way?
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function IsPatchedDateTimeFormat(item: unknown): item is DateTimeFormatImpl {
|
|
177
|
+
return HasSlot(item, ORIGINAL);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
class DateTimeFormatImpl {
|
|
181
|
+
constructor(locales: Params['constructor'][0] = undefined, options: Params['constructor'][1] = undefined) {
|
|
182
|
+
createDateTimeFormat(this, locales, options);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
get format() {
|
|
186
|
+
ES.CheckReceiver(this, IsPatchedDateTimeFormat);
|
|
187
|
+
const boundFormat = format.bind(this);
|
|
188
|
+
Object.defineProperties(boundFormat, {
|
|
189
|
+
length: { value: 1, enumerable: false, writable: false, configurable: true },
|
|
190
|
+
name: { value: '', enumerable: false, writable: false, configurable: true }
|
|
191
|
+
});
|
|
192
|
+
return boundFormat;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
formatRange(a: Params['formatRange'][0], b: Params['formatRange'][1]): Return['formatRange'] {
|
|
196
|
+
ES.CheckReceiver(this, IsPatchedDateTimeFormat);
|
|
197
|
+
return formatRange.call(this, a, b);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
formatToParts?<P extends readonly unknown[]>(
|
|
201
|
+
datetime: Params['formatToParts'][0],
|
|
202
|
+
...rest: P
|
|
203
|
+
): Return['formatToParts'] {
|
|
204
|
+
ES.CheckReceiver(this, IsPatchedDateTimeFormat);
|
|
205
|
+
return formatToParts.call(this, datetime, ...rest);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
formatRangeToParts?(
|
|
209
|
+
a: Params['formatRangeToParts'][0],
|
|
210
|
+
b: Params['formatRangeToParts'][1]
|
|
211
|
+
): Return['formatRangeToParts'] {
|
|
212
|
+
ES.CheckReceiver(this, IsPatchedDateTimeFormat);
|
|
213
|
+
return formatRangeToParts.call(this, a, b);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
resolvedOptions(): Return['resolvedOptions'] {
|
|
217
|
+
ES.CheckReceiver(this, IsPatchedDateTimeFormat);
|
|
218
|
+
return resolvedOptions.call(this);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (!('formatToParts' in OriginalIntlDateTimeFormat.prototype)) {
|
|
223
|
+
delete DateTimeFormatImpl.prototype.formatToParts;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (!('formatRangeToParts' in OriginalIntlDateTimeFormat.prototype)) {
|
|
227
|
+
delete DateTimeFormatImpl.prototype.formatRangeToParts;
|
|
228
|
+
}
|
|
229
|
+
export type { DateTimeFormatImpl };
|
|
230
|
+
|
|
231
|
+
interface DateTimeFormatInterface {
|
|
232
|
+
(locales: Params['constructor'][0], options: Params['constructor'][1]): DateTimeFormatImpl;
|
|
233
|
+
new (locales: Params['constructor'][0], options: Params['constructor'][1]): DateTimeFormatImpl;
|
|
234
|
+
supportedLocalesOf: typeof Intl.DateTimeFormat.supportedLocalesOf;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// A non-class constructor is needed because Intl.DateTimeFormat must be able to
|
|
238
|
+
// be called without 'new'
|
|
239
|
+
export const DateTimeFormat = function (
|
|
240
|
+
locales: Params['constructor'][0] = undefined,
|
|
241
|
+
options: Params['constructor'][1] = undefined
|
|
242
|
+
): DateTimeFormatImpl {
|
|
243
|
+
return new DateTimeFormatImpl(locales, options);
|
|
244
|
+
} as unknown as DateTimeFormatInterface;
|
|
245
|
+
DateTimeFormatImpl.prototype.constructor = DateTimeFormat;
|
|
246
|
+
|
|
247
|
+
Object.defineProperty(DateTimeFormat, 'prototype', {
|
|
248
|
+
value: DateTimeFormatImpl.prototype,
|
|
249
|
+
writable: false,
|
|
250
|
+
enumerable: false,
|
|
251
|
+
configurable: false
|
|
252
|
+
});
|
|
253
|
+
DateTimeFormat.supportedLocalesOf = OriginalIntlDateTimeFormat.supportedLocalesOf;
|
|
254
|
+
MakeIntrinsicClass(DateTimeFormat as unknown as typeof Intl.DateTimeFormat, 'Intl.DateTimeFormat');
|
|
255
|
+
|
|
256
|
+
function resolvedOptions(this: DateTimeFormatImpl): Return['resolvedOptions'] {
|
|
257
|
+
const resolved = GetSlot(this, ORIGINAL).resolvedOptions();
|
|
258
|
+
resolved.timeZone = GetSlot(this, TZ_ORIGINAL);
|
|
259
|
+
return resolved;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// TODO: investigate why there's a rest parameter here. Does this function really need to accept extra params?
|
|
263
|
+
// And if so, why doesn't formatRange also accept extra params?
|
|
264
|
+
function format<P extends readonly unknown[]>(
|
|
265
|
+
this: DateTimeFormatImpl,
|
|
266
|
+
datetime: Params['format'][0],
|
|
267
|
+
...rest: P
|
|
268
|
+
): Return['format'] {
|
|
269
|
+
let overrides = extractOverrides(datetime, this);
|
|
270
|
+
let formatter, formatArgs: [Params['format'][0], ...unknown[]];
|
|
271
|
+
if (overrides.formatter) {
|
|
272
|
+
formatter = overrides.formatter;
|
|
273
|
+
formatArgs = [ES.epochNsToMs(overrides.epochNs, 'floor')];
|
|
274
|
+
} else {
|
|
275
|
+
formatter = GetSlot(this, ORIGINAL);
|
|
276
|
+
formatArgs = [datetime, ...rest];
|
|
277
|
+
}
|
|
278
|
+
return formatter.format(...(formatArgs as [number | Date | undefined]));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function formatToParts<P extends readonly unknown[]>(
|
|
282
|
+
this: DateTimeFormatImpl,
|
|
283
|
+
datetime: Params['formatToParts'][0],
|
|
284
|
+
...rest: P
|
|
285
|
+
): Return['formatToParts'] {
|
|
286
|
+
let overrides = extractOverrides(datetime, this);
|
|
287
|
+
let formatter, formatArgs;
|
|
288
|
+
if (overrides.formatter) {
|
|
289
|
+
formatter = overrides.formatter;
|
|
290
|
+
formatArgs = [ES.epochNsToMs(overrides.epochNs, 'floor')];
|
|
291
|
+
} else {
|
|
292
|
+
formatter = GetSlot(this, ORIGINAL);
|
|
293
|
+
formatArgs = [datetime, ...rest];
|
|
294
|
+
}
|
|
295
|
+
return formatter.formatToParts(...(formatArgs as [number | Date | undefined]));
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function formatRange(this: DateTimeFormatImpl, aParam: Params['formatRange'][0], bParam: Params['formatRange'][1]) {
|
|
299
|
+
if (aParam === undefined || bParam === undefined) {
|
|
300
|
+
throw new TypeError('Intl.DateTimeFormat.formatRange requires two values');
|
|
301
|
+
}
|
|
302
|
+
const a = toDateTimeFormattable(aParam);
|
|
303
|
+
const b = toDateTimeFormattable(bParam);
|
|
304
|
+
let formatArgs = [a, b] as const;
|
|
305
|
+
let formatter;
|
|
306
|
+
if (isTemporalObject(a) !== isTemporalObject(b)) {
|
|
307
|
+
throw new TypeError('Intl.DateTimeFormat.formatRange accepts two values of the same type');
|
|
308
|
+
}
|
|
309
|
+
if (isTemporalObject(a)) {
|
|
310
|
+
if (!sameTemporalType(a, b)) {
|
|
311
|
+
throw new TypeError('Intl.DateTimeFormat.formatRange accepts two values of the same type');
|
|
312
|
+
}
|
|
313
|
+
const { epochNs: aa, formatter: aformatter } = extractOverrides(a, this);
|
|
314
|
+
const { epochNs: bb, formatter: bformatter } = extractOverrides(b, this);
|
|
315
|
+
if (aformatter) {
|
|
316
|
+
assert(bformatter == aformatter, 'formatters for same Temporal type should be identical');
|
|
317
|
+
formatter = aformatter;
|
|
318
|
+
formatArgs = [ES.epochNsToMs(aa, 'floor'), ES.epochNsToMs(bb, 'floor')];
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (!formatter) {
|
|
322
|
+
formatter = GetSlot(this, ORIGINAL);
|
|
323
|
+
}
|
|
324
|
+
return formatter.formatRange(...(formatArgs as [number, number]));
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function formatRangeToParts(
|
|
328
|
+
this: DateTimeFormatImpl,
|
|
329
|
+
aParam: Params['formatRangeToParts'][0],
|
|
330
|
+
bParam: Params['formatRangeToParts'][1]
|
|
331
|
+
) {
|
|
332
|
+
if (aParam === undefined || bParam === undefined) {
|
|
333
|
+
throw new TypeError('Intl.DateTimeFormat.formatRange requires two values');
|
|
334
|
+
}
|
|
335
|
+
const a = toDateTimeFormattable(aParam);
|
|
336
|
+
const b = toDateTimeFormattable(bParam);
|
|
337
|
+
let formatArgs = [a, b] as const;
|
|
338
|
+
let formatter;
|
|
339
|
+
if (isTemporalObject(a) !== isTemporalObject(b)) {
|
|
340
|
+
throw new TypeError('Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type');
|
|
341
|
+
}
|
|
342
|
+
if (isTemporalObject(a)) {
|
|
343
|
+
if (!sameTemporalType(a, b)) {
|
|
344
|
+
throw new TypeError('Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type');
|
|
345
|
+
}
|
|
346
|
+
const { epochNs: aa, formatter: aformatter } = extractOverrides(a, this);
|
|
347
|
+
const { epochNs: bb, formatter: bformatter } = extractOverrides(b, this);
|
|
348
|
+
if (aformatter) {
|
|
349
|
+
assert(bformatter == aformatter, 'formatters for same Temporal type should be identical');
|
|
350
|
+
formatter = aformatter;
|
|
351
|
+
formatArgs = [ES.epochNsToMs(aa, 'floor'), ES.epochNsToMs(bb, 'floor')];
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
if (!formatter) {
|
|
355
|
+
formatter = GetSlot(this, ORIGINAL);
|
|
356
|
+
}
|
|
357
|
+
return formatter.formatRangeToParts(...(formatArgs as [number, number]));
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// "false" is a signal to delete this option
|
|
361
|
+
type MaybeFalseOptions = {
|
|
362
|
+
[K in keyof Intl.DateTimeFormatOptions]?: Intl.DateTimeFormatOptions[K] | false;
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
function amend(optionsParam: Intl.DateTimeFormatOptions = {}, amended: MaybeFalseOptions = {}) {
|
|
366
|
+
const options = Object.assign({}, optionsParam);
|
|
367
|
+
const props = [
|
|
368
|
+
'year',
|
|
369
|
+
'month',
|
|
370
|
+
'day',
|
|
371
|
+
'hour',
|
|
372
|
+
'minute',
|
|
373
|
+
'second',
|
|
374
|
+
'weekday',
|
|
375
|
+
'dayPeriod',
|
|
376
|
+
'timeZoneName',
|
|
377
|
+
'dateStyle',
|
|
378
|
+
'timeStyle'
|
|
379
|
+
] as const;
|
|
380
|
+
for (let i = 0; i < props.length; i++) {
|
|
381
|
+
const opt = props[i];
|
|
382
|
+
// TODO: can this be typed more cleanly?
|
|
383
|
+
type OptionMaybeFalse = (typeof options)[typeof opt] | false;
|
|
384
|
+
(options[opt] as OptionMaybeFalse) = opt in amended ? amended[opt] : options[opt];
|
|
385
|
+
if ((options[opt] as OptionMaybeFalse) === false || options[opt] === undefined) delete options[opt];
|
|
386
|
+
}
|
|
387
|
+
return options;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
type OptionsType<T extends TypesWithToLocaleString> = NonNullable<Parameters<T['toLocaleString']>[1]>;
|
|
391
|
+
|
|
392
|
+
function timeAmend(originalOptions: OptionsType<Temporal.PlainTime>) {
|
|
393
|
+
const options = amend(originalOptions, {
|
|
394
|
+
year: false,
|
|
395
|
+
month: false,
|
|
396
|
+
day: false,
|
|
397
|
+
weekday: false,
|
|
398
|
+
timeZoneName: false,
|
|
399
|
+
dateStyle: false
|
|
400
|
+
});
|
|
401
|
+
if (options.timeStyle === 'long' || options.timeStyle === 'full') {
|
|
402
|
+
// Try to fake what timeStyle should do if not printing the time zone name
|
|
403
|
+
delete options.timeStyle;
|
|
404
|
+
Object.assign(options, { hour: 'numeric', minute: '2-digit', second: '2-digit' });
|
|
405
|
+
}
|
|
406
|
+
if (!hasTimeOptions(options)) {
|
|
407
|
+
if (hasAnyDateTimeOptions(originalOptions)) {
|
|
408
|
+
throw new TypeError(`cannot format Temporal.PlainTime with options [${Object.keys(originalOptions)}]`);
|
|
409
|
+
}
|
|
410
|
+
Object.assign(options, {
|
|
411
|
+
hour: 'numeric',
|
|
412
|
+
minute: 'numeric',
|
|
413
|
+
second: 'numeric'
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
return options;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function yearMonthAmend(originalOptions: OptionsType<Temporal.PlainYearMonth>) {
|
|
420
|
+
// Try to fake what dateStyle should do for dates without a day. This is not
|
|
421
|
+
// accurate for locales that always print the era
|
|
422
|
+
const dateStyleHacks = {
|
|
423
|
+
short: { year: '2-digit', month: 'numeric' },
|
|
424
|
+
medium: { year: 'numeric', month: 'short' },
|
|
425
|
+
long: { year: 'numeric', month: 'long' },
|
|
426
|
+
full: { year: 'numeric', month: 'long' }
|
|
427
|
+
};
|
|
428
|
+
const options = amend(originalOptions, {
|
|
429
|
+
day: false,
|
|
430
|
+
hour: false,
|
|
431
|
+
minute: false,
|
|
432
|
+
second: false,
|
|
433
|
+
weekday: false,
|
|
434
|
+
dayPeriod: false,
|
|
435
|
+
timeZoneName: false,
|
|
436
|
+
timeStyle: false
|
|
437
|
+
});
|
|
438
|
+
if ('dateStyle' in options && options.dateStyle) {
|
|
439
|
+
const style = options.dateStyle;
|
|
440
|
+
delete options.dateStyle;
|
|
441
|
+
Object.assign(options, dateStyleHacks[style]);
|
|
442
|
+
}
|
|
443
|
+
if (!('year' in options || 'month' in options || 'era' in options)) {
|
|
444
|
+
if (hasAnyDateTimeOptions(originalOptions)) {
|
|
445
|
+
throw new TypeError(`cannot format PlainYearMonth with options [${Object.keys(originalOptions)}]`);
|
|
446
|
+
}
|
|
447
|
+
Object.assign(options, { year: 'numeric', month: 'numeric' });
|
|
448
|
+
}
|
|
449
|
+
return options;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
function monthDayAmend(originalOptions: OptionsType<Temporal.PlainMonthDay>) {
|
|
453
|
+
// Try to fake what dateStyle should do for dates without a day
|
|
454
|
+
const dateStyleHacks = {
|
|
455
|
+
short: { month: 'numeric', day: 'numeric' },
|
|
456
|
+
medium: { month: 'short', day: 'numeric' },
|
|
457
|
+
long: { month: 'long', day: 'numeric' },
|
|
458
|
+
full: { month: 'long', day: 'numeric' }
|
|
459
|
+
};
|
|
460
|
+
const options = amend(originalOptions, {
|
|
461
|
+
year: false,
|
|
462
|
+
hour: false,
|
|
463
|
+
minute: false,
|
|
464
|
+
second: false,
|
|
465
|
+
weekday: false,
|
|
466
|
+
dayPeriod: false,
|
|
467
|
+
timeZoneName: false,
|
|
468
|
+
timeStyle: false
|
|
469
|
+
});
|
|
470
|
+
if ('dateStyle' in options && options.dateStyle) {
|
|
471
|
+
const style = options.dateStyle;
|
|
472
|
+
delete options.dateStyle;
|
|
473
|
+
Object.assign(options, dateStyleHacks[style]);
|
|
474
|
+
}
|
|
475
|
+
if (!('month' in options || 'day' in options)) {
|
|
476
|
+
if (hasAnyDateTimeOptions(originalOptions)) {
|
|
477
|
+
throw new TypeError(`cannot format PlainMonthDay with options [${Object.keys(originalOptions)}]`);
|
|
478
|
+
}
|
|
479
|
+
Object.assign(options, { month: 'numeric', day: 'numeric' });
|
|
480
|
+
}
|
|
481
|
+
return options;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function dateAmend(originalOptions: OptionsType<Temporal.PlainDate>) {
|
|
485
|
+
const options = amend(originalOptions, {
|
|
486
|
+
hour: false,
|
|
487
|
+
minute: false,
|
|
488
|
+
second: false,
|
|
489
|
+
dayPeriod: false,
|
|
490
|
+
timeZoneName: false,
|
|
491
|
+
timeStyle: false
|
|
492
|
+
});
|
|
493
|
+
if (!hasDateOptions(options)) {
|
|
494
|
+
if (hasAnyDateTimeOptions(originalOptions)) {
|
|
495
|
+
throw new TypeError(`cannot format PlainDate with options [${Object.keys(originalOptions)}]`);
|
|
496
|
+
}
|
|
497
|
+
Object.assign(options, {
|
|
498
|
+
year: 'numeric',
|
|
499
|
+
month: 'numeric',
|
|
500
|
+
day: 'numeric'
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
return options;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
function datetimeAmend(originalOptions: OptionsType<Temporal.PlainDateTime>) {
|
|
507
|
+
const options = amend(originalOptions, { timeZoneName: false });
|
|
508
|
+
if (options.timeStyle === 'long' || options.timeStyle === 'full') {
|
|
509
|
+
// Try to fake what timeStyle should do if not printing the time zone name
|
|
510
|
+
delete options.timeStyle;
|
|
511
|
+
Object.assign(options, { hour: 'numeric', minute: '2-digit', second: '2-digit' });
|
|
512
|
+
|
|
513
|
+
// If moving to a fake timeStyle while dateStyle is present, we also have to
|
|
514
|
+
// move to a fake dateStyle. dateStyle is mutually exclusive with hour etc.
|
|
515
|
+
if (options.dateStyle) {
|
|
516
|
+
const dateStyleHacks = {
|
|
517
|
+
short: { year: 'numeric', month: 'numeric', day: 'numeric' },
|
|
518
|
+
medium: { year: 'numeric', month: 'short', day: 'numeric' },
|
|
519
|
+
long: { year: 'numeric', month: 'long', day: 'numeric' },
|
|
520
|
+
full: { year: 'numeric', month: 'long', day: 'numeric', weekday: 'long' }
|
|
521
|
+
};
|
|
522
|
+
Object.assign(options, dateStyleHacks[options.dateStyle]);
|
|
523
|
+
delete options.dateStyle;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
if (!hasTimeOptions(options) && !hasDateOptions(options)) {
|
|
527
|
+
if (hasAnyDateTimeOptions(originalOptions)) {
|
|
528
|
+
throw new TypeError(`cannot format PlainDateTime with options [${Object.keys(originalOptions)}]`);
|
|
529
|
+
}
|
|
530
|
+
Object.assign(options, {
|
|
531
|
+
year: 'numeric',
|
|
532
|
+
month: 'numeric',
|
|
533
|
+
day: 'numeric',
|
|
534
|
+
hour: 'numeric',
|
|
535
|
+
minute: 'numeric',
|
|
536
|
+
second: 'numeric'
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
return options;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
function instantAmend(optionsParam: OptionsType<Temporal.Instant>) {
|
|
543
|
+
let options = optionsParam;
|
|
544
|
+
if (!hasTimeOptions(options) && !hasDateOptions(options)) {
|
|
545
|
+
options = Object.assign({}, options, {
|
|
546
|
+
year: 'numeric',
|
|
547
|
+
month: 'numeric',
|
|
548
|
+
day: 'numeric',
|
|
549
|
+
hour: 'numeric',
|
|
550
|
+
minute: 'numeric',
|
|
551
|
+
second: 'numeric'
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
return options;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
function hasDateOptions(options: OptionsType<TypesWithToLocaleString>) {
|
|
558
|
+
return (
|
|
559
|
+
'year' in options ||
|
|
560
|
+
'month' in options ||
|
|
561
|
+
'day' in options ||
|
|
562
|
+
'weekday' in options ||
|
|
563
|
+
'dateStyle' in options ||
|
|
564
|
+
'era' in options
|
|
565
|
+
);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
function hasTimeOptions(options: OptionsType<TypesWithToLocaleString>) {
|
|
569
|
+
return (
|
|
570
|
+
'hour' in options ||
|
|
571
|
+
'minute' in options ||
|
|
572
|
+
'second' in options ||
|
|
573
|
+
'timeStyle' in options ||
|
|
574
|
+
'dayPeriod' in options ||
|
|
575
|
+
'fractionalSecondDigits' in options
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
function hasAnyDateTimeOptions(originalOptions: OptionsType<TypesWithToLocaleString>) {
|
|
580
|
+
return (
|
|
581
|
+
hasDateOptions(originalOptions) ||
|
|
582
|
+
hasTimeOptions(originalOptions) ||
|
|
583
|
+
'dateStyle' in originalOptions ||
|
|
584
|
+
'timeStyle' in originalOptions ||
|
|
585
|
+
'timeZoneName' in originalOptions
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
function isTemporalObject(
|
|
590
|
+
obj: unknown
|
|
591
|
+
): obj is
|
|
592
|
+
| Temporal.PlainDate
|
|
593
|
+
| Temporal.PlainTime
|
|
594
|
+
| Temporal.PlainDateTime
|
|
595
|
+
| Temporal.ZonedDateTime
|
|
596
|
+
| Temporal.PlainYearMonth
|
|
597
|
+
| Temporal.PlainMonthDay
|
|
598
|
+
| Temporal.Instant {
|
|
599
|
+
return (
|
|
600
|
+
ES.IsTemporalDate(obj) ||
|
|
601
|
+
ES.IsTemporalTime(obj) ||
|
|
602
|
+
ES.IsTemporalDateTime(obj) ||
|
|
603
|
+
ES.IsTemporalZonedDateTime(obj) ||
|
|
604
|
+
ES.IsTemporalYearMonth(obj) ||
|
|
605
|
+
ES.IsTemporalMonthDay(obj) ||
|
|
606
|
+
ES.IsTemporalInstant(obj)
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
function toDateTimeFormattable(value: unknown) {
|
|
611
|
+
if (isTemporalObject(value)) return value;
|
|
612
|
+
return ES.ToNumber(value);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
function sameTemporalType(x: unknown, y: unknown) {
|
|
616
|
+
if (!isTemporalObject(x) || !isTemporalObject(y)) return false;
|
|
617
|
+
if (ES.IsTemporalTime(x) && !ES.IsTemporalTime(y)) return false;
|
|
618
|
+
if (ES.IsTemporalDate(x) && !ES.IsTemporalDate(y)) return false;
|
|
619
|
+
if (ES.IsTemporalDateTime(x) && !ES.IsTemporalDateTime(y)) return false;
|
|
620
|
+
if (ES.IsTemporalZonedDateTime(x) && !ES.IsTemporalZonedDateTime(y)) return false;
|
|
621
|
+
if (ES.IsTemporalYearMonth(x) && !ES.IsTemporalYearMonth(y)) return false;
|
|
622
|
+
if (ES.IsTemporalMonthDay(x) && !ES.IsTemporalMonthDay(y)) return false;
|
|
623
|
+
if (ES.IsTemporalInstant(x) && !ES.IsTemporalInstant(y)) return false;
|
|
624
|
+
return true;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
type TypesWithToLocaleString =
|
|
628
|
+
| Temporal.PlainDateTime
|
|
629
|
+
| Temporal.PlainDate
|
|
630
|
+
| Temporal.PlainTime
|
|
631
|
+
| Temporal.PlainYearMonth
|
|
632
|
+
| Temporal.PlainMonthDay
|
|
633
|
+
| Temporal.ZonedDateTime
|
|
634
|
+
| Temporal.Instant;
|
|
635
|
+
|
|
636
|
+
function extractOverrides(temporalObj: Params['format'][0], main: DateTimeFormatImpl) {
|
|
637
|
+
if (ES.IsTemporalTime(temporalObj)) {
|
|
638
|
+
const isoDateTime = {
|
|
639
|
+
isoDate: { year: 1970, month: 1, day: 1 },
|
|
640
|
+
time: GetSlot(temporalObj, TIME)
|
|
641
|
+
};
|
|
642
|
+
return {
|
|
643
|
+
epochNs: ES.GetEpochNanosecondsFor(GetSlot(main, TZ_CANONICAL), isoDateTime, 'compatible'),
|
|
644
|
+
formatter: getSlotLazy(main, TIME_FMT)
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
if (ES.IsTemporalYearMonth(temporalObj)) {
|
|
649
|
+
const calendar = GetSlot(temporalObj, CALENDAR);
|
|
650
|
+
const mainCalendar = GetSlot(main, CAL_ID);
|
|
651
|
+
if (calendar !== mainCalendar) {
|
|
652
|
+
throw new RangeError(
|
|
653
|
+
`cannot format PlainYearMonth with calendar ${calendar} in locale with calendar ${mainCalendar}`
|
|
654
|
+
);
|
|
655
|
+
}
|
|
656
|
+
const isoDateTime = ES.CombineISODateAndTimeRecord(GetSlot(temporalObj, ISO_DATE), ES.NoonTimeRecord());
|
|
657
|
+
return {
|
|
658
|
+
epochNs: ES.GetEpochNanosecondsFor(GetSlot(main, TZ_CANONICAL), isoDateTime, 'compatible'),
|
|
659
|
+
formatter: getSlotLazy(main, YM)
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
if (ES.IsTemporalMonthDay(temporalObj)) {
|
|
664
|
+
const calendar = GetSlot(temporalObj, CALENDAR);
|
|
665
|
+
const mainCalendar = GetSlot(main, CAL_ID);
|
|
666
|
+
if (calendar !== mainCalendar) {
|
|
667
|
+
throw new RangeError(
|
|
668
|
+
`cannot format PlainMonthDay with calendar ${calendar} in locale with calendar ${mainCalendar}`
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
const isoDateTime = ES.CombineISODateAndTimeRecord(GetSlot(temporalObj, ISO_DATE), ES.NoonTimeRecord());
|
|
672
|
+
return {
|
|
673
|
+
epochNs: ES.GetEpochNanosecondsFor(GetSlot(main, TZ_CANONICAL), isoDateTime, 'compatible'),
|
|
674
|
+
formatter: getSlotLazy(main, MD)
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
if (ES.IsTemporalDate(temporalObj)) {
|
|
679
|
+
const calendar = GetSlot(temporalObj, CALENDAR);
|
|
680
|
+
const mainCalendar = GetSlot(main, CAL_ID);
|
|
681
|
+
if (calendar !== 'iso8601' && calendar !== mainCalendar) {
|
|
682
|
+
throw new RangeError(`cannot format PlainDate with calendar ${calendar} in locale with calendar ${mainCalendar}`);
|
|
683
|
+
}
|
|
684
|
+
const isoDateTime = ES.CombineISODateAndTimeRecord(GetSlot(temporalObj, ISO_DATE), ES.NoonTimeRecord());
|
|
685
|
+
return {
|
|
686
|
+
epochNs: ES.GetEpochNanosecondsFor(GetSlot(main, TZ_CANONICAL), isoDateTime, 'compatible'),
|
|
687
|
+
formatter: getSlotLazy(main, DATE)
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
if (ES.IsTemporalDateTime(temporalObj)) {
|
|
692
|
+
const calendar = GetSlot(temporalObj, CALENDAR);
|
|
693
|
+
const mainCalendar = GetSlot(main, CAL_ID);
|
|
694
|
+
if (calendar !== 'iso8601' && calendar !== mainCalendar) {
|
|
695
|
+
throw new RangeError(
|
|
696
|
+
`cannot format PlainDateTime with calendar ${calendar} in locale with calendar ${mainCalendar}`
|
|
697
|
+
);
|
|
698
|
+
}
|
|
699
|
+
const isoDateTime = GetSlot(temporalObj, ISO_DATE_TIME);
|
|
700
|
+
return {
|
|
701
|
+
epochNs: ES.GetEpochNanosecondsFor(GetSlot(main, TZ_CANONICAL), isoDateTime, 'compatible'),
|
|
702
|
+
formatter: getSlotLazy(main, DATETIME)
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
if (ES.IsTemporalZonedDateTime(temporalObj)) {
|
|
707
|
+
throw new TypeError(
|
|
708
|
+
'Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.'
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
if (ES.IsTemporalInstant(temporalObj)) {
|
|
713
|
+
return {
|
|
714
|
+
epochNs: GetSlot(temporalObj, EPOCHNANOSECONDS),
|
|
715
|
+
formatter: getSlotLazy(main, INST)
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
return {};
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
function temporalDurationToCompatibilityRecord(duration: Temporal.Duration) {
|
|
723
|
+
const record = Object.create(null);
|
|
724
|
+
record.years = GetSlot(duration, YEARS);
|
|
725
|
+
record.months = GetSlot(duration, MONTHS);
|
|
726
|
+
record.weeks = GetSlot(duration, WEEKS);
|
|
727
|
+
record.days = GetSlot(duration, DAYS);
|
|
728
|
+
record.hours = GetSlot(duration, HOURS);
|
|
729
|
+
record.minutes = GetSlot(duration, MINUTES);
|
|
730
|
+
record.seconds = GetSlot(duration, SECONDS);
|
|
731
|
+
record.milliseconds = GetSlot(duration, MILLISECONDS);
|
|
732
|
+
record.microseconds = GetSlot(duration, MICROSECONDS);
|
|
733
|
+
record.nanoseconds = GetSlot(duration, NANOSECONDS);
|
|
734
|
+
return record;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
const { format: IntlDurationFormatPrototypeFormat, formatToParts: IntlDurationFormatPrototypeFormatToParts } =
|
|
738
|
+
Intl.DurationFormat?.prototype ?? Object.create(null);
|
|
739
|
+
|
|
740
|
+
export function ModifiedIntlDurationFormatPrototypeFormat(
|
|
741
|
+
this: Intl.DurationFormat,
|
|
742
|
+
durationLike: Temporal.DurationLike
|
|
743
|
+
) {
|
|
744
|
+
Intl.DurationFormat.prototype.resolvedOptions.call(this); // brand check
|
|
745
|
+
const duration = ES.ToTemporalDuration(durationLike);
|
|
746
|
+
const record = temporalDurationToCompatibilityRecord(duration);
|
|
747
|
+
return IntlDurationFormatPrototypeFormat.call(this, record);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
if (Intl.DurationFormat?.prototype) {
|
|
751
|
+
Intl.DurationFormat.prototype.format = ModifiedIntlDurationFormatPrototypeFormat;
|
|
752
|
+
Intl.DurationFormat.prototype.formatToParts = function formatToParts(durationLike: Temporal.DurationLike) {
|
|
753
|
+
Intl.DurationFormat.prototype.resolvedOptions.call(this); // brand check
|
|
754
|
+
const duration = ES.ToTemporalDuration(durationLike);
|
|
755
|
+
const record = temporalDurationToCompatibilityRecord(duration);
|
|
756
|
+
return IntlDurationFormatPrototypeFormatToParts.call(this, record);
|
|
757
|
+
};
|
|
758
|
+
}
|