summaryrefslogtreecommitdiff
path: root/node_modules/@babel/core/cjs-proxy.cjs
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:31:11 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:31:11 +0800
commitaa773172311dcada759dfbaac485f4bc6e00bc21 (patch)
treeca6d9a5eff3ab8f689f9acb4f0df791d9486813d /node_modules/@babel/core/cjs-proxy.cjs
parentc5a5384e846f242e901e859fe600d695d8990a9a (diff)
added babel
Diffstat (limited to 'node_modules/@babel/core/cjs-proxy.cjs')
-rw-r--r--node_modules/@babel/core/cjs-proxy.cjs53
1 files changed, 53 insertions, 0 deletions
diff --git a/node_modules/@babel/core/cjs-proxy.cjs b/node_modules/@babel/core/cjs-proxy.cjs
new file mode 100644
index 00000000..7ca4f321
--- /dev/null
+++ b/node_modules/@babel/core/cjs-proxy.cjs
@@ -0,0 +1,53 @@
+"use strict";
+
+const babelP = import("./lib/index.js");
+let babel = null;
+Object.defineProperty(exports, "__ initialize @babel/core cjs proxy __", {
+ set(val) {
+ babel = val;
+ },
+});
+
+exports.version = require("./package.json").version;
+
+const functionNames = [
+ "createConfigItem",
+ "loadPartialConfig",
+ "loadOptions",
+ "transform",
+ "transformFile",
+ "transformFromAst",
+ "parse",
+];
+const propertyNames = ["types", "tokTypes", "traverse", "template"];
+
+for (const name of functionNames) {
+ exports[name] = function (...args) {
+ babelP.then(babel => {
+ babel[name](...args);
+ });
+ };
+ exports[`${name}Async`] = function (...args) {
+ return babelP.then(babel => babel[`${name}Async`](...args));
+ };
+ exports[`${name}Sync`] = function (...args) {
+ if (!babel) throw notLoadedError(`${name}Sync`, "callable");
+ return babel[`${name}Sync`](...args);
+ };
+}
+
+for (const name of propertyNames) {
+ Object.defineProperty(exports, name, {
+ get() {
+ if (!babel) throw notLoadedError(name, "accessible");
+ return babel[name];
+ },
+ });
+}
+
+function notLoadedError(name, keyword) {
+ return new Error(
+ `The \`${name}\` export of @babel/core is only ${keyword}` +
+ ` from the CommonJS version after that the ESM version is loaded.`
+ );
+}