@opentf/web 0.3.0 → 0.5.0

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 (179) hide show
  1. package/components/Link.jsx +29 -0
  2. package/core/errors.js +48 -0
  3. package/core/signals.js +188 -0
  4. package/index.js +12 -0
  5. package/package.json +27 -18
  6. package/runtime/context.js +89 -0
  7. package/runtime/dom.js +280 -0
  8. package/runtime/error-boundary.js +109 -0
  9. package/runtime/events.js +17 -0
  10. package/runtime/index.js +16 -0
  11. package/runtime/lifecycle.js +9 -0
  12. package/runtime/mount.js +49 -0
  13. package/runtime/portal.js +59 -0
  14. package/runtime/router.js +246 -0
  15. package/server/builtins.js +11 -0
  16. package/server/index.js +7 -0
  17. package/server/render.js +76 -0
  18. package/server/ssg-runtime.js +109 -0
  19. package/dist/CHANGELOG.md +0 -24
  20. package/dist/babel.config.cjs +0 -6
  21. package/dist/compiler/babel-plugin.cjs +0 -731
  22. package/dist/core/mount.js +0 -32
  23. package/dist/index.js +0 -7
  24. package/dist/node_modules/@babel/core/LICENSE +0 -22
  25. package/dist/node_modules/@babel/core/README.md +0 -19
  26. package/dist/node_modules/@babel/core/lib/config/cache-contexts.js +0 -5
  27. package/dist/node_modules/@babel/core/lib/config/cache-contexts.js.map +0 -1
  28. package/dist/node_modules/@babel/core/lib/config/caching.js +0 -261
  29. package/dist/node_modules/@babel/core/lib/config/caching.js.map +0 -1
  30. package/dist/node_modules/@babel/core/lib/config/config-chain.js +0 -469
  31. package/dist/node_modules/@babel/core/lib/config/config-chain.js.map +0 -1
  32. package/dist/node_modules/@babel/core/lib/config/config-descriptors.js +0 -190
  33. package/dist/node_modules/@babel/core/lib/config/config-descriptors.js.map +0 -1
  34. package/dist/node_modules/@babel/core/lib/config/files/configuration.js +0 -290
  35. package/dist/node_modules/@babel/core/lib/config/files/configuration.js.map +0 -1
  36. package/dist/node_modules/@babel/core/lib/config/files/import.cjs +0 -6
  37. package/dist/node_modules/@babel/core/lib/config/files/import.cjs.map +0 -1
  38. package/dist/node_modules/@babel/core/lib/config/files/index-browser.js +0 -58
  39. package/dist/node_modules/@babel/core/lib/config/files/index-browser.js.map +0 -1
  40. package/dist/node_modules/@babel/core/lib/config/files/index.js +0 -78
  41. package/dist/node_modules/@babel/core/lib/config/files/index.js.map +0 -1
  42. package/dist/node_modules/@babel/core/lib/config/files/module-types.js +0 -203
  43. package/dist/node_modules/@babel/core/lib/config/files/module-types.js.map +0 -1
  44. package/dist/node_modules/@babel/core/lib/config/files/package.js +0 -61
  45. package/dist/node_modules/@babel/core/lib/config/files/package.js.map +0 -1
  46. package/dist/node_modules/@babel/core/lib/config/files/plugins.js +0 -220
  47. package/dist/node_modules/@babel/core/lib/config/files/plugins.js.map +0 -1
  48. package/dist/node_modules/@babel/core/lib/config/files/types.js +0 -5
  49. package/dist/node_modules/@babel/core/lib/config/files/types.js.map +0 -1
  50. package/dist/node_modules/@babel/core/lib/config/files/utils.js +0 -36
  51. package/dist/node_modules/@babel/core/lib/config/files/utils.js.map +0 -1
  52. package/dist/node_modules/@babel/core/lib/config/full.js +0 -312
  53. package/dist/node_modules/@babel/core/lib/config/full.js.map +0 -1
  54. package/dist/node_modules/@babel/core/lib/config/helpers/config-api.js +0 -85
  55. package/dist/node_modules/@babel/core/lib/config/helpers/config-api.js.map +0 -1
  56. package/dist/node_modules/@babel/core/lib/config/helpers/deep-array.js +0 -23
  57. package/dist/node_modules/@babel/core/lib/config/helpers/deep-array.js.map +0 -1
  58. package/dist/node_modules/@babel/core/lib/config/helpers/environment.js +0 -12
  59. package/dist/node_modules/@babel/core/lib/config/helpers/environment.js.map +0 -1
  60. package/dist/node_modules/@babel/core/lib/config/index.js +0 -87
  61. package/dist/node_modules/@babel/core/lib/config/index.js.map +0 -1
  62. package/dist/node_modules/@babel/core/lib/config/item.js +0 -67
  63. package/dist/node_modules/@babel/core/lib/config/item.js.map +0 -1
  64. package/dist/node_modules/@babel/core/lib/config/partial.js +0 -158
  65. package/dist/node_modules/@babel/core/lib/config/partial.js.map +0 -1
  66. package/dist/node_modules/@babel/core/lib/config/pattern-to-regex.js +0 -38
  67. package/dist/node_modules/@babel/core/lib/config/pattern-to-regex.js.map +0 -1
  68. package/dist/node_modules/@babel/core/lib/config/plugin.js +0 -33
  69. package/dist/node_modules/@babel/core/lib/config/plugin.js.map +0 -1
  70. package/dist/node_modules/@babel/core/lib/config/printer.js +0 -113
  71. package/dist/node_modules/@babel/core/lib/config/printer.js.map +0 -1
  72. package/dist/node_modules/@babel/core/lib/config/resolve-targets-browser.js +0 -41
  73. package/dist/node_modules/@babel/core/lib/config/resolve-targets-browser.js.map +0 -1
  74. package/dist/node_modules/@babel/core/lib/config/resolve-targets.js +0 -61
  75. package/dist/node_modules/@babel/core/lib/config/resolve-targets.js.map +0 -1
  76. package/dist/node_modules/@babel/core/lib/config/util.js +0 -31
  77. package/dist/node_modules/@babel/core/lib/config/util.js.map +0 -1
  78. package/dist/node_modules/@babel/core/lib/config/validation/option-assertions.js +0 -277
  79. package/dist/node_modules/@babel/core/lib/config/validation/option-assertions.js.map +0 -1
  80. package/dist/node_modules/@babel/core/lib/config/validation/options.js +0 -187
  81. package/dist/node_modules/@babel/core/lib/config/validation/options.js.map +0 -1
  82. package/dist/node_modules/@babel/core/lib/config/validation/plugins.js +0 -67
  83. package/dist/node_modules/@babel/core/lib/config/validation/plugins.js.map +0 -1
  84. package/dist/node_modules/@babel/core/lib/config/validation/removed.js +0 -68
  85. package/dist/node_modules/@babel/core/lib/config/validation/removed.js.map +0 -1
  86. package/dist/node_modules/@babel/core/lib/errors/config-error.js +0 -18
  87. package/dist/node_modules/@babel/core/lib/errors/config-error.js.map +0 -1
  88. package/dist/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js +0 -98
  89. package/dist/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js.map +0 -1
  90. package/dist/node_modules/@babel/core/lib/gensync-utils/async.js +0 -90
  91. package/dist/node_modules/@babel/core/lib/gensync-utils/async.js.map +0 -1
  92. package/dist/node_modules/@babel/core/lib/gensync-utils/fs.js +0 -31
  93. package/dist/node_modules/@babel/core/lib/gensync-utils/fs.js.map +0 -1
  94. package/dist/node_modules/@babel/core/lib/gensync-utils/functional.js +0 -58
  95. package/dist/node_modules/@babel/core/lib/gensync-utils/functional.js.map +0 -1
  96. package/dist/node_modules/@babel/core/lib/index.js +0 -230
  97. package/dist/node_modules/@babel/core/lib/index.js.map +0 -1
  98. package/dist/node_modules/@babel/core/lib/parse.js +0 -45
  99. package/dist/node_modules/@babel/core/lib/parse.js.map +0 -1
  100. package/dist/node_modules/@babel/core/lib/parser/index.js +0 -85
  101. package/dist/node_modules/@babel/core/lib/parser/index.js.map +0 -1
  102. package/dist/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js +0 -337
  103. package/dist/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js.map +0 -1
  104. package/dist/node_modules/@babel/core/lib/tools/build-external-helpers.js +0 -144
  105. package/dist/node_modules/@babel/core/lib/tools/build-external-helpers.js.map +0 -1
  106. package/dist/node_modules/@babel/core/lib/transform-ast.js +0 -48
  107. package/dist/node_modules/@babel/core/lib/transform-ast.js.map +0 -1
  108. package/dist/node_modules/@babel/core/lib/transform-file-browser.js +0 -23
  109. package/dist/node_modules/@babel/core/lib/transform-file-browser.js.map +0 -1
  110. package/dist/node_modules/@babel/core/lib/transform-file.js +0 -40
  111. package/dist/node_modules/@babel/core/lib/transform-file.js.map +0 -1
  112. package/dist/node_modules/@babel/core/lib/transform.js +0 -47
  113. package/dist/node_modules/@babel/core/lib/transform.js.map +0 -1
  114. package/dist/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js +0 -84
  115. package/dist/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js.map +0 -1
  116. package/dist/node_modules/@babel/core/lib/transformation/file/babel-7-helpers.cjs +0 -4
  117. package/dist/node_modules/@babel/core/lib/transformation/file/babel-7-helpers.cjs.map +0 -1
  118. package/dist/node_modules/@babel/core/lib/transformation/file/file.js +0 -204
  119. package/dist/node_modules/@babel/core/lib/transformation/file/file.js.map +0 -1
  120. package/dist/node_modules/@babel/core/lib/transformation/file/generate.js +0 -84
  121. package/dist/node_modules/@babel/core/lib/transformation/file/generate.js.map +0 -1
  122. package/dist/node_modules/@babel/core/lib/transformation/file/merge-map.js +0 -37
  123. package/dist/node_modules/@babel/core/lib/transformation/file/merge-map.js.map +0 -1
  124. package/dist/node_modules/@babel/core/lib/transformation/index.js +0 -90
  125. package/dist/node_modules/@babel/core/lib/transformation/index.js.map +0 -1
  126. package/dist/node_modules/@babel/core/lib/transformation/normalize-file.js +0 -127
  127. package/dist/node_modules/@babel/core/lib/transformation/normalize-file.js.map +0 -1
  128. package/dist/node_modules/@babel/core/lib/transformation/normalize-opts.js +0 -59
  129. package/dist/node_modules/@babel/core/lib/transformation/normalize-opts.js.map +0 -1
  130. package/dist/node_modules/@babel/core/lib/transformation/plugin-pass.js +0 -48
  131. package/dist/node_modules/@babel/core/lib/transformation/plugin-pass.js.map +0 -1
  132. package/dist/node_modules/@babel/core/lib/transformation/util/clone-deep.js +0 -54
  133. package/dist/node_modules/@babel/core/lib/transformation/util/clone-deep.js.map +0 -1
  134. package/dist/node_modules/@babel/core/lib/vendor/import-meta-resolve.js +0 -1042
  135. package/dist/node_modules/@babel/core/lib/vendor/import-meta-resolve.js.map +0 -1
  136. package/dist/node_modules/@babel/core/package.json +0 -82
  137. package/dist/node_modules/@babel/core/src/config/files/index-browser.ts +0 -115
  138. package/dist/node_modules/@babel/core/src/config/files/index.ts +0 -30
  139. package/dist/node_modules/@babel/core/src/config/resolve-targets-browser.ts +0 -42
  140. package/dist/node_modules/@babel/core/src/config/resolve-targets.ts +0 -54
  141. package/dist/node_modules/@babel/core/src/transform-file-browser.ts +0 -33
  142. package/dist/node_modules/@babel/core/src/transform-file.ts +0 -56
  143. package/dist/node_modules/@babel/helper-module-imports/LICENSE +0 -22
  144. package/dist/node_modules/@babel/helper-module-imports/README.md +0 -19
  145. package/dist/node_modules/@babel/helper-module-imports/lib/import-builder.js +0 -122
  146. package/dist/node_modules/@babel/helper-module-imports/lib/import-builder.js.map +0 -1
  147. package/dist/node_modules/@babel/helper-module-imports/lib/import-injector.js +0 -304
  148. package/dist/node_modules/@babel/helper-module-imports/lib/import-injector.js.map +0 -1
  149. package/dist/node_modules/@babel/helper-module-imports/lib/index.js +0 -37
  150. package/dist/node_modules/@babel/helper-module-imports/lib/index.js.map +0 -1
  151. package/dist/node_modules/@babel/helper-module-imports/lib/is-module.js +0 -11
  152. package/dist/node_modules/@babel/helper-module-imports/lib/is-module.js.map +0 -1
  153. package/dist/node_modules/@babel/helper-module-imports/package.json +0 -28
  154. package/dist/node_modules/@babel/plugin-syntax-jsx/LICENSE +0 -22
  155. package/dist/node_modules/@babel/plugin-syntax-jsx/README.md +0 -19
  156. package/dist/node_modules/@babel/plugin-syntax-jsx/lib/index.js +0 -21
  157. package/dist/node_modules/@babel/plugin-syntax-jsx/lib/index.js.map +0 -1
  158. package/dist/node_modules/@babel/plugin-syntax-jsx/package.json +0 -33
  159. package/dist/node_modules/@preact/signals-core/CHANGELOG.md +0 -331
  160. package/dist/node_modules/@preact/signals-core/LICENSE +0 -21
  161. package/dist/node_modules/@preact/signals-core/README.md +0 -258
  162. package/dist/node_modules/@preact/signals-core/dist/signals-core.d.ts +0 -149
  163. package/dist/node_modules/@preact/signals-core/dist/signals-core.js +0 -1
  164. package/dist/node_modules/@preact/signals-core/dist/signals-core.js.map +0 -1
  165. package/dist/node_modules/@preact/signals-core/dist/signals-core.min.js +0 -1
  166. package/dist/node_modules/@preact/signals-core/dist/signals-core.min.js.map +0 -1
  167. package/dist/node_modules/@preact/signals-core/dist/signals-core.mjs +0 -1
  168. package/dist/node_modules/@preact/signals-core/dist/signals-core.mjs.map +0 -1
  169. package/dist/node_modules/@preact/signals-core/dist/signals-core.module.js +0 -1
  170. package/dist/node_modules/@preact/signals-core/dist/signals-core.module.js.map +0 -1
  171. package/dist/node_modules/@preact/signals-core/package.json +0 -48
  172. package/dist/node_modules/@preact/signals-core/src/index.ts +0 -1121
  173. package/dist/package.json +0 -30
  174. package/dist/router/Link.js +0 -73
  175. package/dist/router/index.js +0 -216
  176. package/dist/runtime/For.js +0 -16
  177. package/dist/runtime/dom.js +0 -73
  178. package/dist/runtime/lifecycle.js +0 -25
  179. package/dist/runtime/props.js +0 -103
