create project
This commit is contained in:
10
kitabcitab/node_modules/next/dist/build/babel/loader/get-config.d.ts
generated
vendored
Normal file
10
kitabcitab/node_modules/next/dist/build/babel/loader/get-config.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { NextBabelLoaderOptions, NextJsLoaderContext } from './types';
|
||||
declare type BabelConfig = any;
|
||||
export default function getConfig(this: NextJsLoaderContext, { source, target, loaderOptions, filename, inputSourceMap, }: {
|
||||
source: string;
|
||||
loaderOptions: NextBabelLoaderOptions;
|
||||
target: string;
|
||||
filename: string;
|
||||
inputSourceMap?: object | null;
|
||||
}): BabelConfig;
|
||||
export {};
|
||||
268
kitabcitab/node_modules/next/dist/build/babel/loader/get-config.js
generated
vendored
Normal file
268
kitabcitab/node_modules/next/dist/build/babel/loader/get-config.js
generated
vendored
Normal file
@@ -0,0 +1,268 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = getConfig;
|
||||
var _fs = require("fs");
|
||||
var _json5 = _interopRequireDefault(require("next/dist/compiled/json5"));
|
||||
var _core = require("next/dist/compiled/babel/core");
|
||||
var _coreLibConfig = _interopRequireDefault(require("next/dist/compiled/babel/core-lib-config"));
|
||||
var _util = require("./util");
|
||||
var Log = _interopRequireWildcard(require("../../output/log"));
|
||||
function getConfig({ source , target , loaderOptions , filename , inputSourceMap }) {
|
||||
const cacheCharacteristics = getCacheCharacteristics(loaderOptions, source, filename);
|
||||
if (loaderOptions.configFile) {
|
||||
// Ensures webpack invalidates the cache for this loader when the config file changes
|
||||
this.addDependency(loaderOptions.configFile);
|
||||
}
|
||||
const cacheKey = getCacheKey(cacheCharacteristics);
|
||||
if (configCache.has(cacheKey)) {
|
||||
const cachedConfig = configCache.get(cacheKey);
|
||||
return {
|
||||
...cachedConfig,
|
||||
options: {
|
||||
...cachedConfig.options,
|
||||
cwd: loaderOptions.cwd,
|
||||
root: loaderOptions.cwd,
|
||||
filename,
|
||||
sourceFileName: filename
|
||||
}
|
||||
};
|
||||
}
|
||||
if (loaderOptions.configFile && !configFiles.has(loaderOptions.configFile)) {
|
||||
configFiles.add(loaderOptions.configFile);
|
||||
Log.info(`Using external babel configuration from ${loaderOptions.configFile}`);
|
||||
}
|
||||
const freshConfig = getFreshConfig.call(this, cacheCharacteristics, loaderOptions, target, filename, inputSourceMap);
|
||||
configCache.set(cacheKey, freshConfig);
|
||||
return freshConfig;
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== "function") return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function() {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
||||
return {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for(var key in obj){
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
const nextDistPath = /(next[\\/]dist[\\/]shared[\\/]lib)|(next[\\/]dist[\\/]client)|(next[\\/]dist[\\/]pages)/;
|
||||
const fileExtensionRegex = /\.([a-z]+)$/;
|
||||
function getCacheCharacteristics(loaderOptions, source, filename) {
|
||||
var ref;
|
||||
const { isServer , pagesDir } = loaderOptions;
|
||||
const isPageFile = filename.startsWith(pagesDir);
|
||||
const isNextDist = nextDistPath.test(filename);
|
||||
const hasModuleExports = source.indexOf("module.exports") !== -1;
|
||||
const fileExt = ((ref = fileExtensionRegex.exec(filename)) == null ? void 0 : ref[1]) || "unknown";
|
||||
return {
|
||||
isServer,
|
||||
isPageFile,
|
||||
isNextDist,
|
||||
hasModuleExports,
|
||||
fileExt
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Return an array of Babel plugins, conditioned upon loader options and
|
||||
* source file characteristics.
|
||||
*/ function getPlugins(loaderOptions, cacheCharacteristics) {
|
||||
const { isServer , isPageFile , isNextDist , hasModuleExports } = cacheCharacteristics;
|
||||
const { hasReactRefresh , development } = loaderOptions;
|
||||
const applyCommonJsItem = hasModuleExports ? (0, _core).createConfigItem(require("../plugins/commonjs"), {
|
||||
type: "plugin"
|
||||
}) : null;
|
||||
const reactRefreshItem = hasReactRefresh ? (0, _core).createConfigItem([
|
||||
require("next/dist/compiled/react-refresh/babel"),
|
||||
{
|
||||
skipEnvCheck: true
|
||||
},
|
||||
], {
|
||||
type: "plugin"
|
||||
}) : null;
|
||||
const pageConfigItem = !isServer && isPageFile ? (0, _core).createConfigItem([
|
||||
require("../plugins/next-page-config")
|
||||
], {
|
||||
type: "plugin"
|
||||
}) : null;
|
||||
const disallowExportAllItem = !isServer && isPageFile ? (0, _core).createConfigItem([
|
||||
require("../plugins/next-page-disallow-re-export-all-exports")
|
||||
], {
|
||||
type: "plugin"
|
||||
}) : null;
|
||||
const transformDefineItem = (0, _core).createConfigItem([
|
||||
require.resolve("next/dist/compiled/babel/plugin-transform-define"),
|
||||
{
|
||||
"process.env.NODE_ENV": development ? "development" : "production",
|
||||
"typeof window": isServer ? "undefined" : "object",
|
||||
"process.browser": isServer ? false : true
|
||||
},
|
||||
"next-js-transform-define-instance",
|
||||
], {
|
||||
type: "plugin"
|
||||
});
|
||||
const nextSsgItem = !isServer && isPageFile ? (0, _core).createConfigItem([
|
||||
require.resolve("../plugins/next-ssg-transform")
|
||||
], {
|
||||
type: "plugin"
|
||||
}) : null;
|
||||
const commonJsItem = isNextDist ? (0, _core).createConfigItem(require("next/dist/compiled/babel/plugin-transform-modules-commonjs"), {
|
||||
type: "plugin"
|
||||
}) : null;
|
||||
const nextFontUnsupported = (0, _core).createConfigItem([
|
||||
require("../plugins/next-font-unsupported")
|
||||
], {
|
||||
type: "plugin"
|
||||
});
|
||||
return [
|
||||
reactRefreshItem,
|
||||
pageConfigItem,
|
||||
disallowExportAllItem,
|
||||
applyCommonJsItem,
|
||||
transformDefineItem,
|
||||
nextSsgItem,
|
||||
commonJsItem,
|
||||
nextFontUnsupported,
|
||||
].filter(Boolean);
|
||||
}
|
||||
const isJsonFile = /\.(json|babelrc)$/;
|
||||
const isJsFile = /\.js$/;
|
||||
/**
|
||||
* While this function does block execution while reading from disk, it
|
||||
* should not introduce any issues. The function is only invoked when
|
||||
* generating a fresh config, and only a small handful of configs should
|
||||
* be generated during compilation.
|
||||
*/ function getCustomBabelConfig(configFilePath) {
|
||||
if (isJsonFile.exec(configFilePath)) {
|
||||
const babelConfigRaw = (0, _fs).readFileSync(configFilePath, "utf8");
|
||||
return _json5.default.parse(babelConfigRaw);
|
||||
} else if (isJsFile.exec(configFilePath)) {
|
||||
return require(configFilePath);
|
||||
}
|
||||
throw new Error("The Next.js Babel loader does not support .mjs or .cjs config files.");
|
||||
}
|
||||
/**
|
||||
* Generate a new, flat Babel config, ready to be handed to Babel-traverse.
|
||||
* This config should have no unresolved overrides, presets, etc.
|
||||
*/ function getFreshConfig(cacheCharacteristics, loaderOptions, target, filename, inputSourceMap) {
|
||||
let { isServer , pagesDir , development , hasJsxRuntime , configFile } = loaderOptions;
|
||||
let customConfig = configFile ? getCustomBabelConfig(configFile) : undefined;
|
||||
let options = {
|
||||
babelrc: false,
|
||||
cloneInputAst: false,
|
||||
filename,
|
||||
inputSourceMap: inputSourceMap || undefined,
|
||||
// Set the default sourcemap behavior based on Webpack's mapping flag,
|
||||
// but allow users to override if they want.
|
||||
sourceMaps: loaderOptions.sourceMaps === undefined ? this.sourceMap : loaderOptions.sourceMaps,
|
||||
// Ensure that Webpack will get a full absolute path in the sourcemap
|
||||
// so that it can properly map the module back to its internal cached
|
||||
// modules.
|
||||
sourceFileName: filename,
|
||||
plugins: [
|
||||
...getPlugins(loaderOptions, cacheCharacteristics),
|
||||
...(customConfig == null ? void 0 : customConfig.plugins) || [],
|
||||
],
|
||||
// target can be provided in babelrc
|
||||
target: isServer ? undefined : customConfig == null ? void 0 : customConfig.target,
|
||||
// env can be provided in babelrc
|
||||
env: customConfig == null ? void 0 : customConfig.env,
|
||||
presets: (()=>{
|
||||
// If presets is defined the user will have next/babel in their babelrc
|
||||
if (customConfig == null ? void 0 : customConfig.presets) {
|
||||
return customConfig.presets;
|
||||
}
|
||||
// If presets is not defined the user will likely have "env" in their babelrc
|
||||
if (customConfig) {
|
||||
return undefined;
|
||||
}
|
||||
// If no custom config is provided the default is to use next/babel
|
||||
return [
|
||||
"next/babel"
|
||||
];
|
||||
})(),
|
||||
overrides: loaderOptions.overrides,
|
||||
caller: {
|
||||
name: "next-babel-turbo-loader",
|
||||
supportsStaticESM: true,
|
||||
supportsDynamicImport: true,
|
||||
// Provide plugins with insight into webpack target.
|
||||
// https://github.com/babel/babel-loader/issues/787
|
||||
target: target,
|
||||
// Webpack 5 supports TLA behind a flag. We enable it by default
|
||||
// for Babel, and then webpack will throw an error if the experimental
|
||||
// flag isn't enabled.
|
||||
supportsTopLevelAwait: true,
|
||||
isServer,
|
||||
pagesDir,
|
||||
isDev: development,
|
||||
hasJsxRuntime,
|
||||
...loaderOptions.caller
|
||||
}
|
||||
};
|
||||
// Babel does strict checks on the config so undefined is not allowed
|
||||
if (typeof options.target === "undefined") {
|
||||
delete options.target;
|
||||
}
|
||||
Object.defineProperty(options.caller, "onWarning", {
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: (reason)=>{
|
||||
if (!(reason instanceof Error)) {
|
||||
reason = new Error(reason);
|
||||
}
|
||||
this.emitWarning(reason);
|
||||
}
|
||||
});
|
||||
const loadedOptions = (0, _core).loadOptions(options);
|
||||
const config = (0, _util).consumeIterator((0, _coreLibConfig).default(loadedOptions));
|
||||
return config;
|
||||
}
|
||||
/**
|
||||
* Each key returned here corresponds with a Babel config that can be shared.
|
||||
* The conditions of permissible sharing between files is dependent on specific
|
||||
* file attributes and Next.js compiler states: `CharacteristicsGermaneToCaching`.
|
||||
*/ function getCacheKey(cacheCharacteristics) {
|
||||
const { isServer , isPageFile , isNextDist , hasModuleExports , fileExt } = cacheCharacteristics;
|
||||
const flags = 0 | (isServer ? 0b0001 : 0) | (isPageFile ? 0b0010 : 0) | (isNextDist ? 0b0100 : 0) | (hasModuleExports ? 0b1000 : 0);
|
||||
return fileExt + flags;
|
||||
}
|
||||
const configCache = new Map();
|
||||
const configFiles = new Set();
|
||||
|
||||
//# sourceMappingURL=get-config.js.map
|
||||
1
kitabcitab/node_modules/next/dist/build/babel/loader/get-config.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/build/babel/loader/get-config.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
kitabcitab/node_modules/next/dist/build/babel/loader/index.d.ts
generated
vendored
Normal file
3
kitabcitab/node_modules/next/dist/build/babel/loader/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { NextJsLoaderContext } from './types';
|
||||
declare const nextBabelLoaderOuter: (this: NextJsLoaderContext, inputSource: string, inputSourceMap: object | null | undefined) => void;
|
||||
export default nextBabelLoaderOuter;
|
||||
36
kitabcitab/node_modules/next/dist/build/babel/loader/index.js
generated
vendored
Normal file
36
kitabcitab/node_modules/next/dist/build/babel/loader/index.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _transform = _interopRequireDefault(require("./transform"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
async function nextBabelLoader(parentTrace, inputSource, inputSourceMap) {
|
||||
const filename = this.resourcePath;
|
||||
const target = this.target;
|
||||
const loaderOptions = parentTrace.traceChild("get-options")// @ts-ignore TODO: remove ignore once webpack 5 types are used
|
||||
.traceFn(()=>this.getOptions());
|
||||
const loaderSpanInner = parentTrace.traceChild("next-babel-turbo-transform");
|
||||
const { code: transformedSource , map: outputSourceMap } = loaderSpanInner.traceFn(()=>_transform.default.call(this, inputSource, inputSourceMap, loaderOptions, filename, target, loaderSpanInner));
|
||||
return [
|
||||
transformedSource,
|
||||
outputSourceMap
|
||||
];
|
||||
}
|
||||
const nextBabelLoaderOuter = function nextBabelLoaderOuter(inputSource, inputSourceMap) {
|
||||
const callback = this.async();
|
||||
const loaderSpan = this.currentTraceSpan.traceChild("next-babel-turbo-loader");
|
||||
loaderSpan.traceAsyncFn(()=>nextBabelLoader.call(this, loaderSpan, inputSource, inputSourceMap)).then(([transformedSource, outputSourceMap])=>{
|
||||
return callback == null ? void 0 : callback(null, transformedSource, outputSourceMap || inputSourceMap);
|
||||
}, (err)=>{
|
||||
callback == null ? void 0 : callback(err);
|
||||
});
|
||||
};
|
||||
var _default = nextBabelLoaderOuter;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
kitabcitab/node_modules/next/dist/build/babel/loader/index.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/build/babel/loader/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../build/babel/loader/index.ts"],"names":["nextBabelLoader","parentTrace","inputSource","inputSourceMap","filename","resourcePath","target","loaderOptions","traceChild","traceFn","getOptions","loaderSpanInner","code","transformedSource","map","outputSourceMap","transform","call","nextBabelLoaderOuter","callback","async","loaderSpan","currentTraceSpan","traceAsyncFn","then","err"],"mappings":"AAAA;;;;;AACsB,IAAA,UAAa,kCAAb,aAAa,EAAA;;;;;;AAGnC,eAAeA,eAAe,CAE5BC,WAAiB,EACjBC,WAAmB,EACnBC,cAAyC,EACzC;IACA,MAAMC,QAAQ,GAAG,IAAI,CAACC,YAAY;IAClC,MAAMC,MAAM,GAAG,IAAI,CAACA,MAAM;IAC1B,MAAMC,aAAa,GAAGN,WAAW,CAC9BO,UAAU,CAAC,aAAa,CAAC,AAC1B,+DAA+D;KAC9DC,OAAO,CAAC,IAAM,IAAI,CAACC,UAAU,EAAE,CAAC;IAEnC,MAAMC,eAAe,GAAGV,WAAW,CAACO,UAAU,CAAC,4BAA4B,CAAC;IAC5E,MAAM,EAAEI,IAAI,EAAEC,iBAAiB,CAAA,EAAEC,GAAG,EAAEC,eAAe,CAAA,EAAE,GACrDJ,eAAe,CAACF,OAAO,CAAC,IACtBO,UAAS,QAAA,CAACC,IAAI,CACZ,IAAI,EACJf,WAAW,EACXC,cAAc,EACdI,aAAa,EACbH,QAAQ,EACRE,MAAM,EACNK,eAAe,CAChB,CACF;IAEH,OAAO;QAACE,iBAAiB;QAAEE,eAAe;KAAC,CAAA;CAC5C;AAED,MAAMG,oBAAoB,GAAG,SAASA,oBAAoB,CAExDhB,WAAmB,EACnBC,cAAyC,EACzC;IACA,MAAMgB,QAAQ,GAAG,IAAI,CAACC,KAAK,EAAE;IAE7B,MAAMC,UAAU,GAAG,IAAI,CAACC,gBAAgB,CAACd,UAAU,CAAC,yBAAyB,CAAC;IAC9Ea,UAAU,CACPE,YAAY,CAAC,IACZvB,eAAe,CAACiB,IAAI,CAAC,IAAI,EAAEI,UAAU,EAAEnB,WAAW,EAAEC,cAAc,CAAC,CACpE,CACAqB,IAAI,CACH,CAAC,CAACX,iBAAiB,EAAEE,eAAe,CAAM;QACxCI,OAAAA,QAAQ,QAA8D,GAAtEA,KAAAA,CAAsE,GAAtEA,QAAQ,CAAG,IAAI,EAAEN,iBAAiB,EAAEE,eAAe,IAAIZ,cAAc,CAAC,CAAA;KAAA,EACxE,CAACsB,GAAG,GAAK;QACPN,QAAQ,QAAO,GAAfA,KAAAA,CAAe,GAAfA,QAAQ,CAAGM,GAAG,CAAC,CAAA;KAChB,CACF;CACJ;eAEcP,oBAAoB"}
|
||||
14
kitabcitab/node_modules/next/dist/build/babel/loader/transform.d.ts
generated
vendored
Normal file
14
kitabcitab/node_modules/next/dist/build/babel/loader/transform.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Span } from '../../../trace';
|
||||
import { NextJsLoaderContext } from './types';
|
||||
export default function transform(this: NextJsLoaderContext, source: string, inputSourceMap: object | null | undefined, loaderOptions: any, filename: string, target: string, parentSpan: Span): {
|
||||
code: string;
|
||||
map: {
|
||||
version: number;
|
||||
sources: string[];
|
||||
names: string[];
|
||||
sourceRoot?: string | undefined;
|
||||
sourcesContent?: string[] | undefined;
|
||||
mappings: string;
|
||||
file: string;
|
||||
} | null;
|
||||
};
|
||||
90
kitabcitab/node_modules/next/dist/build/babel/loader/transform.js
generated
vendored
Normal file
90
kitabcitab/node_modules/next/dist/build/babel/loader/transform.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = transform;
|
||||
var _traverse = _interopRequireDefault(require("next/dist/compiled/babel/traverse"));
|
||||
var _generator = _interopRequireDefault(require("next/dist/compiled/babel/generator"));
|
||||
var _coreLibNormalizeFile = _interopRequireDefault(require("next/dist/compiled/babel/core-lib-normalize-file"));
|
||||
var _coreLibNormalizeOpts = _interopRequireDefault(require("next/dist/compiled/babel/core-lib-normalize-opts"));
|
||||
var _coreLibBlockHoistPlugin = _interopRequireDefault(require("next/dist/compiled/babel/core-lib-block-hoist-plugin"));
|
||||
var _coreLibPluginPass = _interopRequireDefault(require("next/dist/compiled/babel/core-lib-plugin-pass"));
|
||||
var _getConfig = _interopRequireDefault(require("./get-config"));
|
||||
var _util = require("./util");
|
||||
function transform(source, inputSourceMap, loaderOptions, filename, target, parentSpan) {
|
||||
const getConfigSpan = parentSpan.traceChild("babel-turbo-get-config");
|
||||
const babelConfig = _getConfig.default.call(this, {
|
||||
source,
|
||||
loaderOptions,
|
||||
inputSourceMap,
|
||||
target,
|
||||
filename
|
||||
});
|
||||
getConfigSpan.stop();
|
||||
const normalizeSpan = parentSpan.traceChild("babel-turbo-normalize-file");
|
||||
const file = (0, _util).consumeIterator((0, _coreLibNormalizeFile).default(babelConfig.passes, (0, _coreLibNormalizeOpts).default(babelConfig), source));
|
||||
normalizeSpan.stop();
|
||||
const transformSpan = parentSpan.traceChild("babel-turbo-transform");
|
||||
transformAst(file, babelConfig, transformSpan);
|
||||
transformSpan.stop();
|
||||
const generateSpan = parentSpan.traceChild("babel-turbo-generate");
|
||||
const { code , map } = (0, _generator).default(file.ast, file.opts.generatorOpts, file.code);
|
||||
generateSpan.stop();
|
||||
return {
|
||||
code,
|
||||
map
|
||||
};
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function getTraversalParams(file, pluginPairs) {
|
||||
const passPairs = [];
|
||||
const passes = [];
|
||||
const visitors = [];
|
||||
for (const plugin of pluginPairs.concat((0, _coreLibBlockHoistPlugin).default())){
|
||||
const pass = new _coreLibPluginPass.default(file, plugin.key, plugin.options);
|
||||
passPairs.push([
|
||||
plugin,
|
||||
pass
|
||||
]);
|
||||
passes.push(pass);
|
||||
visitors.push(plugin.visitor);
|
||||
}
|
||||
return {
|
||||
passPairs,
|
||||
passes,
|
||||
visitors
|
||||
};
|
||||
}
|
||||
function invokePluginPre(file, passPairs) {
|
||||
for (const [{ pre }, pass] of passPairs){
|
||||
if (pre) {
|
||||
pre.call(pass, file);
|
||||
}
|
||||
}
|
||||
}
|
||||
function invokePluginPost(file, passPairs) {
|
||||
for (const [{ post }, pass] of passPairs){
|
||||
if (post) {
|
||||
post.call(pass, file);
|
||||
}
|
||||
}
|
||||
}
|
||||
function transformAstPass(file, pluginPairs, parentSpan) {
|
||||
const { passPairs , passes , visitors } = getTraversalParams(file, pluginPairs);
|
||||
invokePluginPre(file, passPairs);
|
||||
const visitor = _traverse.default.visitors.merge(visitors, passes, // @ts-ignore - the exported types are incorrect here
|
||||
file.opts.wrapPluginVisitorMethod);
|
||||
parentSpan.traceChild("babel-turbo-traverse").traceFn(()=>(0, _traverse).default(file.ast, visitor, file.scope));
|
||||
invokePluginPost(file, passPairs);
|
||||
}
|
||||
function transformAst(file, babelConfig, parentSpan) {
|
||||
for (const pluginPairs of babelConfig.passes){
|
||||
transformAstPass(file, pluginPairs, parentSpan);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=transform.js.map
|
||||
1
kitabcitab/node_modules/next/dist/build/babel/loader/transform.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/build/babel/loader/transform.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../build/babel/loader/transform.ts"],"names":["transform","source","inputSourceMap","loaderOptions","filename","target","parentSpan","getConfigSpan","traceChild","babelConfig","getConfig","call","stop","normalizeSpan","file","consumeIterator","normalizeFile","passes","normalizeOpts","transformSpan","transformAst","generateSpan","code","map","generate","ast","opts","generatorOpts","getTraversalParams","pluginPairs","passPairs","visitors","plugin","concat","loadBlockHoistPlugin","pass","PluginPass","key","options","push","visitor","invokePluginPre","pre","invokePluginPost","post","transformAstPass","traverse","merge","wrapPluginVisitorMethod","traceFn","scope"],"mappings":"AAIA;;;;kBAmEwBA,SAAS;AAnEZ,IAAA,SAAmC,kCAAnC,mCAAmC,EAAA;AACnC,IAAA,UAAoC,kCAApC,oCAAoC,EAAA;AAC/B,IAAA,qBAAkD,kCAAlD,kDAAkD,EAAA;AAClD,IAAA,qBAAkD,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AI,EAAErB,IAAI,CAAC;SACtB;KACF;CACF;AAED,SAAS+B,gBAAgB,CAAC/B,IAAS,EAAEe,WAAkB,EAAEvB,UAAgB,EAAE;IACzE,MAAM,EAAEwB,SAAS,CAAA,EAAEb,MAAM,CAAA,EAAEc,QAAQ,CAAA,EAAE,GAAGH,kBAAkB,CAACd,IAAI,EAAEe,WAAW,CAAC;IAE7EY,eAAe,CAAC3B,IAAI,EAAEgB,SAAS,CAAC;IAChC,MAAMU,OAAO,GAAGM,SAAQ,QAAA,CAACf,QAAQ,CAACgB,KAAK,CACrChB,QAAQ,EACRd,MAAM,EACN,qDAAqD;IACrDH,IAAI,CAACY,IAAI,CAACsB,uBAAuB,CAClC;IAED1C,UAAU,CACPE,UAAU,CAAC,sBAAsB,CAAC,CAClCyC,OAAO,CAAC,IAAMH,CAAAA,GAAAA,SAAQ,AAA+B,CAAA,QAA/B,CAAChC,IAAI,CAACW,GAAG,EAAEe,OAAO,EAAE1B,IAAI,CAACoC,KAAK,CAAC,CAAC;IAEzDP,gBAAgB,CAAC7B,IAAI,EAAEgB,SAAS,CAAC;CAClC;AAED,SAASV,YAAY,CAACN,IAAS,EAAEL,WAAgB,EAAEH,UAAgB,EAAE;IACnE,KAAK,MAAMuB,WAAW,IAAIpB,WAAW,CAACQ,MAAM,CAAE;QAC5C4B,gBAAgB,CAAC/B,IAAI,EAAEe,WAAW,EAAEvB,UAAU,CAAC;KAChD;CACF"}
|
||||
20
kitabcitab/node_modules/next/dist/build/babel/loader/types.d.ts
generated
vendored
Normal file
20
kitabcitab/node_modules/next/dist/build/babel/loader/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { webpack } from 'next/dist/compiled/webpack/webpack'
|
||||
import { Span } from '../../../trace'
|
||||
|
||||
export interface NextJsLoaderContext extends webpack.LoaderContext<{}> {
|
||||
currentTraceSpan: Span
|
||||
target: string
|
||||
}
|
||||
|
||||
export interface NextBabelLoaderOptions {
|
||||
hasJsxRuntime: boolean
|
||||
hasReactRefresh: boolean
|
||||
isServer: boolean
|
||||
development: boolean
|
||||
pagesDir: string
|
||||
sourceMaps?: any[]
|
||||
overrides: any
|
||||
caller: any
|
||||
configFile: string | undefined
|
||||
cwd: string
|
||||
}
|
||||
1
kitabcitab/node_modules/next/dist/build/babel/loader/util.d.ts
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/build/babel/loader/util.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function consumeIterator(iter: Iterator<any>): any;
|
||||
15
kitabcitab/node_modules/next/dist/build/babel/loader/util.js
generated
vendored
Normal file
15
kitabcitab/node_modules/next/dist/build/babel/loader/util.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.consumeIterator = consumeIterator;
|
||||
function consumeIterator(iter) {
|
||||
while(true){
|
||||
const { value , done } = iter.next();
|
||||
if (done) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=util.js.map
|
||||
1
kitabcitab/node_modules/next/dist/build/babel/loader/util.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/build/babel/loader/util.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../build/babel/loader/util.ts"],"names":["consumeIterator","iter","value","done","next"],"mappings":"AAAA;;;;QAAgBA,eAAe,GAAfA,eAAe;AAAxB,SAASA,eAAe,CAACC,IAAmB,EAAE;IACnD,MAAO,IAAI,CAAE;QACX,MAAM,EAAEC,KAAK,CAAA,EAAEC,IAAI,CAAA,EAAE,GAAGF,IAAI,CAACG,IAAI,EAAE;QACnC,IAAID,IAAI,EAAE;YACR,OAAOD,KAAK,CAAA;SACb;KACF;CACF"}
|
||||
Reference in New Issue
Block a user