@jsenv/core 27.0.0-alpha.0 → 27.0.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/package.json +3 -3
  2. package/src/build/build.js +208 -78
  3. package/src/build/build_urls_generator.js +16 -7
  4. package/src/build/inject_service_worker_urls.js +25 -0
  5. package/src/build/inject_version_mappings.js +4 -3
  6. package/src/build/plugins/bundle_js_module/jsenv_plugin_bundle_js_module.js +16 -14
  7. package/src/dev/start_dev_server.js +6 -3
  8. package/src/execute/execute.js +7 -1
  9. package/src/omega/core_plugins/babel/{babel_helper → helpers}/babel_plugin_babel_helpers_as_jsenv_imports.js +1 -2
  10. package/src/omega/core_plugins/babel/helpers/babel_plugin_structure.js +69 -80
  11. package/src/omega/core_plugins/babel/jsenv_plugin_babel.js +19 -5
  12. package/src/omega/core_plugins/html_supervisor/client/uneval_exception.js +1 -1
  13. package/src/omega/core_plugins/html_supervisor/jsenv_plugin_html_supervisor.js +1 -1
  14. package/src/omega/core_plugins/import_meta_scenarios/jsenv_plugin_import_meta_scenarios.js +16 -6
  15. package/src/omega/core_plugins/importmap/jsenv_plugin_importmap.js +1 -1
  16. package/src/omega/core_plugins/inject_globals/jsenv_plugin_inject_globals.js +27 -0
  17. package/src/omega/core_plugins/inline/jsenv_plugin_js_and_css_inside_html.js +1 -1
  18. package/src/omega/core_plugins/inline/jsenv_plugin_new_inline_content.js +1 -4
  19. package/src/omega/core_plugins.js +3 -0
  20. package/src/omega/file_url_converter.js +8 -50
  21. package/src/omega/kitchen.js +14 -15
  22. package/src/omega/runtime_support/features_compatibility.js +40 -1
  23. package/src/omega/runtime_support/runtime_support.js +48 -16
  24. package/src/omega/url_graph/url_graph_load.js +1 -0
  25. package/src/omega/url_graph.js +1 -0
  26. package/src/omega/url_mentions/worker_classic_url_mentions.js +1 -1
  27. package/src/test/execute_plan.js +5 -3
  28. package/src/test/execute_test_plan.js +11 -1
  29. package/src/omega/core_plugins/babel/babel_helper/babel_helper_directory.js +0 -29
  30. package/src/omega/core_plugins/babel/babel_helper/client/.eslintrc.cjs +0 -24
  31. package/src/omega/core_plugins/babel/babel_helper/client/AsyncGenerator/AsyncGenerator.js +0 -81
  32. package/src/omega/core_plugins/babel/babel_helper/client/AwaitValue/AwaitValue.js +0 -3
  33. package/src/omega/core_plugins/babel/babel_helper/client/applyDecoratorDescriptor/applyDecoratorDescriptor.js +0 -33
  34. package/src/omega/core_plugins/babel/babel_helper/client/arrayLikeToArray/arrayLikeToArray.js +0 -7
  35. package/src/omega/core_plugins/babel/babel_helper/client/arrayWithHoles/arrayWithHoles.js +0 -4
  36. package/src/omega/core_plugins/babel/babel_helper/client/arrayWithoutHoles/arrayWithoutHoles.js +0 -6
  37. package/src/omega/core_plugins/babel/babel_helper/client/assertThisInitialized/assertThisInitialized.js +0 -7
  38. package/src/omega/core_plugins/babel/babel_helper/client/asyncGeneratorDelegate/asyncGeneratorDelegate.js +0 -40
  39. package/src/omega/core_plugins/babel/babel_helper/client/asyncIterator/asyncIterator.js +0 -65
  40. package/src/omega/core_plugins/babel/babel_helper/client/asyncToGenerator/asyncToGenerator.js +0 -34
  41. package/src/omega/core_plugins/babel/babel_helper/client/awaitAsyncGenerator/awaitAsyncGenerator.js +0 -5
  42. package/src/omega/core_plugins/babel/babel_helper/client/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +0 -20
  43. package/src/omega/core_plugins/babel/babel_helper/client/classApplyDescriptorGet/classApplyDescriptorGet.js +0 -6
  44. package/src/omega/core_plugins/babel/babel_helper/client/classApplyDescriptorSet/classApplyDescriptorSet.js +0 -13
  45. package/src/omega/core_plugins/babel/babel_helper/client/classCallCheck/classCallCheck.js +0 -5
  46. package/src/omega/core_plugins/babel/babel_helper/client/classCheckPrivateStaticAccess/classCheckPrivateStaticAccess.js +0 -5
  47. package/src/omega/core_plugins/babel/babel_helper/client/classCheckPrivateStaticFieldDescriptor/classCheckPrivateStaticFieldDescriptor.js +0 -6
  48. package/src/omega/core_plugins/babel/babel_helper/client/classExtractFieldDescriptor/classExtractFieldDescriptor.js +0 -7
  49. package/src/omega/core_plugins/babel/babel_helper/client/classNameTDZError/classNameTDZError.js +0 -4
  50. package/src/omega/core_plugins/babel/babel_helper/client/classPrivateFieldDestructureSet/classPrivateFieldDestructureSet.js +0 -7
  51. package/src/omega/core_plugins/babel/babel_helper/client/classPrivateFieldGet/classPrivateFieldGet.js +0 -7
  52. package/src/omega/core_plugins/babel/babel_helper/client/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +0 -6
  53. package/src/omega/core_plugins/babel/babel_helper/client/classPrivateFieldLooseKey/classPrivateFieldLooseKey.js +0 -5
  54. package/src/omega/core_plugins/babel/babel_helper/client/classPrivateFieldSet/classPrivateFieldSet.js +0 -8
  55. package/src/omega/core_plugins/babel/babel_helper/client/classPrivateMethodGet/classPrivateMethodGet.js +0 -6
  56. package/src/omega/core_plugins/babel/babel_helper/client/classPrivateMethodSet/classPrivateMethodSet.js +0 -3
  57. package/src/omega/core_plugins/babel/babel_helper/client/classStaticPrivateFieldSpecGet/classStaticPrivateFieldSpecGet.js +0 -9
  58. package/src/omega/core_plugins/babel/babel_helper/client/classStaticPrivateFieldSpecSet/classStaticPrivateFieldSpecSet.js +0 -15
  59. package/src/omega/core_plugins/babel/babel_helper/client/classStaticPrivateMethodGet/classStaticPrivateMethodGet.js +0 -6
  60. package/src/omega/core_plugins/babel/babel_helper/client/classStaticPrivateMethodSet/classStaticPrivateMethodSet.js +0 -3
  61. package/src/omega/core_plugins/babel/babel_helper/client/construct/construct.js +0 -16
  62. package/src/omega/core_plugins/babel/babel_helper/client/createClass/createClass.js +0 -15
  63. package/src/omega/core_plugins/babel/babel_helper/client/createForOfIteratorHelper/createForOfIteratorHelper.js +0 -60
  64. package/src/omega/core_plugins/babel/babel_helper/client/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +0 -23
  65. package/src/omega/core_plugins/babel/babel_helper/client/createRawReactElement/createRawReactElement.js +0 -50
  66. package/src/omega/core_plugins/babel/babel_helper/client/createSuper/createSuper.js +0 -22
  67. package/src/omega/core_plugins/babel/babel_helper/client/decorate/decorate.js +0 -403
  68. package/src/omega/core_plugins/babel/babel_helper/client/defaults/defaults.js +0 -11
  69. package/src/omega/core_plugins/babel/babel_helper/client/defineEnumerableProperties/defineEnumerableProperties.js +0 -23
  70. package/src/omega/core_plugins/babel/babel_helper/client/defineProperty/defineProperty.js +0 -18
  71. package/src/omega/core_plugins/babel/babel_helper/client/extends/extends.js +0 -14
  72. package/src/omega/core_plugins/babel/babel_helper/client/get/get.js +0 -19
  73. package/src/omega/core_plugins/babel/babel_helper/client/getPrototypeOf/getPrototypeOf.js +0 -4
  74. package/src/omega/core_plugins/babel/babel_helper/client/inherits/inherits.js +0 -19
  75. package/src/omega/core_plugins/babel/babel_helper/client/inheritsLoose/inheritsLoose.js +0 -7
  76. package/src/omega/core_plugins/babel/babel_helper/client/initializerDefineProperty/initializerDefineProperty.js +0 -10
  77. package/src/omega/core_plugins/babel/babel_helper/client/initializerWarningHelper/initializerWarningHelper.js +0 -6
  78. package/src/omega/core_plugins/babel/babel_helper/client/instanceof/instanceof.js +0 -6
  79. package/src/omega/core_plugins/babel/babel_helper/client/interopRequireDefault/interopRequireDefault.js +0 -3
  80. package/src/omega/core_plugins/babel/babel_helper/client/interopRequireWildcard/interopRequireWildcard.js +0 -37
  81. package/src/omega/core_plugins/babel/babel_helper/client/isNativeFunction/isNativeFunction.js +0 -4
  82. package/src/omega/core_plugins/babel/babel_helper/client/isNativeReflectConstruct/isNativeReflectConstruct.js +0 -21
  83. package/src/omega/core_plugins/babel/babel_helper/client/iterableToArray/iterableToArray.js +0 -7
  84. package/src/omega/core_plugins/babel/babel_helper/client/iterableToArrayLimit/iterableToArrayLimit.js +0 -36
  85. package/src/omega/core_plugins/babel/babel_helper/client/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +0 -10
  86. package/src/omega/core_plugins/babel/babel_helper/client/jsx/jsx.js +0 -50
  87. package/src/omega/core_plugins/babel/babel_helper/client/maybeArrayLike/maybeArrayLike.js +0 -10
  88. package/src/omega/core_plugins/babel/babel_helper/client/newArrowCheck/newArrowCheck.js +0 -5
  89. package/src/omega/core_plugins/babel/babel_helper/client/nonIterableRest/nonIterableRest.js +0 -5
  90. package/src/omega/core_plugins/babel/babel_helper/client/nonIterableSpread/nonIterableSpread.js +0 -5
  91. package/src/omega/core_plugins/babel/babel_helper/client/objectDestructuringEmpty/objectDestructuringEmpty.js +0 -3
  92. package/src/omega/core_plugins/babel/babel_helper/client/objectSpread/objectSpread.js +0 -23
  93. package/src/omega/core_plugins/babel/babel_helper/client/objectSpread2/objectSpread2.js +0 -41
  94. package/src/omega/core_plugins/babel/babel_helper/client/objectWithoutProperties/objectWithoutProperties.js +0 -19
  95. package/src/omega/core_plugins/babel/babel_helper/client/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +0 -13
  96. package/src/omega/core_plugins/babel/babel_helper/client/possibleConstructorReturn/possibleConstructorReturn.js +0 -10
  97. package/src/omega/core_plugins/babel/babel_helper/client/readOnlyError/readOnlyError.js +0 -4
  98. package/src/omega/core_plugins/babel/babel_helper/client/readme.md +0 -8
  99. package/src/omega/core_plugins/babel/babel_helper/client/set/set.js +0 -44
  100. package/src/omega/core_plugins/babel/babel_helper/client/setPrototypeOf/setPrototypeOf.js +0 -6
  101. package/src/omega/core_plugins/babel/babel_helper/client/skipFirstGeneratorNext/skipFirstGeneratorNext.js +0 -8
  102. package/src/omega/core_plugins/babel/babel_helper/client/slicedToArray/slicedToArray.js +0 -10
  103. package/src/omega/core_plugins/babel/babel_helper/client/slicedToArrayLoose/slicedToArrayLoose.js +0 -13
  104. package/src/omega/core_plugins/babel/babel_helper/client/superPropBase/superPropBase.js +0 -10
  105. package/src/omega/core_plugins/babel/babel_helper/client/taggedTemplateLiteral/taggedTemplateLiteral.js +0 -10
  106. package/src/omega/core_plugins/babel/babel_helper/client/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +0 -7
  107. package/src/omega/core_plugins/babel/babel_helper/client/tdz/tdz.js +0 -4
  108. package/src/omega/core_plugins/babel/babel_helper/client/temporalRef/temporalRef.js +0 -6
  109. package/src/omega/core_plugins/babel/babel_helper/client/temporalUndefined/temporalUndefined.js +0 -3
  110. package/src/omega/core_plugins/babel/babel_helper/client/toArray/toArray.js +0 -10
  111. package/src/omega/core_plugins/babel/babel_helper/client/toConsumableArray/toConsumableArray.js +0 -10
  112. package/src/omega/core_plugins/babel/babel_helper/client/toPrimitive/toPrimitive.js +0 -10
  113. package/src/omega/core_plugins/babel/babel_helper/client/toPropertyKey/toPropertyKey.js +0 -6
  114. package/src/omega/core_plugins/babel/babel_helper/client/typeof/typeof.js +0 -14
  115. package/src/omega/core_plugins/babel/babel_helper/client/unsupportedIterableToArray/unsupportedIterableToArray.js +0 -12
  116. package/src/omega/core_plugins/babel/babel_helper/client/wrapAsyncGenerator/wrapAsyncGenerator.js +0 -8
  117. package/src/omega/core_plugins/babel/babel_helper/client/wrapNativeSuper/wrapNativeSuper.js +0 -30
  118. package/src/omega/core_plugins/babel/babel_helper/client/wrapRegExp/wrapRegExp.js +0 -63
  119. package/src/omega/core_plugins/babel/babel_helper/client/writeOnlyError/writeOnlyError.js +0 -4
