@runeditrun/rer 0.2.83 → 0.2.85

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 (269) hide show
  1. package/README.md +21 -24
  2. package/cli/README.md +17 -1
  3. package/cli/authoring.mjs +1 -0
  4. package/cli/bounded.mjs +1 -1
  5. package/cli/business/carry.mjs +149 -0
  6. package/cli/business/command.mjs +6 -1
  7. package/cli/business/connect.mjs +1 -1
  8. package/cli/business/local-commands.mjs +2 -0
  9. package/cli/business/opt-ins.mjs +8 -4
  10. package/cli/business/questions.mjs +4 -1
  11. package/cli/business/state.mjs +1 -1
  12. package/cli/business/supervisor.mjs +7 -1
  13. package/cli/container-transfer.mjs +2 -2
  14. package/cli/contract.mjs +7 -7
  15. package/cli/demo-host.mjs +5 -1
  16. package/cli/demo-native.mjs +2 -1
  17. package/cli/demo.mjs +6 -1
  18. package/cli/deploy-command.mjs +6 -4
  19. package/cli/deploy.mjs +9 -7
  20. package/cli/errors.mjs +1 -1
  21. package/cli/export.mjs +1 -1
  22. package/cli/human-error.mjs +20 -0
  23. package/cli/lifecycle.mjs +23 -5
  24. package/cli/main.mjs +1 -1
  25. package/cli/managed-data-schema.mjs +114 -0
  26. package/cli/managed-data-zip.mjs +116 -0
  27. package/cli/managed-data.mjs +110 -0
  28. package/cli/managed-server.mjs +25 -14
  29. package/cli/native-owner-entry.mjs +86 -0
  30. package/cli/output.mjs +3 -2
  31. package/cli/parse.mjs +3 -3
  32. package/cli/portability-empty.mjs +59 -0
  33. package/cli/portability-migrations.mjs +7 -5
  34. package/cli/portability-policy.mjs +5 -2
  35. package/cli/portability-worker.mjs +15 -6
  36. package/cli/portability.mjs +30 -8
  37. package/cli/ready-summary.mjs +9 -0
  38. package/cli/run-transfers.mjs +37 -0
  39. package/cli/runtime-front-door.mjs +4 -4
  40. package/cli/server-proxy.mjs +4 -3
  41. package/cli/server-registry.mjs +13 -8
  42. package/cli/site.mjs +6 -1
  43. package/cli/transfers.mjs +17 -4
  44. package/edition-authoring/base-copies.mjs +125 -30
  45. package/edition-authoring/copy-checkout.mjs +7 -120
  46. package/edition-authoring/edition-migrations.mjs +41 -0
  47. package/edition-authoring/files.mjs +67 -0
  48. package/edition-authoring/lock.mjs +2 -2
  49. package/edition-authoring/module-closure.mjs +232 -0
  50. package/edition-authoring/module-edges.mjs +100 -0
  51. package/edition-authoring/module-resolution.mjs +66 -0
  52. package/edition-authoring/module-syntax.mjs +57 -0
  53. package/edition-authoring/package-target.mjs +92 -0
  54. package/edition-authoring/runtime-dependencies.mjs +74 -97
  55. package/edition-authoring/vendor/babel-parser/LICENSE +22 -0
  56. package/edition-authoring/vendor/babel-parser/README.md +21 -0
  57. package/edition-authoring/vendor/babel-parser/babel-helper-string-parser/index.mjs +292 -0
  58. package/edition-authoring/vendor/babel-parser/babel-helper-validator-identifier/identifier.mjs +66 -0
  59. package/edition-authoring/vendor/babel-parser/babel-helper-validator-identifier/index.mjs +13 -0
  60. package/edition-authoring/vendor/babel-parser/babel-helper-validator-identifier/keyword.mjs +31 -0
  61. package/edition-authoring/vendor/babel-parser/babel-parser/index.mjs +99 -0
  62. package/edition-authoring/vendor/babel-parser/babel-parser/options.mjs +81 -0
  63. package/edition-authoring/vendor/babel-parser/babel-parser/parse-error/bind-operator-errors.mjs +8 -0
  64. package/edition-authoring/vendor/babel-parser/babel-parser/parse-error/module-errors.mjs +15 -0
  65. package/edition-authoring/vendor/babel-parser/babel-parser/parse-error/parse-expression-errors.mjs +10 -0
  66. package/edition-authoring/vendor/babel-parser/babel-parser/parse-error/pipeline-operator-errors.mjs +29 -0
  67. package/edition-authoring/vendor/babel-parser/babel-parser/parse-error/standard-errors.mjs +224 -0
  68. package/edition-authoring/vendor/babel-parser/babel-parser/parse-error/strict-mode-errors.mjs +17 -0
  69. package/edition-authoring/vendor/babel-parser/babel-parser/parse-error/to-node-description.mjs +31 -0
  70. package/edition-authoring/vendor/babel-parser/babel-parser/parse-error.mjs +114 -0
  71. package/edition-authoring/vendor/babel-parser/babel-parser/parser/base.mjs +34 -0
  72. package/edition-authoring/vendor/babel-parser/babel-parser/parser/comments.mjs +199 -0
  73. package/edition-authoring/vendor/babel-parser/babel-parser/parser/expression.mjs +1794 -0
  74. package/edition-authoring/vendor/babel-parser/babel-parser/parser/index.mjs +76 -0
  75. package/edition-authoring/vendor/babel-parser/babel-parser/parser/lval.mjs +439 -0
  76. package/edition-authoring/vendor/babel-parser/babel-parser/parser/node.mjs +111 -0
  77. package/edition-authoring/vendor/babel-parser/babel-parser/parser/statement.mjs +1962 -0
  78. package/edition-authoring/vendor/babel-parser/babel-parser/parser/util.mjs +244 -0
  79. package/edition-authoring/vendor/babel-parser/babel-parser/plugin-utils.mjs +116 -0
  80. package/edition-authoring/vendor/babel-parser/babel-parser/plugins/estree.mjs +417 -0
  81. package/edition-authoring/vendor/babel-parser/babel-parser/plugins/flow/index.mjs +2412 -0
  82. package/edition-authoring/vendor/babel-parser/babel-parser/plugins/flow/scope.mjs +37 -0
  83. package/edition-authoring/vendor/babel-parser/babel-parser/plugins/jsx/index.mjs +420 -0
  84. package/edition-authoring/vendor/babel-parser/babel-parser/plugins/jsx/xhtml.mjs +261 -0
  85. package/edition-authoring/vendor/babel-parser/babel-parser/plugins/placeholders.mjs +205 -0
  86. package/edition-authoring/vendor/babel-parser/babel-parser/plugins/typescript/index.mjs +2889 -0
  87. package/edition-authoring/vendor/babel-parser/babel-parser/plugins/typescript/scope.mjs +115 -0
  88. package/edition-authoring/vendor/babel-parser/babel-parser/plugins/v8intrinsic.mjs +26 -0
  89. package/edition-authoring/vendor/babel-parser/babel-parser/tokenizer/context.mjs +22 -0
  90. package/edition-authoring/vendor/babel-parser/babel-parser/tokenizer/index.mjs +1037 -0
  91. package/edition-authoring/vendor/babel-parser/babel-parser/tokenizer/state.mjs +178 -0
  92. package/edition-authoring/vendor/babel-parser/babel-parser/tokenizer/types.mjs +583 -0
  93. package/edition-authoring/vendor/babel-parser/babel-parser/types.mjs +1 -0
  94. package/edition-authoring/vendor/babel-parser/babel-parser/util/class-scope.mjs +82 -0
  95. package/edition-authoring/vendor/babel-parser/babel-parser/util/expression-scope.mjs +121 -0
  96. package/edition-authoring/vendor/babel-parser/babel-parser/util/identifier.mjs +23 -0
  97. package/edition-authoring/vendor/babel-parser/babel-parser/util/location.mjs +34 -0
  98. package/edition-authoring/vendor/babel-parser/babel-parser/util/production-parameter.mjs +40 -0
  99. package/edition-authoring/vendor/babel-parser/babel-parser/util/scope.mjs +173 -0
  100. package/edition-authoring/vendor/babel-parser/babel-parser/util/scopeflags.mjs +66 -0
  101. package/edition-authoring/vendor/babel-parser/babel-parser/util/whitespace.mjs +61 -0
  102. package/edition-authoring/vendor/yaml/LICENSE +13 -0
  103. package/edition-authoring/vendor/yaml/README.md +11 -0
  104. package/edition-authoring/vendor/yaml/compose/compose-collection.mjs +88 -0
  105. package/edition-authoring/vendor/yaml/compose/compose-doc.mjs +43 -0
  106. package/edition-authoring/vendor/yaml/compose/compose-node.mjs +110 -0
  107. package/edition-authoring/vendor/yaml/compose/compose-scalar.mjs +86 -0
  108. package/edition-authoring/vendor/yaml/compose/composer.mjs +218 -0
  109. package/edition-authoring/vendor/yaml/compose/resolve-block-map.mjs +115 -0
  110. package/edition-authoring/vendor/yaml/compose/resolve-block-scalar.mjs +198 -0
  111. package/edition-authoring/vendor/yaml/compose/resolve-block-seq.mjs +49 -0
  112. package/edition-authoring/vendor/yaml/compose/resolve-end.mjs +37 -0
  113. package/edition-authoring/vendor/yaml/compose/resolve-flow-collection.mjs +207 -0
  114. package/edition-authoring/vendor/yaml/compose/resolve-flow-scalar.mjs +228 -0
  115. package/edition-authoring/vendor/yaml/compose/resolve-props.mjs +148 -0
  116. package/edition-authoring/vendor/yaml/compose/util-contains-newline.mjs +34 -0
  117. package/edition-authoring/vendor/yaml/compose/util-empty-scalar-position.mjs +27 -0
  118. package/edition-authoring/vendor/yaml/compose/util-flow-indent-check.mjs +15 -0
  119. package/edition-authoring/vendor/yaml/compose/util-map-includes.mjs +13 -0
  120. package/edition-authoring/vendor/yaml/doc/Document.mjs +333 -0
  121. package/edition-authoring/vendor/yaml/doc/anchors.mjs +74 -0
  122. package/edition-authoring/vendor/yaml/doc/applyReviver.mjs +54 -0
  123. package/edition-authoring/vendor/yaml/doc/createNode.mjs +88 -0
  124. package/edition-authoring/vendor/yaml/doc/directives.mjs +176 -0
  125. package/edition-authoring/vendor/yaml/errors.mjs +57 -0
  126. package/edition-authoring/vendor/yaml/index.mjs +17 -0
  127. package/edition-authoring/vendor/yaml/log.mjs +11 -0
  128. package/edition-authoring/vendor/yaml/nodes/Alias.mjs +119 -0
  129. package/edition-authoring/vendor/yaml/nodes/Collection.mjs +147 -0
  130. package/edition-authoring/vendor/yaml/nodes/Node.mjs +38 -0
  131. package/edition-authoring/vendor/yaml/nodes/Pair.mjs +36 -0
  132. package/edition-authoring/vendor/yaml/nodes/Scalar.mjs +24 -0
  133. package/edition-authoring/vendor/yaml/nodes/YAMLMap.mjs +144 -0
  134. package/edition-authoring/vendor/yaml/nodes/YAMLSeq.mjs +113 -0
  135. package/edition-authoring/vendor/yaml/nodes/addPairToJSMap.mjs +62 -0
  136. package/edition-authoring/vendor/yaml/nodes/identity.mjs +36 -0
  137. package/edition-authoring/vendor/yaml/nodes/toJS.mjs +35 -0
  138. package/edition-authoring/vendor/yaml/parse/cst-scalar.mjs +214 -0
  139. package/edition-authoring/vendor/yaml/parse/cst-stringify.mjs +61 -0
  140. package/edition-authoring/vendor/yaml/parse/cst-visit.mjs +97 -0
  141. package/edition-authoring/vendor/yaml/parse/cst.mjs +98 -0
  142. package/edition-authoring/vendor/yaml/parse/lexer.mjs +722 -0
  143. package/edition-authoring/vendor/yaml/parse/line-counter.mjs +39 -0
  144. package/edition-authoring/vendor/yaml/parse/parser.mjs +975 -0
  145. package/edition-authoring/vendor/yaml/public-api.mjs +102 -0
  146. package/edition-authoring/vendor/yaml/schema/Schema.mjs +37 -0
  147. package/edition-authoring/vendor/yaml/schema/common/map.mjs +17 -0
  148. package/edition-authoring/vendor/yaml/schema/common/null.mjs +15 -0
  149. package/edition-authoring/vendor/yaml/schema/common/seq.mjs +17 -0
  150. package/edition-authoring/vendor/yaml/schema/common/string.mjs +14 -0
  151. package/edition-authoring/vendor/yaml/schema/core/bool.mjs +19 -0
  152. package/edition-authoring/vendor/yaml/schema/core/float.mjs +43 -0
  153. package/edition-authoring/vendor/yaml/schema/core/int.mjs +38 -0
  154. package/edition-authoring/vendor/yaml/schema/core/schema.mjs +23 -0
  155. package/edition-authoring/vendor/yaml/schema/json/schema.mjs +62 -0
  156. package/edition-authoring/vendor/yaml/schema/tags.mjs +96 -0
  157. package/edition-authoring/vendor/yaml/schema/yaml-1.1/binary.mjs +59 -0
  158. package/edition-authoring/vendor/yaml/schema/yaml-1.1/bool.mjs +26 -0
  159. package/edition-authoring/vendor/yaml/schema/yaml-1.1/float.mjs +46 -0
  160. package/edition-authoring/vendor/yaml/schema/yaml-1.1/int.mjs +71 -0
  161. package/edition-authoring/vendor/yaml/schema/yaml-1.1/merge.mjs +67 -0
  162. package/edition-authoring/vendor/yaml/schema/yaml-1.1/omap.mjs +74 -0
  163. package/edition-authoring/vendor/yaml/schema/yaml-1.1/pairs.mjs +78 -0
  164. package/edition-authoring/vendor/yaml/schema/yaml-1.1/schema.mjs +39 -0
  165. package/edition-authoring/vendor/yaml/schema/yaml-1.1/set.mjs +93 -0
  166. package/edition-authoring/vendor/yaml/schema/yaml-1.1/timestamp.mjs +101 -0
  167. package/edition-authoring/vendor/yaml/stringify/foldFlowLines.mjs +146 -0
  168. package/edition-authoring/vendor/yaml/stringify/stringify.mjs +130 -0
  169. package/edition-authoring/vendor/yaml/stringify/stringifyCollection.mjs +155 -0
  170. package/edition-authoring/vendor/yaml/stringify/stringifyComment.mjs +20 -0
  171. package/edition-authoring/vendor/yaml/stringify/stringifyDocument.mjs +85 -0
  172. package/edition-authoring/vendor/yaml/stringify/stringifyNumber.mjs +25 -0
  173. package/edition-authoring/vendor/yaml/stringify/stringifyPair.mjs +150 -0
  174. package/edition-authoring/vendor/yaml/stringify/stringifyString.mjs +338 -0
  175. package/edition-authoring/vendor/yaml/util.mjs +11 -0
  176. package/edition-authoring/vendor/yaml/visit.mjs +233 -0
  177. package/edition-authoring/workflow-copies.mjs +125 -0
  178. package/edition-authoring/workflow-scripts.mjs +112 -0
  179. package/foundation/runtime/contract-docs.mjs +754 -0
  180. package/foundation/runtime/run-data.d.mts +1 -0
  181. package/foundation/runtime/run-data.mjs +2 -0
  182. package/global/CHANGELOG.md +55 -3
  183. package/global/README.md +21 -24
  184. package/global/cli/command.mjs +8 -2
  185. package/global/cli/install.mjs +4 -5
  186. package/global/cli/path-link.mjs +3 -2
  187. package/global/cli/repo-command.mjs +3 -7
  188. package/global/launch/dev.mjs +12 -2
  189. package/global/launch/facts.mjs +2 -2
  190. package/global/launch/render.mjs +16 -9
  191. package/global/launch/state.mjs +4 -4
  192. package/global/main.mjs +12 -7
  193. package/install.sh +17 -6
  194. package/modules/container/README.md +6 -1
  195. package/modules/container/adapters/d1-limits.mjs +286 -0
  196. package/modules/container/adapters/d1-sqlite.mjs +95 -0
  197. package/modules/container/adapters/d1-workerd-preload.mjs +19 -0
  198. package/modules/container/adapters/d1-workerd-setup.mjs +26 -0
  199. package/modules/container/adapters/d1-workerd.mjs +5 -0
  200. package/modules/container/adapters/sqlite-worker.mjs +5 -3
  201. package/modules/container/build.mjs +1 -0
  202. package/modules/container/image-variables.mjs +8 -3
  203. package/modules/container/transfer.mjs +14 -4
  204. package/modules/container/worker-engine.mjs +3 -3
  205. package/modules/demo/declaration.mjs +1 -4
  206. package/modules/demo/vite.mjs +1 -1
  207. package/modules/demo-host/build.mjs +1 -0
  208. package/modules/demo-host/native/prepare.mjs +2 -1
  209. package/modules/demo-host/native/sql.mjs +7 -2
  210. package/modules/deploy-kit/README.md +23 -3
  211. package/modules/deploy-kit/d1-import-diagnostics.mjs +56 -0
  212. package/modules/deploy-kit/d1-import.mjs +17 -5
  213. package/modules/deploy-kit/diagnostics.mjs +29 -3
  214. package/modules/deploy-kit/owner-cli.mjs +20 -7
  215. package/modules/deploy-kit/provider-transport.mjs +19 -4
  216. package/modules/deploy-kit/provider.mjs +57 -22
  217. package/modules/deploy-kit/readiness-window.mjs +1 -1
  218. package/modules/deploy-kit/site.mjs +8 -3
  219. package/modules/deploy-kit/templates.mjs +3 -3
  220. package/modules/deploy-kit/worker.mjs +4 -4
  221. package/modules/import-kit/src/d1/README.md +23 -4
  222. package/modules/import-kit/src/d1/atomic-prefix.ts +2 -2
  223. package/modules/import-kit/src/d1/budget.ts +15 -7
  224. package/modules/import-kit/src/d1/column-layout.ts +5 -0
  225. package/modules/import-kit/src/d1/creation.ts +15 -8
  226. package/modules/import-kit/src/d1/database.ts +3 -3
  227. package/modules/import-kit/src/d1/erasure-pages.ts +2 -1
  228. package/modules/import-kit/src/d1/erasure.ts +2 -2
  229. package/modules/import-kit/src/d1/jobs.ts +10 -6
  230. package/modules/import-kit/src/d1/plans.ts +14 -8
  231. package/modules/import-kit/src/d1/retirement.ts +2 -2
  232. package/modules/import-kit/src/d1/sets.ts +1 -3
  233. package/modules/import-kit/src/d1/staged-creation.ts +3 -3
  234. package/modules/import-kit/src/door/limits.ts +1 -1
  235. package/modules/import-kit/src/door/refusals.ts +1 -1
  236. package/modules/portability/README.md +112 -4
  237. package/modules/portability/backfills.mjs +9 -8
  238. package/modules/portability/bridge.mjs +12 -5
  239. package/modules/portability/catalogue.mjs +12 -5
  240. package/modules/portability/files.mjs +4 -3
  241. package/modules/portability/http.mjs +3 -3
  242. package/modules/portability/import.mjs +18 -9
  243. package/modules/portability/index.d.mts +4 -3
  244. package/modules/portability/index.mjs +1 -1
  245. package/modules/portability/ledgers.mjs +3 -2
  246. package/modules/portability/legacy-safety.mjs +11 -2
  247. package/modules/portability/migration-history.mjs +2 -2
  248. package/modules/portability/progress.mjs +1 -0
  249. package/modules/portability/restore-empty.mjs +12 -0
  250. package/modules/release/github-verify.mjs +11 -2
  251. package/onboarding/adapter.mjs +35 -6
  252. package/onboarding/app-fetch.mjs +6 -4
  253. package/onboarding/development-runtime.mjs +19 -0
  254. package/onboarding/local/operation.mjs +45 -27
  255. package/onboarding/loopback-fetch.mjs +16 -0
  256. package/onboarding/operator-installer.mjs +4 -6
  257. package/onboarding/process-diagnostics.mjs +6 -2
  258. package/onboarding/production-runtime.mjs +4 -2
  259. package/onboarding/readiness.mjs +1 -0
  260. package/package.json +1 -1
  261. package/scripts/publish-check/README.md +6 -0
  262. package/scripts/publish-check/history_scan.py +5 -3
  263. package/scripts/publish-check/hygiene_config.py +2 -1
  264. package/scripts/publish-check/public_hygiene.py +1 -1
  265. package/scripts/publish-check/report.py +9 -3
  266. package/scripts/publish-check/third-party-notices.json +13 -0
  267. package/scripts/publish-check/third_party_notices.py +38 -0
  268. package/scripts/publish-check/tree_scan.py +6 -0
  269. package/scripts/publish-check.mjs +1 -1