@@ -1 +0,0 @@
1
- {"version":3,"names":["_removed","require","_optionAssertions","_configError","ROOT_VALIDATORS","cwd","assertString","root","rootMode","assertRootMode","configFile","assertConfigFileSearch","caller","assertCallerMetadata","filename","filenameRelative","code","assertBoolean","ast","cloneInputAst","envName","BABELRC_VALIDATORS","babelrc","babelrcRoots","assertBabelrcSearch","NONPRESET_VALIDATORS","extends","ignore","assertIgnoreList","only","targets","assertTargets","browserslistConfigFile","browserslistEnv","COMMON_VALIDATORS","inputSourceMap","assertInputSourceMap","presets","assertPluginList","plugins","passPerPreset","assumptions","assertAssumptions","env","assertEnvSet","overrides","assertOverridesList","test","assertConfigApplicableTest","include","exclude","retainLines","comments","shouldPrintComment","assertFunction","compact","assertCompact","minified","auxiliaryCommentBefore","auxiliaryCommentAfter","sourceType","assertSourceType","wrapPluginVisitorMethod","highlightCode","sourceMaps","assertSourceMaps","sourceMap","sourceFileName","sourceRoot","parserOpts","assertObject","generatorOpts","Object","assign","getModuleId","moduleRoot","moduleIds","moduleId","knownAssumptions","assumptionsNames","exports","Set","getSource","loc","type","source","parent","validate","opts","validateNested","error","configError","ConfigError","message","assertNoDuplicateSourcemap","keys","forEach","key","optLoc","name","Error","msg","validator","throwUnknownError","removed","version","unknownOptErr","hasOwnProperty","call","value","obj","access","envLoc","arr","assertArray","index","item","entries","objLoc","overridesLoc","checkNoUnwrappedItemOptionPairs","items","e","lastItem","thisItem","file","options","undefined","request","JSON","stringify"],"sources":["../../../src/config/validation/options.ts"],"sourcesContent":["import type { InputTargets, Targets } from \"@babel/helper-compilation-targets\";\n\nimport type { ConfigItem } from \"../item.ts\";\n\nimport removed from \"./removed.ts\";\nimport {\n msg,\n access,\n assertString,\n assertBoolean,\n assertObject,\n assertArray,\n assertCallerMetadata,\n assertInputSourceMap,\n assertIgnoreList,\n assertPluginList,\n assertConfigApplicableTest,\n assertConfigFileSearch,\n assertBabelrcSearch,\n assertFunction,\n assertRootMode,\n assertSourceMaps,\n assertCompact,\n assertSourceType,\n assertTargets,\n assertAssumptions,\n} from \"./option-assertions.ts\";\nimport type {\n ValidatorSet,\n Validator,\n OptionPath,\n} from \"./option-assertions.ts\";\nimport type { UnloadedDescriptor } from \"../config-descriptors.ts\";\nimport type { PluginAPI } from \"../helpers/config-api.ts\";\nimport type { ParserOptions } from \"@babel/parser\";\nimport type { GeneratorOptions } from \"@babel/generator\";\nimport type { VisitWrapper } from \"@babel/traverse\";\nimport ConfigError from \"../../errors/config-error.ts\";\nimport type { PluginObject } from \"./plugins.ts\";\nimport type Plugin from \"../plugin.ts\";\nimport type { PresetAPI } from \"../index.ts\";\nimport type { PresetObject } from \"../../index.ts\";\n\nconst ROOT_VALIDATORS: ValidatorSet = {\n cwd: assertString as Validator<InputOptions[\"cwd\"]>,\n root: assertString as Validator<InputOptions[\"root\"]>,\n rootMode: assertRootMode as Validator<InputOptions[\"rootMode\"]>,\n configFile: assertConfigFileSearch as Validator<InputOptions[\"configFile\"]>,\n\n caller: assertCallerMetadata as Validator<InputOptions[\"caller\"]>,\n filename: assertString as Validator<InputOptions[\"filename\"]>,\n filenameRelative: assertString as Validator<InputOptions[\"filenameRelative\"]>,\n code: assertBoolean as Validator<InputOptions[\"code\"]>,\n ast: assertBoolean as Validator<InputOptions[\"ast\"]>,\n\n cloneInputAst: assertBoolean as Validator<InputOptions[\"cloneInputAst\"]>,\n\n envName: assertString as Validator<InputOptions[\"envName\"]>,\n};\n\nconst BABELRC_VALIDATORS: ValidatorSet = {\n babelrc: assertBoolean as Validator<InputOptions[\"babelrc\"]>,\n babelrcRoots: assertBabelrcSearch as Validator<InputOptions[\"babelrcRoots\"]>,\n};\n\nconst NONPRESET_VALIDATORS: ValidatorSet = {\n extends: assertString as Validator<InputOptions[\"extends\"]>,\n ignore: assertIgnoreList as Validator<InputOptions[\"ignore\"]>,\n only: assertIgnoreList as Validator<InputOptions[\"only\"]>,\n\n targets: assertTargets as Validator<InputOptions[\"targets\"]>,\n browserslistConfigFile: assertConfigFileSearch as Validator<\n InputOptions[\"browserslistConfigFile\"]\n >,\n browserslistEnv: assertString as Validator<InputOptions[\"browserslistEnv\"]>,\n};\n\nconst COMMON_VALIDATORS: ValidatorSet = {\n // TODO: Should 'inputSourceMap' be moved to be a root-only option?\n // We may want a boolean-only version to be a common option, with the\n // object only allowed as a root config argument.\n inputSourceMap: assertInputSourceMap as Validator<\n InputOptions[\"inputSourceMap\"]\n >,\n presets: assertPluginList as Validator<InputOptions[\"presets\"]>,\n plugins: assertPluginList as Validator<InputOptions[\"plugins\"]>,\n passPerPreset: assertBoolean as Validator<InputOptions[\"passPerPreset\"]>,\n assumptions: assertAssumptions as Validator<InputOptions[\"assumptions\"]>,\n\n env: assertEnvSet as Validator<InputOptions[\"env\"]>,\n overrides: assertOverridesList as Validator<InputOptions[\"overrides\"]>,\n\n // We could limit these to 'overrides' blocks, but it's not clear why we'd\n // bother, when the ability to limit a config to a specific set of files\n // is a fairly general useful feature.\n test: assertConfigApplicableTest as Validator<InputOptions[\"test\"]>,\n include: assertConfigApplicableTest as Validator<InputOptions[\"include\"]>,\n exclude: assertConfigApplicableTest as Validator<InputOptions[\"exclude\"]>,\n\n retainLines: assertBoolean as Validator<InputOptions[\"retainLines\"]>,\n comments: assertBoolean as Validator<InputOptions[\"comments\"]>,\n shouldPrintComment: assertFunction as Validator<\n InputOptions[\"shouldPrintComment\"]\n >,\n compact: assertCompact as Validator<InputOptions[\"compact\"]>,\n minified: assertBoolean as Validator<InputOptions[\"minified\"]>,\n auxiliaryCommentBefore: assertString as Validator<\n InputOptions[\"auxiliaryCommentBefore\"]\n >,\n auxiliaryCommentAfter: assertString as Validator<\n InputOptions[\"auxiliaryCommentAfter\"]\n >,\n sourceType: assertSourceType as Validator<InputOptions[\"sourceType\"]>,\n wrapPluginVisitorMethod: assertFunction as Validator<\n InputOptions[\"wrapPluginVisitorMethod\"]\n >,\n highlightCode: assertBoolean as Validator<InputOptions[\"highlightCode\"]>,\n sourceMaps: assertSourceMaps as Validator<InputOptions[\"sourceMaps\"]>,\n sourceMap: assertSourceMaps as Validator<InputOptions[\"sourceMap\"]>,\n sourceFileName: assertString as Validator<InputOptions[\"sourceFileName\"]>,\n sourceRoot: assertString as Validator<InputOptions[\"sourceRoot\"]>,\n parserOpts: assertObject as Validator<InputOptions[\"parserOpts\"]>,\n generatorOpts: assertObject as Validator<InputOptions[\"generatorOpts\"]>,\n};\nif (!process.env.BABEL_8_BREAKING) {\n Object.assign(COMMON_VALIDATORS, {\n getModuleId: assertFunction,\n moduleRoot: assertString,\n moduleIds: assertBoolean,\n moduleId: assertString,\n });\n}\n\ntype Assumptions = {\n arrayLikeIsIterable?: boolean;\n constantReexports?: boolean;\n constantSuper?: boolean;\n enumerableModuleMeta?: boolean;\n ignoreFunctionLength?: boolean;\n ignoreToPrimitiveHint?: boolean;\n iterableIsArray?: boolean;\n mutableTemplateObject?: boolean;\n noClassCalls?: boolean;\n noDocumentAll?: boolean;\n noIncompleteNsImportDetection?: boolean;\n noNewArrows?: boolean;\n noUninitializedPrivateFieldAccess?: boolean;\n objectRestNoSymbols?: boolean;\n privateFieldsAsProperties?: boolean;\n privateFieldsAsSymbols?: boolean;\n pureGetters?: boolean;\n setClassMethods?: boolean;\n setComputedProperties?: boolean;\n setPublicClassFields?: boolean;\n setSpreadProperties?: boolean;\n skipForOfIteratorClosing?: boolean;\n superIsCallableConstructor?: boolean;\n};\n\nexport type AssumptionName = keyof Assumptions;\n\nexport type InputOptions = {\n cwd?: string;\n filename?: string;\n filenameRelative?: string;\n babelrc?: boolean;\n babelrcRoots?: BabelrcSearch;\n configFile?: ConfigFileSearch;\n root?: string;\n rootMode?: RootMode;\n code?: boolean;\n ast?: boolean;\n cloneInputAst?: boolean;\n inputSourceMap?: RootInputSourceMapOption;\n envName?: string;\n caller?: CallerMetadata;\n extends?: string;\n env?: EnvSet<InputOptions>;\n ignore?: MatchItem[];\n only?: MatchItem[];\n overrides?: InputOptions[];\n showIgnoredFiles?: boolean;\n // Generally verify if a given config object should be applied to the given file.\n test?: ConfigApplicableTest;\n include?: ConfigApplicableTest;\n exclude?: ConfigApplicableTest;\n presets?: PresetItem[];\n plugins?: PluginItem[];\n passPerPreset?: boolean;\n assumptions?: Assumptions;\n // browserslists-related options\n targets?: TargetsListOrObject;\n browserslistConfigFile?: ConfigFileSearch;\n browserslistEnv?: string;\n // Options for @babel/generator\n retainLines?: GeneratorOptions[\"retainLines\"];\n comments?: GeneratorOptions[\"comments\"];\n shouldPrintComment?: GeneratorOptions[\"shouldPrintComment\"];\n compact?: GeneratorOptions[\"compact\"];\n minified?: GeneratorOptions[\"minified\"];\n auxiliaryCommentBefore?: GeneratorOptions[\"auxiliaryCommentBefore\"];\n auxiliaryCommentAfter?: GeneratorOptions[\"auxiliaryCommentAfter\"];\n // Parser\n sourceType?: SourceTypeOption;\n wrapPluginVisitorMethod?: VisitWrapper | null;\n highlightCode?: boolean;\n // Sourcemap generation options.\n sourceMaps?: SourceMapsOption;\n sourceMap?: SourceMapsOption;\n sourceFileName?: string;\n sourceRoot?: string;\n // Todo(Babel 9): Deprecate top level parserOpts\n parserOpts?: ParserOptions;\n // Todo(Babel 9): Deprecate top level generatorOpts\n generatorOpts?: GeneratorOptions;\n};\n\nexport type NormalizedOptions = Omit<InputOptions, \"presets\" | \"plugins\"> & {\n assumptions: Assumptions;\n targets: Targets;\n cloneInputAst: boolean;\n babelrc: false;\n configFile: false;\n browserslistConfigFile: false;\n passPerPreset: false;\n envName: string;\n cwd: string;\n root: string;\n rootMode: \"root\";\n filename: string | undefined;\n presets: ConfigItem<PresetAPI>[];\n plugins: ConfigItem<PluginAPI>[];\n};\n\nexport type ResolvedOptions = Omit<\n NormalizedOptions,\n \"presets\" | \"plugins\" | \"passPerPreset\"\n> & {\n presets: { plugins: Plugin[] }[];\n plugins: Plugin[];\n passPerPreset: boolean;\n};\n\nexport type ConfigChainOptions = Omit<\n InputOptions,\n | \"extends\"\n | \"env\"\n | \"overrides\"\n | \"plugins\"\n | \"presets\"\n | \"passPerPreset\"\n | \"ignore\"\n | \"only\"\n | \"test\"\n | \"include\"\n | \"exclude\"\n | \"sourceMap\"\n>;\n\nexport type CallerMetadata = {\n // If 'caller' is specified, require that the name is given for debugging\n // messages.\n name: string;\n supportsStaticESM?: boolean;\n supportsDynamicImport?: boolean;\n supportsTopLevelAwait?: boolean;\n supportsExportNamespaceFrom?: boolean;\n};\nexport type EnvSet<T> = Record<string, T>;\nexport type MatchItem =\n | string\n | RegExp\n | ((\n path: string | undefined,\n context: { dirname: string; caller: CallerMetadata; envName: string },\n ) => unknown);\n\nexport type MaybeDefaultProperty<T> = T | { default: T };\n\nexport type PluginTarget =\n | string\n | MaybeDefaultProperty<\n (api: PluginAPI, options?: object, dirname?: string) => PluginObject\n >;\nexport type PluginItem =\n | ConfigItem<PluginAPI>\n | PluginTarget\n | [PluginTarget, object]\n | [PluginTarget, object, string];\n\nexport type PresetTarget =\n | string\n | MaybeDefaultProperty<\n (api: PresetAPI, options?: object, dirname?: string) => PresetObject\n >;\nexport type PresetItem =\n | ConfigItem<PresetAPI>\n | PresetTarget\n | [PresetTarget, object]\n | [PresetTarget, object, string];\n\nexport type ConfigApplicableTest = MatchItem | MatchItem[];\n\nexport type ConfigFileSearch = string | boolean;\nexport type BabelrcSearch = boolean | MatchItem | MatchItem[];\nexport type SourceMapsOption = boolean | \"inline\" | \"both\";\nexport type SourceTypeOption = \"module\" | \"commonjs\" | \"script\" | \"unambiguous\";\nexport type CompactOption = boolean | \"auto\";\n// https://github.com/mozilla/source-map/blob/801be934007c3ed0ef66c620641b1668e92c891d/source-map.d.ts#L15C8-L23C2\ninterface InputSourceMap {\n version: number;\n sources: string[];\n names: string[];\n sourceRoot?: string | undefined;\n sourcesContent?: string[] | undefined;\n mappings: string;\n file: string;\n}\nexport type RootInputSourceMapOption = InputSourceMap | boolean;\nexport type RootMode = \"root\" | \"upward\" | \"upward-optional\";\n\nexport type TargetsListOrObject =\n | Targets\n | InputTargets\n | InputTargets[\"browsers\"];\n\nexport type OptionsSource =\n | \"arguments\"\n | \"configfile\"\n | \"babelrcfile\"\n | \"extendsfile\"\n | \"preset\"\n | \"plugin\";\n\nexport type RootPath = Readonly<{\n type: \"root\";\n source: OptionsSource;\n}>;\n\ntype OverridesPath = Readonly<{\n type: \"overrides\";\n index: number;\n parent: RootPath;\n}>;\n\ntype EnvPath = Readonly<{\n type: \"env\";\n name: string;\n parent: RootPath | OverridesPath;\n}>;\n\nexport type NestingPath = RootPath | OverridesPath | EnvPath;\n\nconst knownAssumptions = [\n \"arrayLikeIsIterable\",\n \"constantReexports\",\n \"constantSuper\",\n \"enumerableModuleMeta\",\n \"ignoreFunctionLength\",\n \"ignoreToPrimitiveHint\",\n \"iterableIsArray\",\n \"mutableTemplateObject\",\n \"noClassCalls\",\n \"noDocumentAll\",\n \"noIncompleteNsImportDetection\",\n \"noNewArrows\",\n \"noUninitializedPrivateFieldAccess\",\n \"objectRestNoSymbols\",\n \"privateFieldsAsSymbols\",\n \"privateFieldsAsProperties\",\n \"pureGetters\",\n \"setClassMethods\",\n \"setComputedProperties\",\n \"setPublicClassFields\",\n \"setSpreadProperties\",\n \"skipForOfIteratorClosing\",\n \"superIsCallableConstructor\",\n] as const;\nexport const assumptionsNames = new Set(knownAssumptions);\n\nfunction getSource(loc: NestingPath): OptionsSource {\n return loc.type === \"root\" ? loc.source : getSource(loc.parent);\n}\n\nexport function validate(\n type: OptionsSource,\n opts: any,\n filename?: string,\n): InputOptions {\n try {\n return validateNested(\n {\n type: \"root\",\n source: type,\n },\n opts,\n );\n } catch (error) {\n const configError = new ConfigError(error.message, filename);\n // @ts-expect-error TODO: .code is not defined on ConfigError or Error\n if (error.code) configError.code = error.code;\n throw configError;\n }\n}\n\nfunction validateNested(loc: NestingPath, opts: Record<string, unknown>) {\n const type = getSource(loc);\n assertNoDuplicateSourcemap(opts);\n\n Object.keys(opts).forEach((key: string) => {\n const optLoc = {\n type: \"option\",\n name: key,\n parent: loc,\n } as const;\n\n if (type === \"preset\" && NONPRESET_VALIDATORS[key]) {\n throw new Error(`${msg(optLoc)} is not allowed in preset options`);\n }\n if (type !== \"arguments\" && ROOT_VALIDATORS[key]) {\n throw new Error(\n `${msg(optLoc)} is only allowed in root programmatic options`,\n );\n }\n if (\n type !== \"arguments\" &&\n type !== \"configfile\" &&\n BABELRC_VALIDATORS[key]\n ) {\n if (type === \"babelrcfile\" || type === \"extendsfile\") {\n throw new Error(\n `${msg(\n optLoc,\n )} is not allowed in .babelrc or \"extends\"ed files, only in root programmatic options, ` +\n `or babel.config.js/config file options`,\n );\n }\n\n throw new Error(\n `${msg(\n optLoc,\n )} is only allowed in root programmatic options, or babel.config.js/config file options`,\n );\n }\n\n const validator =\n COMMON_VALIDATORS[key] ||\n NONPRESET_VALIDATORS[key] ||\n BABELRC_VALIDATORS[key] ||\n ROOT_VALIDATORS[key] ||\n (throwUnknownError as Validator<void>);\n\n validator(optLoc, opts[key]);\n });\n\n return opts;\n}\n\nfunction throwUnknownError(loc: OptionPath) {\n const key = loc.name;\n\n if (removed[key]) {\n const { message, version = 5 } = removed[key];\n\n throw new Error(\n `Using removed Babel ${version} option: ${msg(loc)} - ${message}`,\n );\n } else {\n const unknownOptErr = new Error(\n `Unknown option: ${msg(\n loc,\n )}. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.`,\n );\n // @ts-expect-error todo(flow->ts): consider creating something like BabelConfigError with code field in it\n unknownOptErr.code = \"BABEL_UNKNOWN_OPTION\";\n\n throw unknownOptErr;\n }\n}\n\nfunction assertNoDuplicateSourcemap(opts: any): void {\n if (Object.hasOwn(opts, \"sourceMap\") && Object.hasOwn(opts, \"sourceMaps\")) {\n throw new Error(\".sourceMap is an alias for .sourceMaps, cannot use both\");\n }\n}\n\nfunction assertEnvSet(\n loc: OptionPath,\n value: unknown,\n): void | EnvSet<InputOptions> {\n if (loc.parent.type === \"env\") {\n throw new Error(`${msg(loc)} is not allowed inside of another .env block`);\n }\n const parent: RootPath | OverridesPath = loc.parent;\n\n const obj = assertObject(loc, value);\n if (obj) {\n // Validate but don't copy the .env object in order to preserve\n // object identity for use during config chain processing.\n for (const envName of Object.keys(obj)) {\n const env = assertObject(access(loc, envName), obj[envName]);\n if (!env) continue;\n\n const envLoc = {\n type: \"env\",\n name: envName,\n parent,\n } as const;\n validateNested(envLoc, env);\n }\n }\n return obj;\n}\n\nfunction assertOverridesList(\n loc: OptionPath,\n value: unknown[],\n): undefined | InputOptions[] {\n if (loc.parent.type === \"env\") {\n throw new Error(`${msg(loc)} is not allowed inside an .env block`);\n }\n if (loc.parent.type === \"overrides\") {\n throw new Error(`${msg(loc)} is not allowed inside an .overrides block`);\n }\n const parent: RootPath = loc.parent;\n\n const arr = assertArray(loc, value);\n if (arr) {\n for (const [index, item] of arr.entries()) {\n const objLoc = access(loc, index);\n const env = assertObject(objLoc, item);\n if (!env) throw new Error(`${msg(objLoc)} must be an object`);\n\n const overridesLoc = {\n type: \"overrides\",\n index,\n parent,\n } as const;\n validateNested(overridesLoc, env);\n }\n }\n return arr;\n}\n\nexport function checkNoUnwrappedItemOptionPairs<API>(\n items: UnloadedDescriptor<API>[],\n index: number,\n type: \"plugin\" | \"preset\",\n e: Error,\n): void {\n if (index === 0) return;\n\n const lastItem = items[index - 1];\n const thisItem = items[index];\n\n if (\n lastItem.file &&\n lastItem.options === undefined &&\n typeof thisItem.value === \"object\"\n ) {\n e.message +=\n `\\n- Maybe you meant to use\\n` +\n `\"${type}s\": [\\n [\"${lastItem.file.request}\", ${JSON.stringify(\n thisItem.value,\n undefined,\n 2,\n )}]\\n]\\n` +\n `To be a valid ${type}, its name and options should be wrapped in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EC,IAAI,CAAC,IAAIH,GAAG,CAACI,OAAO,CAAC,CAAC,EAAE;MACzC,MAAMC,MAAM,GAAG,IAAAP,wBAAM,EAAC5B,GAAG,EAAEgC,KAAK,CAAC;MACjC,MAAMxE,GAAG,GAAG,IAAA2B,8BAAY,EAACgD,MAAM,EAAEF,IAAI,CAAC;MACtC,IAAI,CAACzE,GAAG,EAAE,MAAM,IAAIyD,KAAK,CAAC,GAAG,IAAAC,qBAAG,EAACiB,MAAM,CAAC,oBAAoB,CAAC;MAE7D,MAAMC,YAAY,GAAG;QACnBnC,IAAI,EAAE,WAAW;QACjB+B,KAAK;QACL7B;MACF,CAAU;MACVG,cAAc,CAAC8B,YAAY,EAAE5E,GAAG,CAAC;IACnC;EACF;EACA,OAAOsE,GAAG;AACZ;AAEO,SAASO,+BAA+BA,CAC7CC,KAAgC,EAChCN,KAAa,EACb/B,IAAyB,EACzBsC,CAAQ,EACF;EACN,IAAIP,KAAK,KAAK,CAAC,EAAE;EAEjB,MAAMQ,QAAQ,GAAGF,KAAK,CAACN,KAAK,GAAG,CAAC,CAAC;EACjC,MAAMS,QAAQ,GAAGH,KAAK,CAACN,KAAK,CAAC;EAE7B,IACEQ,QAAQ,CAACE,IAAI,IACbF,QAAQ,CAACG,OAAO,KAAKC,SAAS,IAC9B,OAAOH,QAAQ,CAACf,KAAK,KAAK,QAAQ,EAClC;IACAa,CAAC,CAAC7B,OAAO,IACP,8BAA8B,GAC9B,IAAIT,IAAI,cAAcuC,QAAQ,CAACE,IAAI,CAACG,OAAO,MAAMC,IAAI,CAACC,SAAS,CAC7DN,QAAQ,CAACf,KAAK,EACdkB,SAAS,EACT,CACF,CAAC,QAAQ,GACT,iBAAiB3C,IAAI,gEAAgE;EACzF;AACF;AAAC","ignoreList":[]}
@@ -1,67 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.validatePluginObject = validatePluginObject;
7
- var _optionAssertions = require("./option-assertions.js");
8
- const VALIDATORS = {
9
- name: _optionAssertions.assertString,
10
- manipulateOptions: _optionAssertions.assertFunction,
11
- pre: _optionAssertions.assertFunction,
12
- post: _optionAssertions.assertFunction,
13
- inherits: _optionAssertions.assertFunction,
14
- visitor: assertVisitorMap,
15
- parserOverride: _optionAssertions.assertFunction,
16
- generatorOverride: _optionAssertions.assertFunction
17
- };
18
- function assertVisitorMap(loc, value) {
19
- const obj = (0, _optionAssertions.assertObject)(loc, value);
20
- if (obj) {
21
- Object.keys(obj).forEach(prop => {
22
- if (prop !== "_exploded" && prop !== "_verified") {
23
- assertVisitorHandler(prop, obj[prop]);
24
- }
25
- });
26
- if (obj.enter || obj.exit) {
27
- throw new Error(`${(0, _optionAssertions.msg)(loc)} cannot contain catch-all "enter" or "exit" handlers. Please target individual nodes.`);
28
- }
29
- }
30
- return obj;
31
- }
32
- function assertVisitorHandler(key, value) {
33
- if (value && typeof value === "object") {
34
- Object.keys(value).forEach(handler => {
35
- if (handler !== "enter" && handler !== "exit") {
36
- throw new Error(`.visitor["${key}"] may only have .enter and/or .exit handlers.`);
37
- }
38
- });
39
- } else if (typeof value !== "function") {
40
- throw new Error(`.visitor["${key}"] must be a function`);
41
- }
42
- }
43
- function validatePluginObject(obj) {
44
- const rootPath = {
45
- type: "root",
46
- source: "plugin"
47
- };
48
- Object.keys(obj).forEach(key => {
49
- const validator = VALIDATORS[key];
50
- if (validator) {
51
- const optLoc = {
52
- type: "option",
53
- name: key,
54
- parent: rootPath
55
- };
56
- validator(optLoc, obj[key]);
57
- } else {
58
- const invalidPluginPropertyError = new Error(`.${key} is not a valid Plugin property`);
59
- invalidPluginPropertyError.code = "BABEL_UNKNOWN_PLUGIN_PROPERTY";
60
- throw invalidPluginPropertyError;
61
- }
62
- });
63
- return obj;
64
- }
65
- 0 && 0;
66
-
67
- //# sourceMappingURL=plugins.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_optionAssertions","require","VALIDATORS","name","assertString","manipulateOptions","assertFunction","pre","post","inherits","visitor","assertVisitorMap","parserOverride","generatorOverride","loc","value","obj","assertObject","Object","keys","forEach","prop","assertVisitorHandler","enter","exit","Error","msg","key","handler","validatePluginObject","rootPath","type","source","validator","optLoc","parent","invalidPluginPropertyError","code"],"sources":["../../../src/config/validation/plugins.ts"],"sourcesContent":["import {\n assertString,\n assertFunction,\n assertObject,\n msg,\n} from \"./option-assertions.ts\";\n\nimport type {\n ValidatorSet,\n Validator,\n OptionPath,\n RootPath,\n} from \"./option-assertions.ts\";\nimport type { parse, ParserOptions } from \"@babel/parser\";\nimport type { Visitor } from \"@babel/traverse\";\nimport type { ResolvedOptions } from \"./options.ts\";\nimport type { File, PluginAPI, PluginPass } from \"../../index.ts\";\nimport type { GeneratorOptions, GeneratorResult } from \"@babel/generator\";\nimport type babelGenerator from \"@babel/generator\";\n\n// Note: The casts here are just meant to be static assertions to make sure\n// that the assertion functions actually assert that the value's type matches\n// the declared types.\nconst VALIDATORS: ValidatorSet = {\n name: assertString as Validator<PluginObject[\"name\"]>,\n manipulateOptions: assertFunction as Validator<\n PluginObject[\"manipulateOptions\"]\n >,\n pre: assertFunction as Validator<PluginObject[\"pre\"]>,\n post: assertFunction as Validator<PluginObject[\"post\"]>,\n inherits: assertFunction as Validator<PluginObject[\"inherits\"]>,\n visitor: assertVisitorMap as Validator<PluginObject[\"visitor\"]>,\n\n parserOverride: assertFunction as Validator<PluginObject[\"parserOverride\"]>,\n generatorOverride: assertFunction as Validator<\n PluginObject[\"generatorOverride\"]\n >,\n};\n\nfunction assertVisitorMap(loc: OptionPath, value: unknown): Visitor {\n const obj = assertObject(loc, value);\n if (obj) {\n Object.keys(obj).forEach(prop => {\n if (prop !== \"_exploded\" && prop !== \"_verified\") {\n assertVisitorHandler(prop, obj[prop]);\n }\n });\n\n if (obj.enter || obj.exit) {\n throw new Error(\n `${msg(\n loc,\n )} cannot contain catch-all \"enter\" or \"exit\" handlers. Please target individual nodes.`,\n );\n }\n }\n return obj as Visitor;\n}\n\nfunction assertVisitorHandler(\n key: string,\n value: unknown,\n): asserts value is VisitorHandler {\n if (value && typeof value === \"object\") {\n Object.keys(value).forEach((handler: string) => {\n if (handler !== \"enter\" && handler !== \"exit\") {\n throw new Error(\n `.visitor[\"${key}\"] may only have .enter and/or .exit handlers.`,\n );\n }\n });\n } else if (typeof value !== \"function\") {\n throw new Error(`.visitor[\"${key}\"] must be a function`);\n }\n}\n\ntype VisitorHandler =\n | Function\n | {\n enter?: Function;\n exit?: Function;\n };\n\nexport type PluginObject<S extends PluginPass = PluginPass> = {\n name?: string;\n manipulateOptions?: (\n options: ResolvedOptions,\n parserOpts: ParserOptions,\n ) => void;\n pre?: (this: S, file: File) => void | Promise<void>;\n post?: (this: S, file: File) => void | Promise<void>;\n inherits?: (\n api: PluginAPI,\n options: unknown,\n dirname: string,\n ) => PluginObject;\n visitor?: Visitor<S>;\n parserOverride?: (\n ...args: [...Parameters<typeof parse>, typeof parse]\n ) => ReturnType<typeof parse>;\n generatorOverride?: (\n ast: File[\"ast\"],\n generatorOpts: GeneratorOptions,\n code: File[\"code\"],\n generate: typeof babelGenerator,\n ) => GeneratorResult;\n};\n\nexport function validatePluginObject(\n obj: Record<string, unknown>,\n): PluginObject {\n const rootPath: RootPath = {\n type: \"root\",\n source: \"plugin\",\n };\n Object.keys(obj).forEach((key: string) => {\n const validator = VALIDATORS[key];\n\n if (validator) {\n const optLoc: OptionPath = {\n type: \"option\",\n name: key,\n parent: rootPath,\n };\n validator(optLoc, obj[key]);\n } else {\n const invalidPluginPropertyError = new Error(\n `.${key} is not a valid Plugin property`,\n );\n // @ts-expect-error todo(flow->ts) consider adding BabelConfigError with code field\n invalidPluginPropertyError.code = \"BABEL_UNKNOWN_PLUGIN_PROPERTY\";\n throw invalidPluginPropertyError;\n }\n });\n\n return obj as any;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAuBA,MAAMC,UAAwB,GAAG;EAC/BC,IAAI,EAAEC,8BAA+C;EACr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,oBAAoBA,CAClCb,GAA4B,EACd;EACd,MAAMc,QAAkB,GAAG;IACzBC,IAAI,EAAE,MAAM;IACZC,MAAM,EAAE;EACV,CAAC;EACDd,MAAM,CAACC,IAAI,CAACH,GAAG,CAAC,CAACI,OAAO,CAAEO,GAAW,IAAK;IACxC,MAAMM,SAAS,GAAG/B,UAAU,CAACyB,GAAG,CAAC;IAEjC,IAAIM,SAAS,EAAE;MACb,MAAMC,MAAkB,GAAG;QACzBH,IAAI,EAAE,QAAQ;QACd5B,IAAI,EAAEwB,GAAG;QACTQ,MAAM,EAAEL;MACV,CAAC;MACDG,SAAS,CAACC,MAAM,EAAElB,GAAG,CAACW,GAAG,CAAC,CAAC;IAC7B,CAAC,MAAM;MACL,MAAMS,0BAA0B,GAAG,IAAIX,KAAK,CAC1C,IAAIE,GAAG,iCACT,CAAC;MAEDS,0BAA0B,CAACC,IAAI,GAAG,+BAA+B;MACjE,MAAMD,0BAA0B;IAClC;EACF,CAAC,CAAC;EAEF,OAAOpB,GAAG;AACZ;AAAC","ignoreList":[]}
@@ -1,68 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _default = exports.default = {
8
- auxiliaryComment: {
9
- message: "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`"
10
- },
11
- blacklist: {
12
- message: "Put the specific transforms you want in the `plugins` option"
13
- },
14
- breakConfig: {
15
- message: "This is not a necessary option in Babel 6"
16
- },
17
- experimental: {
18
- message: "Put the specific transforms you want in the `plugins` option"
19
- },
20
- externalHelpers: {
21
- message: "Use the `external-helpers` plugin instead. " + "Check out http://babeljs.io/docs/plugins/external-helpers/"
22
- },
23
- extra: {
24
- message: ""
25
- },
26
- jsxPragma: {
27
- message: "use the `pragma` option in the `react-jsx` plugin. " + "Check out http://babeljs.io/docs/plugins/transform-react-jsx/"
28
- },
29
- loose: {
30
- message: "Specify the `loose` option for the relevant plugin you are using " + "or use a preset that sets the option."
31
- },
32
- metadataUsedHelpers: {
33
- message: "Not required anymore as this is enabled by default"
34
- },
35
- modules: {
36
- message: "Use the corresponding module transform plugin in the `plugins` option. " + "Check out http://babeljs.io/docs/plugins/#modules"
37
- },
38
- nonStandard: {
39
- message: "Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. " + "Also check out the react preset http://babeljs.io/docs/plugins/preset-react/"
40
- },
41
- optional: {
42
- message: "Put the specific transforms you want in the `plugins` option"
43
- },
44
- sourceMapName: {
45
- message: "The `sourceMapName` option has been removed because it makes more sense for the " + "tooling that calls Babel to assign `map.file` themselves."
46
- },
47
- stage: {
48
- message: "Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets"
49
- },
50
- whitelist: {
51
- message: "Put the specific transforms you want in the `plugins` option"
52
- },
53
- resolveModuleSource: {
54
- version: 6,
55
- message: "Use `babel-plugin-module-resolver@3`'s 'resolvePath' options"
56
- },
57
- metadata: {
58
- version: 6,
59
- message: "Generated plugin metadata is always included in the output result"
60
- },
61
- sourceMapTarget: {
62
- version: 6,
63
- message: "The `sourceMapTarget` option has been removed because it makes more sense for the tooling " + "that calls Babel to assign `map.file` themselves."
64
- }
65
- };
66
- 0 && 0;
67
-
68
- //# sourceMappingURL=removed.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["auxiliaryComment","message","blacklist","breakConfig","experimental","externalHelpers","extra","jsxPragma","loose","metadataUsedHelpers","modules","nonStandard","optional","sourceMapName","stage","whitelist","resolveModuleSource","version","metadata","sourceMapTarget"],"sources":["../../../src/config/validation/removed.ts"],"sourcesContent":["export default {\n auxiliaryComment: {\n message: \"Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`\",\n },\n blacklist: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n breakConfig: {\n message: \"This is not a necessary option in Babel 6\",\n },\n experimental: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n externalHelpers: {\n message:\n \"Use the `external-helpers` plugin instead. \" +\n \"Check out http://babeljs.io/docs/plugins/external-helpers/\",\n },\n extra: {\n message: \"\",\n },\n jsxPragma: {\n message:\n \"use the `pragma` option in the `react-jsx` plugin. \" +\n \"Check out http://babeljs.io/docs/plugins/transform-react-jsx/\",\n },\n loose: {\n message:\n \"Specify the `loose` option for the relevant plugin you are using \" +\n \"or use a preset that sets the option.\",\n },\n metadataUsedHelpers: {\n message: \"Not required anymore as this is enabled by default\",\n },\n modules: {\n message:\n \"Use the corresponding module transform plugin in the `plugins` option. \" +\n \"Check out http://babeljs.io/docs/plugins/#modules\",\n },\n nonStandard: {\n message:\n \"Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. \" +\n \"Also check out the react preset http://babeljs.io/docs/plugins/preset-react/\",\n },\n optional: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n sourceMapName: {\n message:\n \"The `sourceMapName` option has been removed because it makes more sense for the \" +\n \"tooling that calls Babel to assign `map.file` themselves.\",\n },\n stage: {\n message:\n \"Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets\",\n },\n whitelist: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n\n resolveModuleSource: {\n version: 6,\n message: \"Use `babel-plugin-module-resolver@3`'s 'resolvePath' options\",\n },\n metadata: {\n version: 6,\n message:\n \"Generated plugin metadata is always included in the output result\",\n },\n sourceMapTarget: {\n version: 6,\n message:\n \"The `sourceMapTarget` option has been removed because it makes more sense for the tooling \" +\n \"that calls Babel to assign `map.file` themselves.\",\n },\n} as Record<string, { version?: number; message: string }>;\n"],"mappings":";;;;;;iCAAe;EACbA,gBAAgB,EAAE;IAChBC,OAAO,EAAE;EACX,CAAC;EACDC,SAAS,EAAE;IACTD,OAAO,EAAE;EACX,CAAC;EACDE,WAAW,EAAE;IACXF,OAAO,EAAE;EACX,CAAC;EACDG,YAAY,EAAE;IACZH,OAAO,EAAE;EACX,CAAC;EACDI,eAAe,EAAE;IACfJ,OAAO,EACL,6CAA6C,GAC7C;EACJ,CAAC;EACDK,KAAK,EAAE;IACLL,OAAO,EAAE;EACX,CAAC;EACDM,SAAS,EAAE;IACTN,OAAO,EACL,qDAAqD,GACrD;EACJ,CAAC;EACDO,KAAK,EAAE;IACLP,OAAO,EACL,mEAAmE,GACnE;EACJ,CAAC;EACDQ,mBAAmB,EAAE;IACnBR,OAAO,EAAE;EACX,CAAC;EACDS,OAAO,EAAE;IACPT,OAAO,EACL,yEAAyE,GACzE;EACJ,CAAC;EACDU,WAAW,EAAE;IACXV,OAAO,EACL,8EAA8E,GAC9E;EACJ,CAAC;EACDW,QAAQ,EAAE;IACRX,OAAO,EAAE;EACX,CAAC;EACDY,aAAa,EAAE;IACbZ,OAAO,EACL,kFAAkF,GAClF;EACJ,CAAC;EACDa,KAAK,EAAE;IACLb,OAAO,EACL;EACJ,CAAC;EACDc,SAAS,EAAE;IACTd,OAAO,EAAE;EACX,CAAC;EAEDe,mBAAmB,EAAE;IACnBC,OAAO,EAAE,CAAC;IACVhB,OAAO,EAAE;EACX,CAAC;EACDiB,QAAQ,EAAE;IACRD,OAAO,EAAE,CAAC;IACVhB,OAAO,EACL;EACJ,CAAC;EACDkB,eAAe,EAAE;IACfF,OAAO,EAAE,CAAC;IACVhB,OAAO,EACL,4FAA4F,GAC5F;EACJ;AACF,CAAC;AAAA","ignoreList":[]}
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _rewriteStackTrace = require("./rewrite-stack-trace.js");
8
- class ConfigError extends Error {
9
- constructor(message, filename) {
10
- super(message);
11
- (0, _rewriteStackTrace.expectedError)(this);
12
- if (filename) (0, _rewriteStackTrace.injectVirtualStackFrame)(this, filename);
13
- }
14
- }
15
- exports.default = ConfigError;
16
- 0 && 0;
17
-
18
- //# sourceMappingURL=config-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_rewriteStackTrace","require","ConfigError","Error","constructor","message","filename","expectedError","injectVirtualStackFrame","exports","default"],"sources":["../../src/errors/config-error.ts"],"sourcesContent":["import {\n injectVirtualStackFrame,\n expectedError,\n} from \"./rewrite-stack-trace.ts\";\n\nexport default class ConfigError extends Error {\n constructor(message: string, filename?: string) {\n super(message);\n expectedError(this);\n if (filename) injectVirtualStackFrame(this, filename);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAKe,MAAMC,WAAW,SAASC,KAAK,CAAC;EAC7CC,WAAWA,CAACC,OAAe,EAAEC,QAAiB,EAAE;IAC9C,KAAK,CAACD,OAAO,CAAC;IACd,IAAAE,gCAAa,EAAC,IAAI,CAAC;IACnB,IAAID,QAAQ,EAAE,IAAAE,0CAAuB,EAAC,IAAI,EAAEF,QAAQ,CAAC;EACvD;AACF;AAACG,OAAA,CAAAC,OAAA,GAAAR,WAAA;AAAA","ignoreList":[]}
@@ -1,98 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.beginHiddenCallStack = beginHiddenCallStack;
7
- exports.endHiddenCallStack = endHiddenCallStack;
8
- exports.expectedError = expectedError;
9
- exports.injectVirtualStackFrame = injectVirtualStackFrame;
10
- var _Object$getOwnPropert;
11
- const ErrorToString = Function.call.bind(Error.prototype.toString);
12
- const SUPPORTED = !!Error.captureStackTrace && ((_Object$getOwnPropert = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit")) == null ? void 0 : _Object$getOwnPropert.writable) === true;
13
- const START_HIDING = "startHiding - secret - don't use this - v1";
14
- const STOP_HIDING = "stopHiding - secret - don't use this - v1";
15
- const expectedErrors = new WeakSet();
16
- const virtualFrames = new WeakMap();
17
- function CallSite(filename) {
18
- return Object.create({
19
- isNative: () => false,
20
- isConstructor: () => false,
21
- isToplevel: () => true,
22
- getFileName: () => filename,
23
- getLineNumber: () => undefined,
24
- getColumnNumber: () => undefined,
25
- getFunctionName: () => undefined,
26
- getMethodName: () => undefined,
27
- getTypeName: () => undefined,
28
- toString: () => filename
29
- });
30
- }
31
- function injectVirtualStackFrame(error, filename) {
32
- if (!SUPPORTED) return;
33
- let frames = virtualFrames.get(error);
34
- if (!frames) virtualFrames.set(error, frames = []);
35
- frames.push(CallSite(filename));
36
- return error;
37
- }
38
- function expectedError(error) {
39
- if (!SUPPORTED) return;
40
- expectedErrors.add(error);
41
- return error;
42
- }
43
- function beginHiddenCallStack(fn) {
44
- if (!SUPPORTED) return fn;
45
- return Object.defineProperty(function (...args) {
46
- setupPrepareStackTrace();
47
- return fn(...args);
48
- }, "name", {
49
- value: STOP_HIDING
50
- });
51
- }
52
- function endHiddenCallStack(fn) {
53
- if (!SUPPORTED) return fn;
54
- return Object.defineProperty(function (...args) {
55
- return fn(...args);
56
- }, "name", {
57
- value: START_HIDING
58
- });
59
- }
60
- function setupPrepareStackTrace() {
61
- setupPrepareStackTrace = () => {};
62
- const {
63
- prepareStackTrace = defaultPrepareStackTrace
64
- } = Error;
65
- const MIN_STACK_TRACE_LIMIT = 50;
66
- Error.stackTraceLimit && (Error.stackTraceLimit = Math.max(Error.stackTraceLimit, MIN_STACK_TRACE_LIMIT));
67
- Error.prepareStackTrace = function stackTraceRewriter(err, trace) {
68
- let newTrace = [];
69
- const isExpected = expectedErrors.has(err);
70
- let status = isExpected ? "hiding" : "unknown";
71
- for (let i = 0; i < trace.length; i++) {
72
- const name = trace[i].getFunctionName();
73
- if (name === START_HIDING) {
74
- status = "hiding";
75
- } else if (name === STOP_HIDING) {
76
- if (status === "hiding") {
77
- status = "showing";
78
- if (virtualFrames.has(err)) {
79
- newTrace.unshift(...virtualFrames.get(err));
80
- }
81
- } else if (status === "unknown") {
82
- newTrace = trace;
83
- break;
84
- }
85
- } else if (status !== "hiding") {
86
- newTrace.push(trace[i]);
87
- }
88
- }
89
- return prepareStackTrace(err, newTrace);
90
- };
91
- }
92
- function defaultPrepareStackTrace(err, trace) {
93
- if (trace.length === 0) return ErrorToString(err);
94
- return `${ErrorToString(err)}\n at ${trace.join("\n at ")}`;
95
- }
96
- 0 && 0;
97
-
98
- //# sourceMappingURL=rewrite-stack-trace.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["ErrorToString","Function","call","bind","Error","prototype","toString","SUPPORTED","captureStackTrace","_Object$getOwnPropert","Object","getOwnPropertyDescriptor","writable","START_HIDING","STOP_HIDING","expectedErrors","WeakSet","virtualFrames","WeakMap","CallSite","filename","create","isNative","isConstructor","isToplevel","getFileName","getLineNumber","undefined","getColumnNumber","getFunctionName","getMethodName","getTypeName","injectVirtualStackFrame","error","frames","get","set","push","expectedError","add","beginHiddenCallStack","fn","defineProperty","args","setupPrepareStackTrace","value","endHiddenCallStack","prepareStackTrace","defaultPrepareStackTrace","MIN_STACK_TRACE_LIMIT","stackTraceLimit","Math","max","stackTraceRewriter","err","trace","newTrace","isExpected","has","status","i","length","name","unshift","join"],"sources":["../../src/errors/rewrite-stack-trace.ts"],"sourcesContent":["/**\n * This file uses the internal V8 Stack Trace API (https://v8.dev/docs/stack-trace-api)\n * to provide utilities to rewrite the stack trace.\n * When this API is not present, all the functions in this file become noops.\n *\n * beginHiddenCallStack(fn) and endHiddenCallStack(fn) wrap their parameter to\n * mark an hidden portion of the stack trace. The function passed to\n * beginHiddenCallStack is the first hidden function, while the function passed\n * to endHiddenCallStack is the first shown function.\n *\n * When an error is thrown _outside_ of the hidden zone, everything between\n * beginHiddenCallStack and endHiddenCallStack will not be shown.\n * If an error is thrown _inside_ the hidden zone, then the whole stack trace\n * will be visible: this is to avoid hiding real bugs.\n * However, if an error inside the hidden zone is expected, it can be marked\n * with the expectedError(error) function to keep the hidden frames hidden.\n *\n * Consider this call stack (the outer function is the bottom one):\n *\n * 1. a()\n * 2. endHiddenCallStack(b)()\n * 3. c()\n * 4. beginHiddenCallStack(d)()\n * 5. e()\n * 6. f()\n *\n * - If a() throws an error, then its shown call stack will be \"a, b, e, f\"\n * - If b() throws an error, then its shown call stack will be \"b, e, f\"\n * - If c() throws an expected error, then its shown call stack will be \"e, f\"\n * - If c() throws an unexpected error, then its shown call stack will be \"c, d, e, f\"\n * - If d() throws an expected error, then its shown call stack will be \"e, f\"\n * - If d() throws an unexpected error, then its shown call stack will be \"d, e, f\"\n * - If e() throws an error, then its shown call stack will be \"e, f\"\n *\n * Additionally, an error can inject additional \"virtual\" stack frames using the\n * injectVirtualStackFrame(error, filename) function: those are injected as a\n * replacement of the hidden frames.\n * In the example above, if we called injectVirtualStackFrame(err, \"h\") and\n * injectVirtualStackFrame(err, \"i\") on the expected error thrown by c(), its\n * shown call stack would have been \"h, i, e, f\".\n * This can be useful, for example, to report config validation errors as if they\n * were directly thrown in the config file.\n */\n\nconst ErrorToString = Function.call.bind(Error.prototype.toString);\n\nconst SUPPORTED =\n !!Error.captureStackTrace &&\n Object.getOwnPropertyDescriptor(Error, \"stackTraceLimit\")?.writable === true;\n\nconst START_HIDING = \"startHiding - secret - don't use this - v1\";\nconst STOP_HIDING = \"stopHiding - secret - don't use this - v1\";\n\ntype CallSite = NodeJS.CallSite;\n\nconst expectedErrors = new WeakSet<Error>();\nconst virtualFrames = new WeakMap<Error, CallSite[]>();\n\nfunction CallSite(filename: string): CallSite {\n // We need to use a prototype otherwise it breaks source-map-support's internals\n return Object.create({\n isNative: () => false,\n isConstructor: () => false,\n isToplevel: () => true,\n getFileName: () => filename,\n getLineNumber: () => undefined,\n getColumnNumber: () => undefined,\n getFunctionName: () => undefined,\n getMethodName: () => undefined,\n getTypeName: () => undefined,\n toString: () => filename,\n } as CallSite);\n}\n\nexport function injectVirtualStackFrame(error: Error, filename: string) {\n if (!SUPPORTED) return;\n\n let frames = virtualFrames.get(error);\n if (!frames) virtualFrames.set(error, (frames = []));\n frames.push(CallSite(filename));\n\n return error;\n}\n\nexport function expectedError(error: Error) {\n if (!SUPPORTED) return;\n expectedErrors.add(error);\n return error;\n}\n\nexport function beginHiddenCallStack<A extends unknown[], R>(\n fn: (...args: A) => R,\n) {\n if (!SUPPORTED) return fn;\n\n return Object.defineProperty(\n function (...args: A) {\n setupPrepareStackTrace();\n return fn(...args);\n },\n \"name\",\n { value: STOP_HIDING },\n );\n}\n\nexport function endHiddenCallStack<A extends unknown[], R>(\n fn: (...args: A) => R,\n) {\n if (!SUPPORTED) return fn;\n\n return Object.defineProperty(\n function (...args: A) {\n return fn(...args);\n },\n \"name\",\n { value: START_HIDING },\n );\n}\n\nfunction setupPrepareStackTrace() {\n // @ts-expect-error This function is a singleton\n setupPrepareStackTrace = () => {};\n\n const { prepareStackTrace = defaultPrepareStackTrace } = Error;\n\n // We add some extra frames to Error.stackTraceLimit, so that we can\n // always show some useful frames even after deleting ours.\n // STACK_TRACE_LIMIT_DELTA should be around the maximum expected number\n // of internal frames, and not too big because capturing the stack trace\n // is slow (this is why Error.stackTraceLimit does not default to Infinity!).\n // Increase it if needed.\n // However, we only do it if the user did not explicitly set it to 0.\n const MIN_STACK_TRACE_LIMIT = 50;\n Error.stackTraceLimit &&= Math.max(\n Error.stackTraceLimit,\n MIN_STACK_TRACE_LIMIT,\n );\n\n Error.prepareStackTrace = function stackTraceRewriter(err, trace) {\n let newTrace = [];\n\n const isExpected = expectedErrors.has(err);\n let status: \"showing\" | \"hiding\" | \"unknown\" = isExpected\n ? \"hiding\"\n : \"unknown\";\n for (let i = 0; i < trace.length; i++) {\n const name = trace[i].getFunctionName();\n if (name === START_HIDING) {\n status = \"hiding\";\n } else if (name === STOP_HIDING) {\n if (status === \"hiding\") {\n status = \"showing\";\n if (virtualFrames.has(err)) {\n newTrace.unshift(...virtualFrames.get(err));\n }\n } else if (status === \"unknown\") {\n // Unexpected internal error, show the full stack trace\n newTrace = trace;\n break;\n }\n } else if (status !== \"hiding\") {\n newTrace.push(trace[i]);\n }\n }\n\n return prepareStackTrace(err, newTrace);\n };\n}\n\nfunction defaultPrepareStackTrace(err: Error, trace: CallSite[]) {\n if (trace.length === 0) return ErrorToString(err);\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n return `${ErrorToString(err)}\\n at ${trace.join(\"\\n at \")}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ty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.forwardAsync = forwardAsync;
7
- exports.isAsync = void 0;
8
- exports.isThenable = isThenable;
9
- exports.maybeAsync = maybeAsync;
10
- exports.waitFor = exports.onFirstPause = void 0;
11
- function _gensync() {
12
- const data = require("gensync");
13
- _gensync = function () {
14
- return data;
15
- };
16
- return data;
17
- }
18
- function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
19
- function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
20
- const runGenerator = _gensync()(function* (item) {
21
- return yield* item;
22
- });
23
- const isAsync = exports.isAsync = _gensync()({
24
- sync: () => false,
25
- errback: cb => cb(null, true)
26
- });
27
- function maybeAsync(fn, message) {
28
- return _gensync()({
29
- sync(...args) {
30
- const result = fn.apply(this, args);
31
- if (isThenable(result)) throw new Error(message);
32
- return result;
33
- },
34
- async(...args) {
35
- return Promise.resolve(fn.apply(this, args));
36
- }
37
- });
38
- }
39
- const withKind = _gensync()({
40
- sync: cb => cb("sync"),
41
- async: function () {
42
- var _ref = _asyncToGenerator(function* (cb) {
43
- return cb("async");
44
- });
45
- return function async(_x) {
46
- return _ref.apply(this, arguments);
47
- };
48
- }()
49
- });
50
- function forwardAsync(action, cb) {
51
- const g = _gensync()(action);
52
- return withKind(kind => {
53
- const adapted = g[kind];
54
- return cb(adapted);
55
- });
56
- }
57
- const onFirstPause = exports.onFirstPause = _gensync()({
58
- name: "onFirstPause",
59
- arity: 2,
60
- sync: function (item) {
61
- return runGenerator.sync(item);
62
- },
63
- errback: function (item, firstPause, cb) {
64
- let completed = false;
65
- runGenerator.errback(item, (err, value) => {
66
- completed = true;
67
- cb(err, value);
68
- });
69
- if (!completed) {
70
- firstPause();
71
- }
72
- }
73
- });
74
- const waitFor = exports.waitFor = _gensync()({
75
- sync: x => x,
76
- async: function () {
77
- var _ref2 = _asyncToGenerator(function* (x) {
78
- return x;
79
- });
80
- return function async(_x2) {
81
- return _ref2.apply(this, arguments);
82
- };
83
- }()
84
- });
85
- function isThenable(val) {
86
- return !!val && (typeof val === "object" || typeof val === "function") && !!val.then && typeof val.then === "function";
87
- }
88
- 0 && 0;
89
-
90
- //# sourceMappingURL=async.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_gensync","data","require","asyncGeneratorStep","n","t","e","r","o","a","c","i","u","value","done","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","runGenerator","gensync","item","isAsync","exports","sync","errback","cb","maybeAsync","fn","message","args","result","isThenable","Error","async","withKind","_ref","_x","forwardAsync","action","g","kind","adapted","onFirstPause","name","arity","firstPause","completed","err","waitFor","x","_ref2","_x2","val"],"sources":["../../src/gensync-utils/async.ts"],"sourcesContent":["import gensync, { type Gensync, type Handler, type Callback } from \"gensync\";\n\ntype MaybePromise<T> = T | Promise<T>;\n\nconst runGenerator: {\n sync<Return>(gen: Handler<Return>): Return;\n async<Return>(gen: Handler<Return>): Promise<Return>;\n errback<Return>(gen: Handler<Return>, cb: Callback<Return>): void;\n} = gensync(function* (item: Handler<any>): Handler<any> {\n return yield* item;\n});\n\n// This Gensync returns true if the current execution context is\n// asynchronous, otherwise it returns false.\nexport const isAsync = gensync({\n sync: () => false,\n errback: cb => cb(null, true),\n});\n\n// This function wraps any functions (which could be either synchronous or\n// asynchronous) with a Gensync. If the wrapped function returns a promise\n// but the current execution context is synchronous, it will throw the\n// provided error.\n// This is used to handle user-provided functions which could be asynchronous.\nexport function maybeAsync<Args extends unknown[], Return>(\n fn: (...args: Args) => Return,\n message: string,\n): Gensync<Args, Return> {\n return gensync({\n sync(...args) {\n const result = fn.apply(this, args);\n if (isThenable(result)) throw new Error(message);\n return result;\n },\n async(...args) {\n return Promise.resolve(fn.apply(this, args));\n },\n });\n}\n\nconst withKind = gensync({\n sync: cb => cb(\"sync\"),\n async: async cb => cb(\"async\"),\n}) as <T>(cb: (kind: \"sync\" | \"async\") => MaybePromise<T>) => Handler<T>;\n\n// This function wraps a generator (or a Gensync) into another function which,\n// when called, will run the provided generator in a sync or async way, depending\n// on the execution context where this forwardAsync function is called.\n// This is useful, for example, when passing a callback to a function which isn't\n// aware of gensync, but it only knows about synchronous and asynchronous functions.\n// An example is cache.using, which being exposed to the user must be as simple as\n// possible:\n// yield* forwardAsync(gensyncFn, wrappedFn =>\n// cache.using(x => {\n// // Here we don't know about gensync. wrappedFn is a\n// // normal sync or async function\n// return wrappedFn(x);\n// })\n// )\nexport function forwardAsync<Args extends unknown[], Return>(\n action: (...args: Args) => Handler<Return>,\n cb: (\n adapted: (...args: Args) => MaybePromise<Return>,\n ) => MaybePromise<Return>,\n): Handler<Return> {\n const g = gensync(action);\n return withKind(kind => {\n const adapted = g[kind];\n return cb(adapted);\n });\n}\n\n// If the given generator is executed asynchronously, the first time that it\n// is paused (i.e. When it yields a gensync generator which can't be run\n// synchronously), call the \"firstPause\" callback.\nexport const onFirstPause = gensync<\n [gen: Handler<unknown>, firstPause: () => void],\n unknown\n>({\n name: \"onFirstPause\",\n arity: 2,\n sync: function (item) {\n return runGenerator.sync(item);\n },\n errback: function (item, firstPause, cb) {\n let completed = false;\n\n runGenerator.errback(item, (err, value) => {\n completed = true;\n cb(err, value);\n });\n\n if (!completed) {\n firstPause();\n }\n },\n}) as <T>(gen: Handler<T>, firstPause: () => void) => Handler<T>;\n\n// Wait for the given promise to be resolved\nexport const waitFor = gensync({\n sync: x => x,\n async: async x => x,\n}) as <T>(p: T | Promise<T>) => Handler<T>;\n\nexport function isThenable<T = any>(val: any): val is PromiseLike<T> {\n return (\n !!val &&\n (typeof val === \"object\" || typeof val === \"function\") &&\n !!val.then &&\n typeof val.then === \"function\"\n );\n}\n"],"mappings":";;;;;;;;;;AAAA,S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AAUH,IAAI,EAAE;IACpB,OAAOF,YAAY,CAACK,IAAI,CAACH,IAAI,CAAC;EAChC,CAAC;EACDI,OAAO,EAAE,SAAAA,CAAUJ,IAAI,EAAEyB,UAAU,EAAEpB,EAAE,EAAE;IACvC,IAAIqB,SAAS,GAAG,KAAK;IAErB5B,YAAY,CAACM,OAAO,CAACJ,IAAI,EAAE,CAAC2B,GAAG,EAAEvC,KAAK,KAAK;MACzCsC,SAAS,GAAG,IAAI;MAChBrB,EAAE,CAACsB,GAAG,EAAEvC,KAAK,CAAC;IAChB,CAAC,CAAC;IAEF,IAAI,CAACsC,SAAS,EAAE;MACdD,UAAU,CAAC,CAAC;IACd;EACF;AACF,CAAC,CAA+D;AAGzD,MAAMG,OAAO,GAAA1B,OAAA,CAAA0B,OAAA,GAAG7B,SAAMA,CAAC,CAAC;EAC7BI,IAAI,EAAE0B,CAAC,IAAIA,CAAC;EACZhB,KAAK;IAAA,IAAAiB,KAAA,GAAArC,iBAAA,CAAE,WAAMoC,CAAC;MAAA,OAAIA,CAAC;IAAA;IAAA,gBAAnBhB,KAAKA,CAAAkB,GAAA;MAAA,OAAAD,KAAA,CAAAnC,KAAA,OAAAD,SAAA;IAAA;EAAA;AACP,CAAC,CAAyC;AAEnC,SAASiB,UAAUA,CAAUqB,GAAQ,EAAyB;EACnE,OACE,CAAC,CAACA,GAAG,KACJ,OAAOA,GAAG,KAAK,QAAQ,IAAI,OAAOA,GAAG,KAAK,UAAU,CAAC,IACtD,CAAC,CAACA,GAAG,CAACxC,IAAI,IACV,OAAOwC,GAAG,CAACxC,IAAI,KAAK,UAAU;AAElC;AAAC","ignoreList":[]}
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.stat = exports.readFile = void 0;
7
- function _fs() {
8
- const data = require("fs");
9
- _fs = function () {
10
- return data;
11
- };
12
- return data;
13
- }
14
- function _gensync() {
15
- const data = require("gensync");
16
- _gensync = function () {
17
- return data;
18
- };
19
- return data;
20
- }
21
- const readFile = exports.readFile = _gensync()({
22
- sync: _fs().readFileSync,
23
- errback: _fs().readFile
24
- });
25
- const stat = exports.stat = _gensync()({
26
- sync: _fs().statSync,
27
- errback: _fs().stat
28
- });
29
- 0 && 0;
30
-
31
- //# sourceMappingURL=fs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_fs","data","require","_gensync","readFile","exports","gensync","sync","fs","readFileSync","errback","stat","statSync"],"sources":["../../src/gensync-utils/fs.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport gensync from \"gensync\";\n\nexport const readFile = gensync<[filepath: string, encoding: \"utf8\"], string>({\n sync: fs.readFileSync,\n errback: fs.readFile,\n});\n\nexport const stat = gensync({\n sync: fs.statSync,\n errback: fs.stat,\n});\n"],"mappings":";;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMG,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAGE,SAAMA,CAAC,CAA+C;EAC5EC,IAAI,EAAEC,IAACA,CAAC,CAACC,YAAY;EACrBC,OAAO,EAAEF,IAACA,CAAC,CAACJ;AACd,CAAC,CAAC;AAEK,MAAMO,IAAI,GAAAN,OAAA,CAAAM,IAAA,GAAGL,SAAMA,CAAC,CAAC;EAC1BC,IAAI,EAAEC,IAACA,CAAC,CAACI,QAAQ;EACjBF,OAAO,EAAEF,IAACA,CAAC,CAACG;AACd,CAAC,CAAC;AAAC","ignoreList":[]}
@@ -1,58 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.once = once;
7
- var _async = require("./async.js");
8
- function once(fn) {
9
- let result;
10
- let resultP;
11
- let promiseReferenced = false;
12
- return function* () {
13
- if (!result) {
14
- if (resultP) {
15
- promiseReferenced = true;
16
- return yield* (0, _async.waitFor)(resultP);
17
- }
18
- if (!(yield* (0, _async.isAsync)())) {
19
- try {
20
- result = {
21
- ok: true,
22
- value: yield* fn()
23
- };
24
- } catch (error) {
25
- result = {
26
- ok: false,
27
- value: error
28
- };
29
- }
30
- } else {
31
- let resolve, reject;
32
- resultP = new Promise((res, rej) => {
33
- resolve = res;
34
- reject = rej;
35
- });
36
- try {
37
- result = {
38
- ok: true,
39
- value: yield* fn()
40
- };
41
- resultP = null;
42
- if (promiseReferenced) resolve(result.value);
43
- } catch (error) {
44
- result = {
45
- ok: false,
46
- value: error
47
- };
48
- resultP = null;
49
- if (promiseReferenced) reject(error);
50
- }
51
- }
52
- }
53
- if (result.ok) return result.value;else throw result.value;
54
- };
55
- }
56
- 0 && 0;
57
-
58
- //# sourceMappingURL=functional.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_async","require","once","fn","result","resultP","promiseReferenced","waitFor","isAsync","ok","value","error","resolve","reject","Promise","res","rej"],"sources":["../../src/gensync-utils/functional.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\n\nimport { isAsync, waitFor } from \"./async.ts\";\n\nexport function once<R>(fn: () => Handler<R>): () => Handler<R> {\n let result: { ok: true; value: R } | { ok: false; value: unknown };\n let resultP: Promise<R>;\n let promiseReferenced = false;\n return function* () {\n if (!result) {\n if (resultP) {\n promiseReferenced = true;\n return yield* waitFor(resultP);\n }\n\n if (!(yield* isAsync())) {\n try {\n result = { ok: true, value: yield* fn() };\n } catch (error) {\n result = { ok: false, value: error };\n }\n } else {\n let resolve: (result: R) => void, reject: (error: unknown) => void;\n resultP = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n\n try {\n result = { ok: true, value: yield* fn() };\n // Avoid keeping the promise around\n // now that we have the result.\n resultP = null;\n // We only resolve/reject the promise if it has been actually\n // referenced. If there are no listeners we can forget about it.\n // In the reject case, this avoid uncatchable unhandledRejection\n // events.\n if (promiseReferenced) resolve(result.value);\n } catch (error) {\n result = { ok: false, value: error };\n resultP = null;\n if (promiseReferenced) reject(error);\n }\n }\n }\n\n if (result.ok) return result.value;\n else throw result.value;\n };\n}\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAEO,SAASC,IAAIA,CAAIC,EAAoB,EAAoB;EAC9D,IAAIC,MAA8D;EAClE,IAAIC,OAAmB;EACvB,IAAIC,iBAAiB,GAAG,KAAK;EAC7B,OAAO,aAAa;IAClB,IAAI,CAACF,MAAM,EAAE;MACX,IAAIC,OAAO,EAAE;QACXC,iBAAiB,GAAG,IAAI;QACxB,OAAO,OAAO,IAAAC,cAAO,EAACF,OAAO,CAAC;MAChC;MAEA,IAAI,EAAE,OAAO,IAAAG,cAAO,EAAC,CAAC,CAAC,EAAE;QACvB,IAAI;UACFJ,MAAM,GAAG;YAAEK,EAAE,EAAE,IAAI;YAAEC,KAAK,EAAE,OAAOP,EAAE,CAAC;UAAE,CAAC;QAC3C,CAAC,CAAC,OAAOQ,KAAK,EAAE;UACdP,MAAM,GAAG;YAAEK,EAAE,EAAE,KAAK;YAAEC,KAAK,EAAEC;UAAM,CAAC;QACtC;MACF,CAAC,MAAM;QACL,IAAIC,OAA4B,EAAEC,MAAgC;QAClER,OAAO,GAAG,IAAIS,OAAO,CAAC,CAACC,GAAG,EAAEC,GAAG,KAAK;UAClCJ,OAAO,GAAGG,GAAG;UACbF,MAAM,GAAGG,GAAG;QACd,CAAC,CAAC;QAEF,IAAI;UACFZ,MAAM,GAAG;YAAEK,EAAE,EAAE,IAAI;YAAEC,KAAK,EAAE,OAAOP,EAAE,CAAC;UAAE,CAAC;UAGzCE,OAAO,GAAG,IAAI;UAKd,IAAIC,iBAAiB,EAAEM,OAAO,CAACR,MAAM,CAACM,KAAK,CAAC;QAC9C,CAAC,CAAC,OAAO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