| 1 | /** |
| 2 | * Entry point for @babel/standalone. This wraps Babel's API in a version that's |
| 3 | * friendlier for use in web browsers. It removes the automagical detection of |
| 4 | * plugins, instead explicitly registering all the available plugins and |
| 5 | * presets, and requiring custom ones to be registered through `registerPlugin` |
| 6 | * and `registerPreset` respectively. |
| 7 | * @flow |
| 8 | */ |
| 9 | |
| 10 | /* global VERSION */ |
| 11 | /* eslint-disable max-len */ |
| 12 | /// <reference lib="dom" /> |
| 13 | |
| 14 | import { |
| 15 | transformFromAstSync as babelTransformFromAstSyncscip-typescript npm @babel/core 7.20.12 src/`transform-ast.ts`/transformFromAstSync()., |
| 16 | transformSync as babelTransformSyncscip-typescript npm @babel/core 7.20.12 src/`transform.ts`/transformSync()., |
| 17 | buildExternalHelpers as babelBuildExternalHelpers, |
| 18 | } from "@babel/core"scip-typescript npm @babel/core 7.20.12 src/`index.ts`/; |
| 19 | import { allscip-typescript npm @babel/standalone 7.20.15 src/generated/`plugins.ts`/all. } from "./generated/plugins"scip-typescript npm @babel/standalone 7.20.15 src/generated/`plugins.ts`/; |
| 20 | import preset2015 from "./preset-es2015"scip-typescript npm @babel/standalone 7.20.15 src/`preset-es2015.ts`/; |
| 21 | import presetStage0 from "./preset-stage-0"scip-typescript npm @babel/standalone 7.20.15 src/`preset-stage-0.ts`/; |
| 22 | import presetStage1 from "./preset-stage-1"scip-typescript npm @babel/standalone 7.20.15 src/`preset-stage-1.ts`/; |
| 23 | import presetStage2 from "./preset-stage-2"scip-typescript npm @babel/standalone 7.20.15 src/`preset-stage-2.ts`/; |
| 24 | import presetStage3 from "./preset-stage-3"scip-typescript npm @babel/standalone 7.20.15 src/`preset-stage-3.ts`/; |
| 25 | import presetEnv from "@babel/preset-env"scip-typescript npm @babel/preset-env 7.20.2 src/`index.ts`/; |
| 26 | import presetFlow from "@babel/preset-flow"scip-typescript npm @babel/preset-flow 7.18.6 src/`index.ts`/; |
| 27 | import presetReact from "@babel/preset-react"scip-typescript npm @babel/preset-react 7.18.6 src/`index.ts`/; |
| 28 | import presetTypescript from "@babel/preset-typescript"scip-typescript npm @babel/preset-typescript 7.18.6 src/`index.ts`/; |
| 29 | import type { InputOptionsscip-typescript npm @babel/core 7.20.12 src/config/validation/`options.ts`/InputOptions# } from "@babel/core"scip-typescript npm @babel/core 7.20.12 src/`index.ts`/; |
| 30 | |
| 31 | import { runScriptsscip-typescript npm @babel/standalone 7.20.15 src/`transformScriptTags.ts`/runScripts(). } from "./transformScriptTags"scip-typescript npm @babel/standalone 7.20.15 src/`transformScriptTags.ts`/; |
| 32 | |
| 33 | export const availablePluginsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/availablePlugins.: typeof allscip-typescript npm @babel/standalone 7.20.15 src/generated/`plugins.ts`/all. = {}; |
| 34 | |
| 35 | // All the plugins we should bundle |
| 36 | // Want to get rid of this long list of allowed plugins? |
| 37 | // Wait! Please read https://github.com/babel/babel/pull/6177 first. |
| 38 | registerPluginsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPlugins().(allscip-typescript npm @babel/standalone 7.20.15 src/generated/`plugins.ts`/all.); |
| 39 | |
| 40 | // All the presets we should bundle |
| 41 | // Want to get rid of this list of allowed presets? |
| 42 | // Wait! Please read https://github.com/babel/babel/pull/6177 first. |
| 43 | export const availablePresetsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/availablePresets. = { |
| 44 | envscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/env0:: presetEnv, |
| 45 | es2015scip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/es20150:: preset2015, |
| 46 | es2016scip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/es20160:: () => { |
| 47 | return { |
| 48 | pluginsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/plugins0:: [availablePluginsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/availablePlugins.["transform-exponentiation-operator"]], |
| 49 | }; |
| 50 | }, |
| 51 | es2017scip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/es20170:: () => { |
| 52 | return { |
| 53 | pluginsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/plugins1:: [availablePluginsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/availablePlugins.["transform-async-to-generator"]], |
| 54 | }; |
| 55 | }, |
| 56 | reactscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/react0:: presetReact, |
| 57 | "stage-0"scip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/`"stage-0"0`:: presetStage0, |
| 58 | "stage-1"scip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/`"stage-1"0`:: presetStage1, |
| 59 | "stage-2"scip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/`"stage-2"0`:: presetStage2, |
| 60 | "stage-3"scip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/`"stage-3"0`:: presetStage3, |
| 61 | "es2015-loose"scip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/`"es2015-loose"0`:: { |
| 62 | presetsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/presets0:: [[preset2015, { loosescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loose0:: true }]], |
| 63 | }, |
| 64 | // ES2015 preset with es2015-modules-commonjs removed |
| 65 | "es2015-no-commonjs"scip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/`"es2015-no-commonjs"0`:: { |
| 66 | presetsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/presets1:: [[preset2015, { modulesscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/modules0:: false }]], |
| 67 | }, |
| 68 | typescriptscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/typescript0:: presetTypescript, |
| 69 | flowscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/flow0:: presetFlow, |
| 70 | }; |
| 71 | |
| 72 | const isArrayscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/isArray. = |
| 73 | Arrayscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#.isArrayscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/ArrayConstructor#isArray(). || |
| 74 | (arg => Objectscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Object#.prototypescip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/ObjectConstructor#prototype..toStringscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Object#toString()..callscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/CallableFunction#call().(arg) === "[object Array]"); |
| 75 | |
| 76 | /** |
| 77 | * Loads the given name (or [name, options] pair) from the given table object |
| 78 | * holding the available presets or plugins. |
| 79 | * |
| 80 | * Returns undefined if the preset or plugin is not available; passes through |
| 81 | * name unmodified if it (or the first element of the pair) is not a string. |
| 82 | */ |
| 83 | function loadBuiltinscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(builtinTablescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(builtinTable): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, unknown>, namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(name): any) { |
| 84 | if (isArrayscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/isArray.(namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(name)) && typeof namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(name)[0] === "string") { |
| 85 | if (Objectscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Object#.prototypescip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/ObjectConstructor#prototype..hasOwnPropertyscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Object#hasOwnProperty()..callscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/CallableFunction#call().(builtinTablescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(builtinTable), namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(name)[0])) { |
| 86 | return [builtinTablescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(builtinTable)[namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(name)[0]]].concatscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#concat().(namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(name).slice(1)); |
| 87 | } |
| 88 | return; |
| 89 | } else if (typeof namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(name) === "string") { |
| 90 | return builtinTablescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(builtinTable)[namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(name)]; |
| 91 | } |
| 92 | // Could be an actual preset/plugin module |
| 93 | return namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(name); |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Parses plugin names and presets from the specified options. |
| 98 | */ |
| 99 | function processOptionsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/processOptions().(optionsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/processOptions().(options): InputOptionsscip-typescript npm @babel/core 7.20.12 src/config/validation/`options.ts`/InputOptions#) { |
| 100 | // Parse preset names |
| 101 | const presets = (optionsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/processOptions().(options).presetsscip-typescript npm @babel/core 7.20.12 src/config/validation/`options.ts`/ValidatedOptions#typeLiteral23:presets. || []).mapscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/ReadonlyArray#map().(presetName => { |
| 102 | const preset = loadBuiltinscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(availablePresetsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/availablePresets., presetName); |
| 103 | |
| 104 | if (preset) { |
| 105 | // workaround for babel issue |
| 106 | // at some point, babel copies the preset, losing the non-enumerable |
| 107 | // buildPreset key; convert it into an enumerable key. |
| 108 | if ( |
| 109 | isArrayscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/isArray.(preset) && |
| 110 | typeof preset[0] === "object" && |
| 111 | Objectscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Object#.prototypescip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/ObjectConstructor#prototype..hasOwnPropertyscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Object#hasOwnProperty()..callscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/CallableFunction#call().(preset[0], "buildPreset") |
| 112 | ) { |
| 113 | preset[0] = { ...preset[0], buildPresetscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/buildPreset0:: preset[0].buildPreset }; |
| 114 | } |
| 115 | } else { |
| 116 | throw new Errorscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Error#( |
| 117 | `Invalid preset specified in Babel options: "${presetName}"`, |
| 118 | ); |
| 119 | } |
| 120 | return preset; |
| 121 | }); |
| 122 | |
| 123 | // Parse plugin names |
| 124 | const plugins = (optionsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/processOptions().(options).pluginsscip-typescript npm @babel/core 7.20.12 src/config/validation/`options.ts`/ValidatedOptions#typeLiteral23:plugins. || []).mapscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/ReadonlyArray#map().(pluginName => { |
| 125 | const plugin = loadBuiltinscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/loadBuiltin().(availablePluginsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/availablePlugins., pluginName); |
| 126 | |
| 127 | if (!plugin) { |
| 128 | throw new Errorscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Error#( |
| 129 | `Invalid plugin specified in Babel options: "${pluginName}"`, |
| 130 | ); |
| 131 | } |
| 132 | return plugin; |
| 133 | }); |
| 134 | |
| 135 | return { |
| 136 | babelrcscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/babelrc0:: false, |
| 137 | ...optionsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/processOptions().(options), |
| 138 | presetsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/presets2:, |
| 139 | pluginsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/plugins2:, |
| 140 | }; |
| 141 | } |
| 142 | |
| 143 | export function transformscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transform().(codescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transform().(code): string, optionsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transform().(options): InputOptionsscip-typescript npm @babel/core 7.20.12 src/config/validation/`options.ts`/InputOptions#) { |
| 144 | return babelTransformSyncscip-typescript npm @babel/core 7.20.12 src/`transform.ts`/transformSync().(codescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transform().(code), processOptionsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/processOptions().(optionsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transform().(options))); |
| 145 | } |
| 146 | |
| 147 | export function transformFromAstscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transformFromAst().( |
| 148 | astscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transformFromAst().(ast): Parametersscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Parameters#<typeof babelTransformFromAstSyncscip-typescript npm @babel/core 7.20.12 src/`transform-ast.ts`/transformFromAstSync().>[0], |
| 149 | codescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transformFromAst().(code): string, |
| 150 | optionsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transformFromAst().(options): InputOptionsscip-typescript npm @babel/core 7.20.12 src/config/validation/`options.ts`/InputOptions#, |
| 151 | ) { |
| 152 | return babelTransformFromAstSyncscip-typescript npm @babel/core 7.20.12 src/`transform-ast.ts`/transformFromAstSync().(astscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transformFromAst().(ast), codescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transformFromAst().(code), processOptionsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/processOptions().(optionsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transformFromAst().(options))); |
| 153 | } |
| 154 | |
| 155 | export const buildExternalHelpersscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/buildExternalHelpers. = babelBuildExternalHelpers; |
| 156 | /** |
| 157 | * Registers a named plugin for use with Babel. |
| 158 | */ |
| 159 | export function registerPluginscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPlugin().(namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPlugin().(name): string, pluginscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPlugin().(plugin): any | Functionscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Function#): void { |
| 160 | if (Objectscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Object#.prototypescip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/ObjectConstructor#prototype..hasOwnPropertyscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Object#hasOwnProperty()..callscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/CallableFunction#call().(availablePluginsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/availablePlugins., namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPlugin().(name))) { |
| 161 | consolescip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/console..warnscip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/Console#warn().( |
| 162 | `A plugin named "${namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPlugin().(name)}" is already registered, it will be overridden`, |
| 163 | ); |
| 164 | } |
| 165 | availablePluginsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/availablePlugins.[namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPlugin().(name)] = pluginscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPlugin().(plugin); |
| 166 | } |
| 167 | /** |
| 168 | * Registers multiple plugins for use with Babel. `newPlugins` should be an object where the key |
| 169 | * is the name of the plugin, and the value is the plugin itself. |
| 170 | */ |
| 171 | export function registerPluginsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPlugins().(newPluginsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPlugins().(newPlugins): { |
| 172 | [x: string]: any | Functionscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Function#; |
| 173 | }): void { |
| 174 | Objectscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Object#.keysscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/ObjectConstructor#keys().(newPluginsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPlugins().(newPlugins)).forEachscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#forEach().(name => |
| 175 | registerPluginscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPlugin().(name, newPluginsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPlugins().(newPlugins)[name]), |
| 176 | ); |
| 177 | } |
| 178 | |
| 179 | /** |
| 180 | * Registers a named preset for use with Babel. |
| 181 | */ |
| 182 | export function registerPresetscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPreset().(namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPreset().(name): string, presetscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPreset().(preset): any | Functionscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Function#): void { |
| 183 | if (Objectscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Object#.prototypescip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/ObjectConstructor#prototype..hasOwnPropertyscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Object#hasOwnProperty()..callscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/CallableFunction#call().(availablePresetsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/availablePresets., namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPreset().(name))) { |
| 184 | if (namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPreset().(name) === "env") { |
| 185 | consolescip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/console..warnscip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/Console#warn().( |
| 186 | "@babel/preset-env is now included in @babel/standalone, please remove @babel/preset-env-standalone", |
| 187 | ); |
| 188 | } else { |
| 189 | consolescip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/console..warnscip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/Console#warn().( |
| 190 | `A preset named "${namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPreset().(name)}" is already registered, it will be overridden`, |
| 191 | ); |
| 192 | } |
| 193 | } |
| 194 | // @ts-expect-error mutating available presets |
| 195 | availablePresetsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/availablePresets.[namescip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPreset().(name)] = presetscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPreset().(preset); |
| 196 | } |
| 197 | |
| 198 | /** |
| 199 | * Registers multiple presets for use with Babel. `newPresets` should be an object where the key |
| 200 | * is the name of the preset, and the value is the preset itself. |
| 201 | */ |
| 202 | export function registerPresetsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPresets().(newPresetsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPresets().(newPresets): { |
| 203 | [x: string]: any | Functionscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Function#; |
| 204 | }): void { |
| 205 | Objectscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Object#.keysscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/ObjectConstructor#keys().(newPresetsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPresets().(newPresets)).forEachscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#forEach().(name => |
| 206 | registerPresetscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPreset().(name, newPresetsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/registerPresets().(newPresets)[name]), |
| 207 | ); |
| 208 | } |
| 209 | |
| 210 | // @ts-expect-error VERSION is to be replaced by rollup |
| 211 | export const versionscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/version.: string = VERSION; |
| 212 | |
| 213 | function onDOMContentLoadedscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/onDOMContentLoaded().() { |
| 214 | transformScriptTagsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transformScriptTags().(); |
| 215 | } |
| 216 | |
| 217 | // Listen for load event if we're in a browser and then kick off finding and |
| 218 | // running of scripts with "text/babel" type. |
| 219 | if (typeof windowscip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/window. !== "undefined" && windowscip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/window.?.addEventListenerscip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/Window#addEventListener().) { |
| 220 | windowscip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/window..addEventListenerscip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/Window#addEventListener().("DOMContentLoaded", onDOMContentLoadedscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/onDOMContentLoaded()., false); |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * Transform <script> tags with "text/babel" type. |
| 225 | * @param {Array} scriptTags specify script tags to transform, transform all in the <head> if not given |
| 226 | */ |
| 227 | export function transformScriptTagsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transformScriptTags().( |
| 228 | scriptTagsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transformScriptTags().(scriptTags)?: HTMLCollectionOfscip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/HTMLCollectionOf#<HTMLScriptElementscip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/HTMLScriptElement#>, |
| 229 | ) { |
| 230 | runScriptsscip-typescript npm @babel/standalone 7.20.15 src/`transformScriptTags.ts`/runScripts().(transformscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transform()., scriptTagsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/transformScriptTags().(scriptTags)); |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * Disables automatic transformation of <script> tags with "text/babel" type. |
| 235 | */ |
| 236 | export function disableScriptTagsscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/disableScriptTags().() { |
| 237 | windowscip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/window..removeEventListenerscip-typescript npm typescript 5.9.3 lib/`lib.dom.d.ts`/Window#removeEventListener().("DOMContentLoaded", onDOMContentLoadedscip-typescript npm @babel/standalone 7.20.15 src/`index.ts`/onDOMContentLoaded().); |
| 238 | } |