@@ -0,0 +1,76 @@
1
+ // Generated from Babel v7.29.8 (MIT); see README.md.
2
+ import { getOptions, OptionFlags } from "../options.mjs";
3
+ import StatementParser from "./statement.mjs";
4
+ import ScopeHandler from "../util/scope.mjs";
5
+ class Parser extends StatementParser {
6
+ constructor(options, input, pluginsMap) {
7
+ const normalizedOptions = getOptions(options);
8
+ super(normalizedOptions, input);
9
+ this.options = normalizedOptions;
10
+ this.initializeScopes();
11
+ this.plugins = pluginsMap;
12
+ this.filename = normalizedOptions.sourceFilename;
13
+ this.startIndex = normalizedOptions.startIndex;
14
+ let optionFlags = 0;
15
+ if (normalizedOptions.allowAwaitOutsideFunction) {
16
+ optionFlags |= OptionFlags.AllowAwaitOutsideFunction;
17
+ }
18
+ if (normalizedOptions.allowReturnOutsideFunction) {
19
+ optionFlags |= OptionFlags.AllowReturnOutsideFunction;
20
+ }
21
+ if (normalizedOptions.allowImportExportEverywhere) {
22
+ optionFlags |= OptionFlags.AllowImportExportEverywhere;
23
+ }
24
+ if (normalizedOptions.allowSuperOutsideMethod) {
25
+ optionFlags |= OptionFlags.AllowSuperOutsideMethod;
26
+ }
27
+ if (normalizedOptions.allowUndeclaredExports) {
28
+ optionFlags |= OptionFlags.AllowUndeclaredExports;
29
+ }
30
+ if (normalizedOptions.allowNewTargetOutsideFunction) {
31
+ optionFlags |= OptionFlags.AllowNewTargetOutsideFunction;
32
+ }
33
+ if (normalizedOptions.allowYieldOutsideFunction) {
34
+ optionFlags |= OptionFlags.AllowYieldOutsideFunction;
35
+ }
36
+ if (normalizedOptions.ranges) {
37
+ optionFlags |= OptionFlags.Ranges;
38
+ }
39
+ if (normalizedOptions.tokens) {
40
+ optionFlags |= OptionFlags.Tokens;
41
+ }
42
+ if (normalizedOptions.createImportExpressions) {
43
+ optionFlags |= OptionFlags.CreateImportExpressions;
44
+ }
45
+ if (normalizedOptions.createParenthesizedExpressions) {
46
+ optionFlags |= OptionFlags.CreateParenthesizedExpressions;
47
+ }
48
+ if (normalizedOptions.errorRecovery) {
49
+ optionFlags |= OptionFlags.ErrorRecovery;
50
+ }
51
+ if (normalizedOptions.attachComment) {
52
+ optionFlags |= OptionFlags.AttachComment;
53
+ }
54
+ if (normalizedOptions.annexB) {
55
+ optionFlags |= OptionFlags.AnnexB;
56
+ }
57
+ this.optionFlags = optionFlags;
58
+ }
59
+ getScopeHandler() {
60
+ return ScopeHandler;
61
+ }
62
+ parse() {
63
+ this.enterInitialScopes();
64
+ const file = this.startNode();
65
+ const program = this.startNode();
66
+ this.nextToken();
67
+ file.errors = null;
68
+ const result = this.parseTopLevel(file, program);
69
+ result.errors = this.state.errors;
70
+ result.comments.length = this.state.commentsLen;
71
+ return result;
72
+ }
73
+ }
74
+ export {
75
+ Parser as default
76
+ };
@@ -0,0 +1,439 @@
1
+ // Generated from Babel v7.29.8 (MIT); see README.md.
2
+ import { tt } from "../tokenizer/types.mjs";
3
+ import { isStrictBindOnlyReservedWord, isStrictBindReservedWord } from "../util/identifier.mjs";
4
+ import { NodeUtils } from "./node.mjs";
5
+ import { BindingFlag } from "../util/scopeflags.mjs";
6
+ import { Errors } from "../parse-error.mjs";
7
+ import { OptionFlags } from "../options.mjs";
8
+ const unwrapParenthesizedExpression = (node) => {
9
+ return node.type === "ParenthesizedExpression" ? unwrapParenthesizedExpression(node.expression) : node;
10
+ };
11
+ var ParseBindingListFlags = {
12
+ ALLOW_EMPTY: 1,
13
+ IS_FUNCTION_PARAMS: 2,
14
+ IS_CONSTRUCTOR_PARAMS: 4
15
+ };
16
+ class LValParser extends NodeUtils {
17
+ toAssignable(node, isLHS = false) {
18
+ let parenthesized = void 0;
19
+ if (node.type === "ParenthesizedExpression" || node.extra?.parenthesized) {
20
+ parenthesized = unwrapParenthesizedExpression(node);
21
+ if (isLHS) {
22
+ if (parenthesized.type === "Identifier") {
23
+ this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, node);
24
+ } else if (parenthesized.type !== "CallExpression" && parenthesized.type !== "MemberExpression" && !this.isOptionalMemberExpression(parenthesized)) {
25
+ this.raise(Errors.InvalidParenthesizedAssignment, node);
26
+ }
27
+ } else {
28
+ this.raise(Errors.InvalidParenthesizedAssignment, node);
29
+ }
30
+ }
31
+ switch (node.type) {
32
+ case "Identifier":
33
+ case "ObjectPattern":
34
+ case "ArrayPattern":
35
+ case "AssignmentPattern":
36
+ case "RestElement":
37
+ case "VoidPattern":
38
+ break;
39
+ case "ObjectExpression":
40
+ this.castNodeTo(node, "ObjectPattern");
41
+ for (let i = 0, length = node.properties.length, last = length - 1; i < length; i++) {
42
+ const prop = node.properties[i];
43
+ const isLast = i === last;
44
+ this.toAssignableObjectExpressionProp(prop, isLast, isLHS);
45
+ if (isLast && prop.type === "RestElement" && node.extra?.trailingCommaLoc) {
46
+ this.raise(Errors.RestTrailingComma, node.extra.trailingCommaLoc);
47
+ }
48
+ }
49
+ break;
50
+ case "ObjectProperty": {
51
+ const {
52
+ key,
53
+ value
54
+ } = node;
55
+ if (this.isPrivateName(key)) {
56
+ this.classScope.usePrivateName(this.getPrivateNameSV(key), key.loc.start);
57
+ }
58
+ this.toAssignable(value, isLHS);
59
+ break;
60
+ }
61
+ case "SpreadElement": {
62
+ throw new Error("Internal @babel/parser error (this is a bug, please report it). SpreadElement should be converted by .toAssignable's caller.");
63
+ }
64
+ case "ArrayExpression":
65
+ this.castNodeTo(node, "ArrayPattern");
66
+ this.toAssignableList(node.elements, node.extra?.trailingCommaLoc, isLHS);
67
+ break;
68
+ case "AssignmentExpression":
69
+ if (node.operator !== "=") {
70
+ this.raise(Errors.MissingEqInAssignment, node.left.loc.end);
71
+ }
72
+ this.castNodeTo(node, "AssignmentPattern");
73
+ delete node.operator;
74
+ if (node.left.type === "VoidPattern") {
75
+ this.raise(Errors.VoidPatternInitializer, node.left);
76
+ }
77
+ this.toAssignable(node.left, isLHS);
78
+ break;
79
+ case "ParenthesizedExpression":
80
+ this.toAssignable(parenthesized, isLHS);
81
+ break;
82
+ default:
83
+ }
84
+ }
85
+ toAssignableObjectExpressionProp(prop, isLast, isLHS) {
86
+ if (prop.type === "ObjectMethod") {
87
+ this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, prop.key);
88
+ } else if (prop.type === "SpreadElement") {
89
+ this.castNodeTo(prop, "RestElement");
90
+ const arg = prop.argument;
91
+ this.checkToRestConversion(arg, false);
92
+ this.toAssignable(arg, isLHS);
93
+ if (!isLast) {
94
+ this.raise(Errors.RestTrailingComma, prop);
95
+ }
96
+ } else {
97
+ this.toAssignable(prop, isLHS);
98
+ }
99
+ }
100
+ toAssignableList(exprList, trailingCommaLoc, isLHS) {
101
+ const end = exprList.length - 1;
102
+ for (let i = 0; i <= end; i++) {
103
+ const elt = exprList[i];
104
+ if (!elt) continue;
105
+ this.toAssignableListItem(exprList, i, isLHS);
106
+ if (elt.type === "RestElement") {
107
+ if (i < end) {
108
+ this.raise(Errors.RestTrailingComma, elt);
109
+ } else if (trailingCommaLoc) {
110
+ this.raise(Errors.RestTrailingComma, trailingCommaLoc);
111
+ }
112
+ }
113
+ }
114
+ }
115
+ toAssignableListItem(exprList, index, isLHS) {
116
+ const node = exprList[index];
117
+ if (node.type === "SpreadElement") {
118
+ this.castNodeTo(node, "RestElement");
119
+ const arg = node.argument;
120
+ this.checkToRestConversion(arg, true);
121
+ this.toAssignable(arg, isLHS);
122
+ } else {
123
+ this.toAssignable(node, isLHS);
124
+ }
125
+ }
126
+ isAssignable(node, isBinding) {
127
+ switch (node.type) {
128
+ case "Identifier":
129
+ case "ObjectPattern":
130
+ case "ArrayPattern":
131
+ case "AssignmentPattern":
132
+ case "RestElement":
133
+ case "VoidPattern":
134
+ return true;
135
+ case "ObjectExpression": {
136
+ const last = node.properties.length - 1;
137
+ return node.properties.every((prop, i) => {
138
+ return prop.type !== "ObjectMethod" && (i === last || prop.type !== "SpreadElement") && this.isAssignable(prop);
139
+ });
140
+ }
141
+ case "ObjectProperty":
142
+ return this.isAssignable(node.value);
143
+ case "SpreadElement":
144
+ return this.isAssignable(node.argument);
145
+ case "ArrayExpression":
146
+ return node.elements.every((element) => element === null || this.isAssignable(element));
147
+ case "AssignmentExpression":
148
+ return node.operator === "=";
149
+ case "ParenthesizedExpression":
150
+ return this.isAssignable(node.expression);
151
+ case "MemberExpression":
152
+ case "OptionalMemberExpression":
153
+ return !isBinding;
154
+ default:
155
+ return false;
156
+ }
157
+ }
158
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- Retain the upstream parser interface and bindings.
159
+ toReferencedList(exprList, isParenthesizedExpr) {
160
+ return exprList;
161
+ }
162
+ toReferencedListDeep(exprList, isParenthesizedExpr) {
163
+ this.toReferencedList(exprList, isParenthesizedExpr);
164
+ for (const expr of exprList) {
165
+ if (expr?.type === "ArrayExpression") {
166
+ this.toReferencedListDeep(expr.elements);
167
+ }
168
+ }
169
+ }
170
+ parseSpread(refExpressionErrors) {
171
+ const node = this.startNode();
172
+ this.next();
173
+ node.argument = this.parseMaybeAssignAllowIn(refExpressionErrors, void 0);
174
+ return this.finishNode(node, "SpreadElement");
175
+ }
176
+ parseRestBinding() {
177
+ const node = this.startNode();
178
+ this.next();
179
+ const argument = this.parseBindingAtom();
180
+ if (argument.type === "VoidPattern") {
181
+ this.raise(Errors.UnexpectedVoidPattern, argument);
182
+ }
183
+ node.argument = argument;
184
+ return this.finishNode(node, "RestElement");
185
+ }
186
+ parseBindingAtom() {
187
+ switch (this.state.type) {
188
+ case tt.bracketL: {
189
+ const node = this.startNode();
190
+ this.next();
191
+ node.elements = this.parseBindingList(tt.bracketR, 93, ParseBindingListFlags.ALLOW_EMPTY);
192
+ return this.finishNode(node, "ArrayPattern");
193
+ }
194
+ case tt.braceL:
195
+ return this.parseObjectLike(tt.braceR, true);
196
+ case tt._void:
197
+ return this.parseVoidPattern(null);
198
+ }
199
+ return this.parseIdentifier();
200
+ }
201
+ parseBindingList(close, closeCharCode, flags) {
202
+ const allowEmpty = flags & ParseBindingListFlags.ALLOW_EMPTY;
203
+ const elts = [];
204
+ let first = true;
205
+ while (!this.eat(close)) {
206
+ if (first) {
207
+ first = false;
208
+ } else {
209
+ this.expect(tt.comma);
210
+ }
211
+ if (allowEmpty && this.match(tt.comma)) {
212
+ elts.push(null);
213
+ } else if (this.eat(close)) {
214
+ break;
215
+ } else if (this.match(tt.ellipsis)) {
216
+ let rest = this.parseRestBinding();
217
+ if (this.hasPlugin("flow") || flags & ParseBindingListFlags.IS_FUNCTION_PARAMS) {
218
+ rest = this.parseFunctionParamType(rest);
219
+ }
220
+ elts.push(rest);
221
+ if (!this.checkCommaAfterRest(closeCharCode)) {
222
+ this.expect(close);
223
+ break;
224
+ }
225
+ } else {
226
+ const decorators = [];
227
+ if (flags & ParseBindingListFlags.IS_FUNCTION_PARAMS) {
228
+ if (this.match(tt.at) && this.hasPlugin("decorators")) {
229
+ this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc);
230
+ }
231
+ while (this.match(tt.at)) {
232
+ decorators.push(this.parseDecorator());
233
+ }
234
+ }
235
+ elts.push(this.parseBindingElement(flags, decorators));
236
+ }
237
+ }
238
+ return elts;
239
+ }
240
+ parseBindingRestProperty(prop) {
241
+ this.next();
242
+ if (this.hasPlugin("discardBinding") && this.match(tt._void)) {
243
+ prop.argument = this.parseVoidPattern(null);
244
+ this.raise(Errors.UnexpectedVoidPattern, prop.argument);
245
+ } else {
246
+ prop.argument = this.parseIdentifier();
247
+ }
248
+ this.checkCommaAfterRest(125);
249
+ return this.finishNode(prop, "RestElement");
250
+ }
251
+ parseBindingProperty() {
252
+ const {
253
+ type,
254
+ startLoc
255
+ } = this.state;
256
+ if (type === tt.ellipsis) {
257
+ return this.parseBindingRestProperty(this.startNode());
258
+ }
259
+ const prop = this.startNode();
260
+ if (type === tt.privateName) {
261
+ this.expectPlugin("destructuringPrivate", startLoc);
262
+ this.classScope.usePrivateName(this.state.value, startLoc);
263
+ prop.key = this.parsePrivateName();
264
+ } else {
265
+ this.parsePropertyName(prop);
266
+ }
267
+ prop.method = false;
268
+ return this.parseObjPropValue(prop, startLoc, false, false, true, false);
269
+ }
270
+ parseBindingElement(flags, decorators) {
271
+ const left = this.parseMaybeDefault();
272
+ if (this.hasPlugin("flow") || flags & ParseBindingListFlags.IS_FUNCTION_PARAMS) {
273
+ this.parseFunctionParamType(left);
274
+ }
275
+ if (decorators.length) {
276
+ left.decorators = decorators;
277
+ this.resetStartLocationFromNode(left, decorators[0]);
278
+ }
279
+ const elt = this.parseMaybeDefault(left.loc.start, left);
280
+ return elt;
281
+ }
282
+ parseFunctionParamType(param) {
283
+ return param;
284
+ }
285
+ parseMaybeDefault(startLoc, left) {
286
+ startLoc ??= this.state.startLoc;
287
+ left = left ?? this.parseBindingAtom();
288
+ if (!this.eat(tt.eq)) return left;
289
+ const node = this.startNodeAt(startLoc);
290
+ if (left.type === "VoidPattern") {
291
+ this.raise(Errors.VoidPatternInitializer, left);
292
+ }
293
+ node.left = left;
294
+ node.right = this.parseMaybeAssignAllowIn();
295
+ return this.finishNode(node, "AssignmentPattern");
296
+ }
297
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- Retain the upstream parser interface and bindings.
298
+ isValidLVal(type, disallowCallExpression, isUnparenthesizedInAssign, binding) {
299
+ switch (type) {
300
+ case "AssignmentPattern":
301
+ return "left";
302
+ case "RestElement":
303
+ return "argument";
304
+ case "ObjectProperty":
305
+ return "value";
306
+ case "ParenthesizedExpression":
307
+ return "expression";
308
+ case "ArrayPattern":
309
+ return "elements";
310
+ case "ObjectPattern":
311
+ return "properties";
312
+ case "VoidPattern":
313
+ return true;
314
+ case "CallExpression":
315
+ if (!disallowCallExpression && !this.state.strict && this.optionFlags & OptionFlags.AnnexB) {
316
+ return true;
317
+ }
318
+ }
319
+ return false;
320
+ }
321
+ isOptionalMemberExpression(expression) {
322
+ return expression.type === "OptionalMemberExpression";
323
+ }
324
+ checkLVal(expression, ancestor, binding = BindingFlag.TYPE_NONE, checkClashes = false, strictModeChanged = false, hasParenthesizedAncestor = false, disallowCallExpression = false) {
325
+ const type = expression.type;
326
+ if (this.isObjectMethod(expression)) return;
327
+ const isOptionalMemberExpression = this.isOptionalMemberExpression(expression);
328
+ if (isOptionalMemberExpression || type === "MemberExpression") {
329
+ if (isOptionalMemberExpression) {
330
+ this.expectPlugin("optionalChainingAssign", expression.loc.start);
331
+ if (ancestor.type !== "AssignmentExpression") {
332
+ this.raise(Errors.InvalidLhsOptionalChaining, expression, {
333
+ ancestor
334
+ });
335
+ }
336
+ }
337
+ if (binding !== BindingFlag.TYPE_NONE) {
338
+ this.raise(Errors.InvalidPropertyBindingPattern, expression);
339
+ }
340
+ return;
341
+ }
342
+ if (type === "Identifier") {
343
+ this.checkIdentifier(expression, binding, strictModeChanged);
344
+ const {
345
+ name
346
+ } = expression;
347
+ if (checkClashes) {
348
+ if (checkClashes.has(name)) {
349
+ this.raise(Errors.ParamDupe, expression);
350
+ } else {
351
+ checkClashes.add(name);
352
+ }
353
+ }
354
+ return;
355
+ } else if (type === "VoidPattern" && ancestor.type === "CatchClause") {
356
+ this.raise(Errors.VoidPatternCatchClauseParam, expression);
357
+ }
358
+ const unwrappedExpression = unwrapParenthesizedExpression(expression);
359
+ disallowCallExpression ||= unwrappedExpression.type === "CallExpression" && (unwrappedExpression.callee.type === "Import" || unwrappedExpression.callee.type === "Super");
360
+ const validity = this.isValidLVal(type, disallowCallExpression, !(hasParenthesizedAncestor || expression.extra?.parenthesized) && ancestor.type === "AssignmentExpression", binding);
361
+ if (validity === true) return;
362
+ if (validity === false) {
363
+ const ParseErrorClass = binding === BindingFlag.TYPE_NONE ? Errors.InvalidLhs : Errors.InvalidLhsBinding;
364
+ this.raise(ParseErrorClass, expression, {
365
+ ancestor
366
+ });
367
+ return;
368
+ }
369
+ let key, isParenthesizedExpression;
370
+ if (typeof validity === "string") {
371
+ key = validity;
372
+ isParenthesizedExpression = type === "ParenthesizedExpression";
373
+ } else {
374
+ [key, isParenthesizedExpression] = validity;
375
+ }
376
+ const nextAncestor = type === "ArrayPattern" || type === "ObjectPattern" ? {
377
+ type
378
+ } : ancestor;
379
+ const val = expression[key];
380
+ if (Array.isArray(val)) {
381
+ for (const child of val) {
382
+ if (child) {
383
+ this.checkLVal(child, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression, true);
384
+ }
385
+ }
386
+ } else if (val) {
387
+ this.checkLVal(val, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression, disallowCallExpression);
388
+ }
389
+ }
390
+ checkIdentifier(at, bindingType, strictModeChanged = false) {
391
+ if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) {
392
+ if (bindingType === BindingFlag.TYPE_NONE) {
393
+ this.raise(Errors.StrictEvalArguments, at, {
394
+ referenceName: at.name
395
+ });
396
+ } else {
397
+ this.raise(Errors.StrictEvalArgumentsBinding, at, {
398
+ bindingName: at.name
399
+ });
400
+ }
401
+ }
402
+ if (bindingType & BindingFlag.FLAG_NO_LET_IN_LEXICAL && at.name === "let") {
403
+ this.raise(Errors.LetInLexicalBinding, at);
404
+ }
405
+ if (!(bindingType & BindingFlag.TYPE_NONE)) {
406
+ this.declareNameFromIdentifier(at, bindingType);
407
+ }
408
+ }
409
+ declareNameFromIdentifier(identifier, binding) {
410
+ this.scope.declareName(identifier.name, binding, identifier.loc.start);
411
+ }
412
+ checkToRestConversion(node, allowPattern) {
413
+ switch (node.type) {
414
+ case "ParenthesizedExpression":
415
+ this.checkToRestConversion(node.expression, allowPattern);
416
+ break;
417
+ case "Identifier":
418
+ case "MemberExpression":
419
+ break;
420
+ case "ArrayExpression":
421
+ case "ObjectExpression":
422
+ if (allowPattern) break;
423
+ // falls through (upstream parser grammar)
424
+ default:
425
+ this.raise(Errors.InvalidRestAssignmentPattern, node);
426
+ }
427
+ }
428
+ checkCommaAfterRest(close) {
429
+ if (!this.match(tt.comma)) {
430
+ return false;
431
+ }
432
+ this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest, this.state.startLoc);
433
+ return true;
434
+ }
435
+ }
436
+ export {
437
+ ParseBindingListFlags,
438
+ LValParser as default
439
+ };
@@ -0,0 +1,111 @@
1
+ // Generated from Babel v7.29.8 (MIT); see README.md.
2
+ import UtilParser from "./util.mjs";
3
+ import { SourceLocation } from "../util/location.mjs";
4
+ import { OptionFlags } from "../options.mjs";
5
+ class Node {
6
+ constructor(parser, pos, loc) {
7
+ this.start = pos;
8
+ this.end = 0;
9
+ this.loc = new SourceLocation(loc);
10
+ if (parser?.optionFlags & OptionFlags.Ranges) this.range = [pos, 0];
11
+ if (parser?.filename) this.loc.filename = parser.filename;
12
+ }
13
+ type = "";
14
+ }
15
+ const NodePrototype = Node.prototype;
16
+ {
17
+ NodePrototype.__clone = function() {
18
+ const newNode = new Node(void 0, this.start, this.loc.start);
19
+ const keys = Object.keys(this);
20
+ for (let i = 0, length = keys.length; i < length; i++) {
21
+ const key = keys[i];
22
+ if (key !== "leadingComments" && key !== "trailingComments" && key !== "innerComments") {
23
+ newNode[key] = this[key];
24
+ }
25
+ }
26
+ return newNode;
27
+ };
28
+ }
29
+ class NodeUtils extends UtilParser {
30
+ startNode() {
31
+ const loc = this.state.startLoc;
32
+ return new Node(this, loc.index, loc);
33
+ }
34
+ startNodeAt(loc) {
35
+ return new Node(this, loc.index, loc);
36
+ }
37
+ startNodeAtNode(type) {
38
+ return this.startNodeAt(type.loc.start);
39
+ }
40
+ finishNode(node, type) {
41
+ return this.finishNodeAt(node, type, this.state.lastTokEndLoc);
42
+ }
43
+ finishNodeAt(node, type, endLoc) {
44
+ node.type = type;
45
+ node.end = endLoc.index;
46
+ node.loc.end = endLoc;
47
+ if (this.optionFlags & OptionFlags.Ranges) node.range[1] = endLoc.index;
48
+ if (this.optionFlags & OptionFlags.AttachComment) {
49
+ this.processComment(node);
50
+ }
51
+ return node;
52
+ }
53
+ resetStartLocation(node, startLoc) {
54
+ node.start = startLoc.index;
55
+ node.loc.start = startLoc;
56
+ if (this.optionFlags & OptionFlags.Ranges) node.range[0] = startLoc.index;
57
+ }
58
+ resetEndLocation(node, endLoc = this.state.lastTokEndLoc) {
59
+ node.end = endLoc.index;
60
+ node.loc.end = endLoc;
61
+ if (this.optionFlags & OptionFlags.Ranges) node.range[1] = endLoc.index;
62
+ }
63
+ resetStartLocationFromNode(node, locationNode) {
64
+ this.resetStartLocation(node, locationNode.loc.start);
65
+ }
66
+ castNodeTo(node, type) {
67
+ node.type = type;
68
+ return node;
69
+ }
70
+ cloneIdentifier(node) {
71
+ const {
72
+ type,
73
+ start,
74
+ end,
75
+ loc,
76
+ range,
77
+ name
78
+ } = node;
79
+ const cloned = Object.create(NodePrototype);
80
+ cloned.type = type;
81
+ cloned.start = start;
82
+ cloned.end = end;
83
+ cloned.loc = loc;
84
+ cloned.range = range;
85
+ cloned.name = name;
86
+ if (node.extra) cloned.extra = node.extra;
87
+ return cloned;
88
+ }
89
+ cloneStringLiteral(node) {
90
+ const {
91
+ type,
92
+ start,
93
+ end,
94
+ loc,
95
+ range,
96
+ extra
97
+ } = node;
98
+ const cloned = Object.create(NodePrototype);
99
+ cloned.type = type;
100
+ cloned.start = start;
101
+ cloned.end = end;
102
+ cloned.loc = loc;
103
+ cloned.range = range;
104
+ cloned.extra = extra;
105
+ cloned.value = node.value;
106
+ return cloned;
107
+ }
108
+ }
109
+ export {
110
+ NodeUtils
111
+ };