@@ -1,4 +1,4 @@
1
- export const featuresCompatMap = {
1
+ export const featureCompats = {
2
2
  script_type_module: {
3
3
  edge: "16",
4
4
  firefox: "60",
@@ -52,6 +52,7 @@ export const featuresCompatMap = {
52
52
  chrome: "93",
53
53
  edge: "93",
54
54
  },
55
+ import_type_text: {},
55
56
  // https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet#browser_compatibility
56
57
  new_stylesheet: {
57
58
  chrome: "73",
@@ -59,6 +60,33 @@ export const featuresCompatMap = {
59
60
  opera: "53",
60
61
  android: "73",
61
62
  },
63
+ // https://caniuse.com/?search=worker
64
+ worker: {
65
+ ie: "10",
66
+ edge: "12",
67
+ firefox: "3.5",
68
+ chrome: "4",
69
+ opera: "11.5",
70
+ safari: "4",
71
+ ios: "5",
72
+ android: "4.4",
73
+ },
74
+ service_worker: {
75
+ edge: "17",
76
+ firefox: "44",
77
+ chrome: "40",
78
+ safari: "11.1",
79
+ opera: "27",
80
+ ios: "11.3",
81
+ android: "12.12",
82
+ },
83
+ service_worker_type_module: {
84
+ chrome: "80",
85
+ edge: "80",
86
+ opera: "67",
87
+ android: "80",
88
+ },
89
+ // https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker#browser_compatibility
62
90
  worker_type_module: {
63
91
  chrome: "80",
64
92
  edge: "80",
@@ -88,4 +116,15 @@ export const featuresCompatMap = {
88
116
  samsung: "8",
89
117
  electron: "3",
90
118
  },
119
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#browser_compatibility
120
+ template_literals: {
121
+ chrome: "41",
122
+ edge: "12",
123
+ firefox: "34",
124
+ opera: "28",
125
+ safari: "9",
126
+ ios: "9",
127
+ android: "4",
128
+ node: "4",
129
+ },
91
130
  }
@@ -1,20 +1,52 @@
1
1
  import { findHighestVersion } from "@jsenv/utils/semantic_versioning/highest_version.js"
2
+ import { featureCompats } from "./features_compatibility.js"
2
3
 
3
- export const isFeatureSupportedOnRuntimes = (
4
- runtimeSupport,
5
- featureCompat = {},
6
- ) => {
7
- const runtimeNames = Object.keys(runtimeSupport)
8
- return runtimeNames.every((runtimeName) => {
9
- const runtimeVersion = runtimeSupport[runtimeName]
10
- const runtimeVersionCompatible = featureCompat[runtimeName] || "Infinity"
11
- const highestVersion = findHighestVersion(
12
- runtimeVersion,
13
- runtimeVersionCompatible,
14
- )
15
- if (highestVersion !== runtimeVersion) {
16
- return false
4
+ export const RUNTIME_SUPPORT = {
5
+ featureCompats,
6
+
7
+ add: (originalRuntimeSupport, feature) => {
8
+ const featureCompat = getFeatureCompat(feature)
9
+ const runtimeSupport = {
10
+ ...originalRuntimeSupport,
11
+ }
12
+ Object.keys(featureCompat).forEach((runtimeName) => {
13
+ const firstVersion = originalRuntimeSupport[runtimeName]
14
+ const secondVersion = featureCompat[runtimeName]
15
+ runtimeSupport[runtimeName] = firstVersion
16
+ ? findHighestVersion(firstVersion, secondVersion)
17
+ : secondVersion
18
+ })
19
+ return runtimeSupport
20
+ },
21
+
22
+ isSupported: (runtimeSupport, feature) => {
23
+ const featureCompat = getFeatureCompat(feature)
24
+ const runtimeNames = Object.keys(runtimeSupport)
25
+ return runtimeNames.every((runtimeName) => {
26
+ const runtimeVersion = runtimeSupport[runtimeName]
27
+ const runtimeVersionCompatible = featureCompat[runtimeName] || "Infinity"
28
+ const highestVersion = findHighestVersion(
29
+ runtimeVersion,
30
+ runtimeVersionCompatible,
31
+ )
32
+ if (highestVersion !== runtimeVersion) {
33
+ return false
34
+ }
35
+ return true
36
+ })
37
+ },
38
+ }
39
+
40
+ const getFeatureCompat = (feature) => {
41
+ if (typeof feature === "string") {
42
+ const compat = featureCompats[feature]
43
+ if (!compat) {
44
+ throw new Error(`"${feature}" feature is unknown`)
17
45
  }
18
- return true
19
- })
46
+ return compat
47
+ }
48
+ if (typeof feature !== "object") {
49
+ throw new TypeError(`feature must be a string or an object, got ${feature}`)
50
+ }
51
+ return feature
20
52
  }
@@ -52,6 +52,7 @@ export const loadUrlGraph = async ({
52
52
  reference: entryReference,
53
53
  urlInfo: entryUrlInfo,
54
54
  })
55
+ return [entryReference, entryUrlInfo]
55
56
  },
56
57
  )
57
58
 
@@ -125,6 +125,7 @@ const createUrlInfo = (url) => {
125
125
  sourcemap: null,
126
126
  sourcemapReference: null,
127
127
  type: "",
128
+ subtype: "",
128
129
  references: [],
129
130
  dependencies: new Set(),
130
131
  dependents: new Set(),
@@ -1,4 +1,4 @@
1
- import { createMagicSource } from "@jsenv/core/packages/utils/sourcemap/magic_source.js"
1
+ import { createMagicSource } from "@jsenv/utils/sourcemap/magic_source.js"
2
2
 
3
3
  export const jsenvPluginImportScriptsBundler = () => {
4
4
  return {
@@ -62,9 +62,10 @@ export const executePlan = async (
62
62
  coverageV8ConflictWarning,
63
63
  coverageTempDirectoryRelativeUrl,
64
64
 
65
- plugins = [],
66
- scenario = "test",
67
- sourcemaps = "inline",
65
+ injectedGlobals,
66
+ plugins,
67
+ scenario,
68
+ sourcemaps,
68
69
 
69
70
  protocol,
70
71
  privateKey,
@@ -151,6 +152,7 @@ export const executePlan = async (
151
152
  return {}
152
153
  },
153
154
  },
155
+ injectedGlobals,
154
156
  }),
155
157
  ],
156
158
  scenario,
@@ -80,6 +80,11 @@ export const executeTestPlan = async ({
80
80
  // skip full means file with 100% coverage won't appear in coverage reports (log and html)
81
81
  coverageSkipFull = false,
82
82
 
83
+ injectedGlobals,
84
+ plugins = [],
85
+ scenario = "test",
86
+ sourcemaps = "inline",
87
+
83
88
  protocol,
84
89
  privateKey,
85
90
  certificate,
@@ -143,8 +148,8 @@ export const executeTestPlan = async ({
143
148
  logFileRelativeUrl,
144
149
  completedExecutionLogMerging,
145
150
  completedExecutionLogAbbreviation,
146
-
147
151
  rootDirectoryUrl,
152
+
148
153
  maxExecutionsInParallel,
149
154
  defaultMsAllocatedPerExecution,
150
155
  failFast,
@@ -159,6 +164,11 @@ export const executeTestPlan = async ({
159
164
  coverageV8ConflictWarning,
160
165
  coverageTempDirectoryRelativeUrl,
161
166
 
167
+ injectedGlobals,
168
+ plugins,
169
+ scenario,
170
+ sourcemaps,
171
+
162
172
  protocol,
163
173
  privateKey,
164
174
  certificate,
@@ -1,29 +0,0 @@
1
- // https://github.com/babel/babel/blob/99f4f6c3b03c7f3f67cf1b9f1a21b80cfd5b0224/packages/babel-core/src/tools/build-external-helpers.js
2
- // the list of possible helpers:
3
- // https://github.com/babel/babel/blob/99f4f6c3b03c7f3f67cf1b9f1a21b80cfd5b0224/packages/babel-helpers/src/helpers.js#L13
4
-
5
- const babelHelperClientDirectoryUrl = new URL("./client/", import.meta.url).href
6
-
7
- // we cannot use "@jsenv/core/src/*" because babel helper might be injected
8
- // into node_modules not depending on "@jsenv/core"
9
- export const getBabelHelperFileUrl = (babelHelperName) => {
10
- const babelHelperFileUrl = new URL(
11
- `./${babelHelperName}/${babelHelperName}.js`,
12
- babelHelperClientDirectoryUrl,
13
- ).href
14
- return babelHelperFileUrl
15
- }
16
-
17
- export const babelHelperNameFromUrl = (url) => {
18
- if (!url.startsWith(babelHelperClientDirectoryUrl)) {
19
- return null
20
- }
21
- const afterBabelHelperDirectory = url.slice(
22
- babelHelperClientDirectoryUrl.length,
23
- )
24
- const babelHelperName = afterBabelHelperDirectory.slice(
25
- 0,
26
- afterBabelHelperDirectory.indexOf("/"),
27
- )
28
- return babelHelperName
29
- }
@@ -1,24 +0,0 @@
1
- const eslintConfig = require("../../.eslintrc.cjs")
2
-
3
- // babel helpers are copy pasted from the babel repository
4
- Object.assign(eslintConfig.rules, {
5
- "eqeqeq": ["off"],
6
- "no-eq-null": ["off"],
7
- "no-undef-init": ["off"],
8
- "dot-notation": ["off"],
9
- "consistent-return": ["off"],
10
- "one-var": ["off"],
11
- "object-shorthand": ["off"],
12
- "no-return-assign": ["off"],
13
- "prefer-template": ["off"],
14
- "prefer-rest-params": ["off"],
15
- "no-void": ["off"],
16
- "no-implicit-coercion": ["off"],
17
- "prefer-spread": ["off"],
18
- "no-loop-func": ["off"],
19
- "no-negated-condition": ["off"],
20
- "no-func-assign": ["off"],
21
- "no-else-return": ["off"],
22
- })
23
-
24
- module.exports = eslintConfig
@@ -1,81 +0,0 @@
1
- import AwaitValue from "../AwaitValue/AwaitValue.js"
2
-
3
- export default function AsyncGenerator(gen) {
4
- var front, back
5
- function send(key, arg) {
6
- return new Promise(function (resolve, reject) {
7
- var request = {
8
- key: key,
9
- arg: arg,
10
- resolve: resolve,
11
- reject: reject,
12
- next: null,
13
- }
14
- if (back) {
15
- back = back.next = request
16
- } else {
17
- front = back = request
18
- resume(key, arg)
19
- }
20
- })
21
- }
22
- function resume(key, arg) {
23
- try {
24
- var result = gen[key](arg)
25
- var value = result.value
26
- var wrappedAwait = value instanceof AwaitValue
27
- Promise.resolve(wrappedAwait ? value.wrapped : value).then(
28
- function (arg) {
29
- if (wrappedAwait) {
30
- resume(key === "return" ? "return" : "next", arg)
31
- return
32
- }
33
- settle(result.done ? "return" : "normal", arg)
34
- },
35
- function (err) {
36
- resume("throw", err)
37
- },
38
- )
39
- } catch (err) {
40
- settle("throw", err)
41
- }
42
- }
43
- function settle(type, value) {
44
- switch (type) {
45
- case "return":
46
- front.resolve({ value: value, done: true })
47
- break
48
- case "throw":
49
- front.reject(value)
50
- break
51
- default:
52
- front.resolve({ value: value, done: false })
53
- break
54
- }
55
- front = front.next
56
- if (front) {
57
- resume(front.key, front.arg)
58
- } else {
59
- back = null
60
- }
61
- }
62
- this._invoke = send
63
- // Hide "return" method if generator return is not supported
64
- if (typeof gen.return !== "function") {
65
- this.return = undefined
66
- }
67
- }
68
- AsyncGenerator.prototype[
69
- (typeof Symbol === "function" && Symbol.asyncIterator) || "@@asyncIterator"
70
- ] = function () {
71
- return this
72
- }
73
- AsyncGenerator.prototype.next = function (arg) {
74
- return this._invoke("next", arg)
75
- }
76
- AsyncGenerator.prototype.throw = function (arg) {
77
- return this._invoke("throw", arg)
78
- }
79
- AsyncGenerator.prototype.return = function (arg) {
80
- return this._invoke("return", arg)
81
- }
@@ -1,3 +0,0 @@
1
- export default function _AwaitValue (value) {
2
- this.wrapped = value
3
- }
@@ -1,33 +0,0 @@
1
- /* eslint-disable no-void */
2
- export default function _applyDecoratedDescriptor(
3
- target,
4
- property,
5
- decorators,
6
- descriptor,
7
- context,
8
- ) {
9
- var desc = {}
10
- Object.keys(descriptor).forEach(function (key) {
11
- desc[key] = descriptor[key]
12
- })
13
- desc.enumerable = Boolean(desc.enumerable)
14
- desc.configurable = Boolean(desc.configurable)
15
- if ("value" in desc || desc.initializer) {
16
- desc.writable = true
17
- }
18
- desc = decorators
19
- .slice()
20
- .reverse()
21
- .reduce(function (desc, decorator) {
22
- return decorator(target, property, desc) || desc
23
- }, desc)
24
- if (context && desc.initializer !== void 0) {
25
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0
26
- desc.initializer = undefined
27
- }
28
- if (desc.initializer === void 0) {
29
- Object.defineProperty(target, property, desc)
30
- desc = null
31
- }
32
- return desc
33
- }
@@ -1,7 +0,0 @@
1
- /* eslint-disable no-eq-null, eqeqeq */
2
- export default function arrayLikeToArray(arr, len) {
3
- if (len == null || len > arr.length) len = arr.length
4
- var arr2 = new Array(len)
5
- for (var i = 0; i < len; i++) arr2[i] = arr[i]
6
- return arr2
7
- }
@@ -1,4 +0,0 @@
1
- // eslint-disable-next-line consistent-return
2
- export default (arr) => {
3
- if (Array.isArray(arr)) return arr
4
- }
@@ -1,6 +0,0 @@
1
- import arrayLikeToArray from "../arrayLikeToArray/arrayLikeToArray.js"
2
-
3
- // eslint-disable-next-line consistent-return
4
- export default (arr) => {
5
- if (Array.isArray(arr)) return arrayLikeToArray(arr)
6
- }
@@ -1,7 +0,0 @@
1
- export default (self) => {
2
- // eslint-disable-next-line no-void
3
- if (self === void 0) {
4
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called")
5
- }
6
- return self
7
- }
@@ -1,40 +0,0 @@
1
- export default function _asyncGeneratorDelegate(inner, awaitWrap) {
2
- var iter = {},
3
- waiting = false
4
- function pump(key, value) {
5
- waiting = true
6
- value = new Promise(function (resolve) {
7
- resolve(inner[key](value))
8
- })
9
- return { done: false, value: awaitWrap(value) }
10
- }
11
- iter[(typeof Symbol !== "undefined" && Symbol.iterator) || "@@iterator"] = function () {
12
- return this
13
- }
14
- iter.next = function (value) {
15
- if (waiting) {
16
- waiting = false
17
- return value
18
- }
19
- return pump("next", value)
20
- }
21
- if (typeof inner.throw === "function") {
22
- iter.throw = function (value) {
23
- if (waiting) {
24
- waiting = false
25
- throw value
26
- }
27
- return pump("throw", value)
28
- }
29
- }
30
- if (typeof inner.return === "function") {
31
- iter.return = function (value) {
32
- if (waiting) {
33
- waiting = false
34
- return value
35
- }
36
- return pump("return", value)
37
- }
38
- }
39
- return iter
40
- }
@@ -1,65 +0,0 @@
1
- export default function _asyncIterator(iterable) {
2
- var method,
3
- async,
4
- sync,
5
- retry = 2;
6
-
7
- if (typeof Symbol !== "undefined") {
8
- async = Symbol.asyncIterator;
9
- sync = Symbol.iterator;
10
- }
11
-
12
- while (retry--) {
13
- if (async && (method = iterable[async]) != null) {
14
- return method.call(iterable);
15
- }
16
- if (sync && (method = iterable[sync]) != null) {
17
- return new AsyncFromSyncIterator(method.call(iterable));
18
- }
19
-
20
- async = "@@asyncIterator";
21
- sync = "@@iterator";
22
- }
23
-
24
- throw new TypeError("Object is not async iterable");
25
- }
26
-
27
- function AsyncFromSyncIterator(s) {
28
- AsyncFromSyncIterator = function (s) {
29
- this.s = s;
30
- this.n = s.next;
31
- };
32
- AsyncFromSyncIterator.prototype = {
33
- /* SyncIterator */ s: null,
34
- /* SyncIterator.[[Next]] */ n: null,
35
- next: function () {
36
- return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
37
- },
38
- return: function (value) {
39
- var ret = this.s.return;
40
- if (ret === undefined) {
41
- return Promise.resolve({ value: value, done: true });
42
- }
43
- return AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments));
44
- },
45
- throw: function (value) {
46
- var thr = this.s.return;
47
- if (thr === undefined) return Promise.reject(value);
48
- return AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments));
49
- },
50
- };
51
-
52
- function AsyncFromSyncIteratorContinuation(r) {
53
- // This step is _before_ calling AsyncFromSyncIteratorContinuation in the spec.
54
- if (Object(r) !== r) {
55
- return Promise.reject(new TypeError(r + " is not an object."));
56
- }
57
-
58
- var done = r.done;
59
- return Promise.resolve(r.value).then(function (value) {
60
- return { value: value, done: done };
61
- });
62
- }
63
-
64
- return new AsyncFromSyncIterator(s);
65
- }
@@ -1,34 +0,0 @@
1
- export default function (fn) {
2
- return function () {
3
- var self = this
4
- // eslint-disable-next-line prefer-rest-params
5
- var args = arguments
6
- return new Promise(function (resolve, reject) {
7
- var gen = fn.apply(self, args)
8
- function _next(value) {
9
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value)
10
- }
11
- function _throw(err) {
12
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err)
13
- }
14
- _next(undefined)
15
- })
16
- }
17
- }
18
-
19
- const asyncGeneratorStep = (gen, resolve, reject, _next, _throw, key, arg) => {
20
- var info
21
- var value
22
- try {
23
- info = gen[key](arg)
24
- value = info.value
25
- } catch (error) {
26
- reject(error)
27
- return
28
- }
29
- if (info.done) {
30
- resolve(value)
31
- } else {
32
- Promise.resolve(value).then(_next, _throw)
33
- }
34
- }
@@ -1,5 +0,0 @@
1
- import AwaitValue from "../AwaitValue/AwaitValue.js"
2
-
3
- export default function (value) {
4
- return new AwaitValue(value)
5
- }
@@ -1,20 +0,0 @@
1
- export default function _classApplyDescriptorDestructureSet(receiver, descriptor) {
2
- if (descriptor.set) {
3
- if (!("__destrObj" in descriptor)) {
4
- descriptor.__destrObj = {
5
- // eslint-disable-next-line accessor-pairs
6
- set value(v) {
7
- descriptor.set.call(receiver, v)
8
- },
9
- }
10
- }
11
- return descriptor.__destrObj
12
- }
13
- if (!descriptor.writable) {
14
- // This should only throw in strict mode, but class bodies are
15
- // always strict and private fields can only be used inside
16
- // class bodies.
17
- throw new TypeError("attempted to set read only private field")
18
- }
19
- return descriptor
20
- }
@@ -1,6 +0,0 @@
1
- export default function _classApplyDescriptorGet(receiver, descriptor) {
2
- if (descriptor.get) {
3
- return descriptor.get.call(receiver)
4
- }
5
- return descriptor.value
6
- }
@@ -1,13 +0,0 @@
1
- export default function _classApplyDescriptorSet(receiver, descriptor, value) {
2
- if (descriptor.set) {
3
- descriptor.set.call(receiver, value)
4
- } else {
5
- if (!descriptor.writable) {
6
- // This should only throw in strict mode, but class bodies are
7
- // always strict and private fields can only be used inside
8
- // class bodies.
9
- throw new TypeError("attempted to set read only private field")
10
- }
11
- descriptor.value = value
12
- }
13
- }
@@ -1,5 +0,0 @@
1
- export default function _classCallCheck(instance, Constructor) {
2
- if (!(instance instanceof Constructor)) {
3
- throw new TypeError("Cannot call a class as a function")
4
- }
5
- }
@@ -1,5 +0,0 @@
1
- export default function _classCheckPrivateStaticAccess(receiver, classConstructor) {
2
- if (receiver !== classConstructor) {
3
- throw new TypeError("Private static access of wrong provenance")
4
- }
5
- }
@@ -1,6 +0,0 @@
1
- export default function _classCheckPrivateStaticFieldDescriptor(descriptor, action) {
2
- if (descriptor === undefined) {
3
- // eslint-disable-next-line prefer-template
4
- throw new TypeError("attempted to " + action + " private static field before its declaration")
5
- }
6
- }
@@ -1,7 +0,0 @@
1
- export default function _classExtractFieldDescriptor(receiver, privateMap, action) {
2
- if (!privateMap.has(receiver)) {
3
- // eslint-disable-next-line prefer-template
4
- throw new TypeError("attempted to " + action + " private field on non-instance")
5
- }
6
- return privateMap.get(receiver)
7
- }
@@ -1,4 +0,0 @@
1
- export default function _classNameTDZError(name) {
2
- // eslint-disable-next-line prefer-template
3
- throw new Error("Class " + name + "cannot be referenced in computed property keys.")
4
- }
@@ -1,7 +0,0 @@
1
- import classApplyDescriptorDestructureSet from "../classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js"
2
- import classExtractFieldDescriptor from "../classExtractFieldDescriptor/classExtractFieldDescriptor.js"
3
-
4
- export default function (receiver, privateMap) {
5
- var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set")
6
- return classApplyDescriptorDestructureSet(receiver, descriptor)
7
- }
@@ -1,7 +0,0 @@
1
- import classApplyDescriptorGet from "../classApplyDescriptorGet/classApplyDescriptorGet.js"
2
- import classExtractFieldDescriptor from "../classExtractFieldDescriptor/classExtractFieldDescriptor.js"
3
-
4
- export default function (receiver, privateMap) {
5
- var descriptor = classExtractFieldDescriptor(receiver, privateMap, "get")
6
- return classApplyDescriptorGet(receiver, descriptor)
7
- }