create project
This commit is contained in:
219
kitabcitab/node_modules/next/dist/esm/build/babel/loader/get-config.js
generated
vendored
Normal file
219
kitabcitab/node_modules/next/dist/esm/build/babel/loader/get-config.js
generated
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
import { readFileSync } from "fs";
|
||||
import JSON5 from "next/dist/compiled/json5";
|
||||
import { createConfigItem, loadOptions } from "next/dist/compiled/babel/core";
|
||||
import loadConfig from "next/dist/compiled/babel/core-lib-config";
|
||||
import { consumeIterator } from "./util";
|
||||
import * as Log from "../../output/log";
|
||||
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 ? createConfigItem(require("../plugins/commonjs"), {
|
||||
type: "plugin"
|
||||
}) : null;
|
||||
const reactRefreshItem = hasReactRefresh ? createConfigItem([
|
||||
require("next/dist/compiled/react-refresh/babel"),
|
||||
{
|
||||
skipEnvCheck: true
|
||||
},
|
||||
], {
|
||||
type: "plugin"
|
||||
}) : null;
|
||||
const pageConfigItem = !isServer && isPageFile ? createConfigItem([
|
||||
require("../plugins/next-page-config")
|
||||
], {
|
||||
type: "plugin"
|
||||
}) : null;
|
||||
const disallowExportAllItem = !isServer && isPageFile ? createConfigItem([
|
||||
require("../plugins/next-page-disallow-re-export-all-exports")
|
||||
], {
|
||||
type: "plugin"
|
||||
}) : null;
|
||||
const transformDefineItem = 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 ? createConfigItem([
|
||||
require.resolve("../plugins/next-ssg-transform")
|
||||
], {
|
||||
type: "plugin"
|
||||
}) : null;
|
||||
const commonJsItem = isNextDist ? createConfigItem(require("next/dist/compiled/babel/plugin-transform-modules-commonjs"), {
|
||||
type: "plugin"
|
||||
}) : null;
|
||||
const nextFontUnsupported = 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 = readFileSync(configFilePath, "utf8");
|
||||
return JSON5.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 = loadOptions(options);
|
||||
const config = consumeIterator(loadConfig(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();
|
||||
export default 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;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=get-config.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/build/babel/loader/get-config.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/build/babel/loader/get-config.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
25
kitabcitab/node_modules/next/dist/esm/build/babel/loader/index.js
generated
vendored
Normal file
25
kitabcitab/node_modules/next/dist/esm/build/babel/loader/index.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import transform from "./transform";
|
||||
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.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);
|
||||
});
|
||||
};
|
||||
export default nextBabelLoaderOuter;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/build/babel/loader/index.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/build/babel/loader/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../build/babel/loader/index.ts"],"names":["transform","nextBabelLoader","parentTrace","inputSource","inputSourceMap","filename","resourcePath","target","loaderOptions","traceChild","traceFn","getOptions","loaderSpanInner","code","transformedSource","map","outputSourceMap","call","nextBabelLoaderOuter","callback","async","loaderSpan","currentTraceSpan","traceAsyncFn","then","err"],"mappings":"AACA,OAAOA,SAAS,MAAM,aAAa,CAAA;AAGnC,eAAeC,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,IACtBV,SAAS,CAACiB,IAAI,CACZ,IAAI,EACJd,WAAW,EACXC,cAAc,EACdI,aAAa,EACbH,QAAQ,EACRE,MAAM,EACNK,eAAe,CAChB,CACF;IAEH,OAAO;QAACE,iBAAiB;QAAEE,eAAe;KAAC,CAAA;CAC5C;AAED,MAAME,oBAAoB,GAAG,SAASA,oBAAoB,CAExDf,WAAmB,EACnBC,cAAyC,EACzC;IACA,MAAMe,QAAQ,GAAG,IAAI,CAACC,KAAK,EAAE;IAE7B,MAAMC,UAAU,GAAG,IAAI,CAACC,gBAAgB,CAACb,UAAU,CAAC,yBAAyB,CAAC;IAC9EY,UAAU,CACPE,YAAY,CAAC,IACZtB,eAAe,CAACgB,IAAI,CAAC,IAAI,EAAEI,UAAU,EAAElB,WAAW,EAAEC,cAAc,CAAC,CACpE,CACAoB,IAAI,CACH,CAAC,CAACV,iBAAiB,EAAEE,eAAe,CAAM;QACxCG,OAAAA,QAAQ,QAA8D,GAAtEA,KAAAA,CAAsE,GAAtEA,QAAQ,CAAG,IAAI,EAAEL,iBAAiB,EAAEE,eAAe,IAAIZ,cAAc,CAAC,CAAA;KAAA,EACxE,CAACqB,GAAG,GAAK;QACPN,QAAQ,QAAO,GAAfA,KAAAA,CAAe,GAAfA,QAAQ,CAAGM,GAAG,CAAC,CAAA;KAChB,CACF;CACJ;AAED,eAAeP,oBAAoB,CAAA"}
|
||||
82
kitabcitab/node_modules/next/dist/esm/build/babel/loader/transform.js
generated
vendored
Normal file
82
kitabcitab/node_modules/next/dist/esm/build/babel/loader/transform.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Partially adapted from @babel/core (MIT license).
|
||||
*/ import traverse from "next/dist/compiled/babel/traverse";
|
||||
import generate from "next/dist/compiled/babel/generator";
|
||||
import normalizeFile from "next/dist/compiled/babel/core-lib-normalize-file";
|
||||
import normalizeOpts from "next/dist/compiled/babel/core-lib-normalize-opts";
|
||||
import loadBlockHoistPlugin from "next/dist/compiled/babel/core-lib-block-hoist-plugin";
|
||||
import PluginPass from "next/dist/compiled/babel/core-lib-plugin-pass";
|
||||
import getConfig from "./get-config";
|
||||
import { consumeIterator } from "./util";
|
||||
function getTraversalParams(file, pluginPairs) {
|
||||
const passPairs = [];
|
||||
const passes = [];
|
||||
const visitors = [];
|
||||
for (const plugin of pluginPairs.concat(loadBlockHoistPlugin())){
|
||||
const pass = new PluginPass(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.visitors.merge(visitors, passes, // @ts-ignore - the exported types are incorrect here
|
||||
file.opts.wrapPluginVisitorMethod);
|
||||
parentSpan.traceChild("babel-turbo-traverse").traceFn(()=>traverse(file.ast, visitor, file.scope));
|
||||
invokePluginPost(file, passPairs);
|
||||
}
|
||||
function transformAst(file, babelConfig, parentSpan) {
|
||||
for (const pluginPairs of babelConfig.passes){
|
||||
transformAstPass(file, pluginPairs, parentSpan);
|
||||
}
|
||||
}
|
||||
export default function transform(source, inputSourceMap, loaderOptions, filename, target, parentSpan) {
|
||||
const getConfigSpan = parentSpan.traceChild("babel-turbo-get-config");
|
||||
const babelConfig = getConfig.call(this, {
|
||||
source,
|
||||
loaderOptions,
|
||||
inputSourceMap,
|
||||
target,
|
||||
filename
|
||||
});
|
||||
getConfigSpan.stop();
|
||||
const normalizeSpan = parentSpan.traceChild("babel-turbo-normalize-file");
|
||||
const file = consumeIterator(normalizeFile(babelConfig.passes, normalizeOpts(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 } = generate(file.ast, file.opts.generatorOpts, file.code);
|
||||
generateSpan.stop();
|
||||
return {
|
||||
code,
|
||||
map
|
||||
};
|
||||
};
|
||||
|
||||
//# sourceMappingURL=transform.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/build/babel/loader/transform.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/build/babel/loader/transform.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../build/babel/loader/transform.ts"],"names":["traverse","generate","normalizeFile","normalizeOpts","loadBlockHoistPlugin","PluginPass","getConfig","consumeIterator","getTraversalParams","file","pluginPairs","passPairs","passes","visitors","plugin","concat","pass","key","options","push","visitor","invokePluginPre","pre","call","invokePluginPost","post","transformAstPass","parentSpan","merge","opts","wrapPluginVisitorMethod","traceChild","traceFn","ast","scope","transformAst","babelConfig","transform","source","inputSourceMap","loaderOptions","filename","target","getConfigSpan","stop","normalizeSpan","transformSpan","generateSpan","code","map","generatorOpts"],"mappings":"AAAA;;GAEG,CAEH,OAAOA,QAAQ,MAAM,mCAAmC,CAAA;AACxD,OAAOC,QAAQ,MAAM,oCAAoC,CAAA;AACzD,OAAOC,aAAa,MAAM,kDAAkD,CAAA;AAC5E,OAAOC,aAAa,MAAM,kDAAkD,CAAA;AAC5E,OAAOC,oBAAoB,MAAM,sDAAsD,CAAA;AACvF,OAAOC,UAAU,MAAM,+CAA+C,CAAA;AAEtE,OAAOC,SAAS,MAAM,cAAc,CAAA;AACpC,SAASC,eAAe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EpB,MAAME,aAAa,GAAGnB,UAAU,CAACI,UAAU,CAAC,uBAAuB,CAAC;IACpEI,YAAY,CAAC1B,IAAI,EAAE2B,WAAW,EAAEU,aAAa,CAAC;IAC9CA,aAAa,CAACF,IAAI,EAAE;IAEpB,MAAMG,YAAY,GAAGpB,UAAU,CAACI,UAAU,CAAC,sBAAsB,CAAC;IAClE,MAAM,EAAEiB,IAAI,CAAA,EAAEC,GAAG,CAAA,EAAE,GAAGhD,QAAQ,CAACQ,IAAI,CAACwB,GAAG,EAAExB,IAAI,CAACoB,IAAI,CAACqB,aAAa,EAAEzC,IAAI,CAACuC,IAAI,CAAC;IAC5ED,YAAY,CAACH,IAAI,EAAE;IAEnB,OAAO;QAAEI,IAAI;QAAEC,GAAG;KAAE,CAAA;CACrB,CAAA"}
|
||||
20
kitabcitab/node_modules/next/dist/esm/build/babel/loader/types.d.ts
generated
vendored
Normal file
20
kitabcitab/node_modules/next/dist/esm/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
|
||||
}
|
||||
10
kitabcitab/node_modules/next/dist/esm/build/babel/loader/util.js
generated
vendored
Normal file
10
kitabcitab/node_modules/next/dist/esm/build/babel/loader/util.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export function consumeIterator(iter) {
|
||||
while(true){
|
||||
const { value , done } = iter.next();
|
||||
if (done) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=util.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/build/babel/loader/util.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/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,OAAO,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"}
|
||||
26
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/amp-attributes.js
generated
vendored
Normal file
26
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/amp-attributes.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
export default function AmpAttributePatcher() {
|
||||
return {
|
||||
visitor: {
|
||||
JSXOpeningElement (path) {
|
||||
const openingElement = path.node;
|
||||
const { name , attributes } = openingElement;
|
||||
if (!(name && name.type === "JSXIdentifier")) {
|
||||
return;
|
||||
}
|
||||
if (!name.name.startsWith("amp-")) {
|
||||
return;
|
||||
}
|
||||
for (const attribute of attributes){
|
||||
if (attribute.type !== "JSXAttribute") {
|
||||
continue;
|
||||
}
|
||||
if (attribute.name.name === "className") {
|
||||
attribute.name.name = "class";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//# sourceMappingURL=amp-attributes.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/amp-attributes.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/amp-attributes.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../build/babel/plugins/amp-attributes.ts"],"names":["AmpAttributePatcher","visitor","JSXOpeningElement","path","openingElement","node","name","attributes","type","startsWith","attribute"],"mappings":"AAEA,eAAe,SAASA,mBAAmB,GAAc;IACvD,OAAO;QACLC,OAAO,EAAE;YACPC,iBAAiB,EAACC,IAAuC,EAAE;gBACzD,MAAMC,cAAc,GAAGD,IAAI,CAACE,IAAI;gBAEhC,MAAM,EAAEC,IAAI,CAAA,EAAEC,UAAU,CAAA,EAAE,GAAGH,cAAc;gBAC3C,IAAI,CAAC,CAACE,IAAI,IAAIA,IAAI,CAACE,IAAI,KAAK,eAAe,CAAC,EAAE;oBAC5C,OAAM;iBACP;gBAED,IAAI,CAACF,IAAI,CAACA,IAAI,CAACG,UAAU,CAAC,MAAM,CAAC,EAAE;oBACjC,OAAM;iBACP;gBAED,KAAK,MAAMC,SAAS,IAAIH,UAAU,CAAE;oBAClC,IAAIG,SAAS,CAACF,IAAI,KAAK,cAAc,EAAE;wBACrC,SAAQ;qBACT;oBAED,IAAIE,SAAS,CAACJ,IAAI,CAACA,IAAI,KAAK,WAAW,EAAE;wBACvCI,SAAS,CAACJ,IAAI,CAACA,IAAI,GAAG,OAAO;qBAC9B;iBACF;aACF;SACF;KACF,CAAA;CACF,CAAA"}
|
||||
27
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/commonjs.js
generated
vendored
Normal file
27
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/commonjs.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import commonjsPlugin from "next/dist/compiled/babel/plugin-transform-modules-commonjs";
|
||||
// Handle module.exports in user code
|
||||
export default function CommonJSModulePlugin(...args) {
|
||||
const commonjs = commonjsPlugin(...args);
|
||||
return {
|
||||
visitor: {
|
||||
Program: {
|
||||
exit (path, state) {
|
||||
let foundModuleExports = false;
|
||||
path.traverse({
|
||||
MemberExpression (expressionPath) {
|
||||
if (expressionPath.node.object.name !== "module") return;
|
||||
if (expressionPath.node.property.name !== "exports") return;
|
||||
foundModuleExports = true;
|
||||
}
|
||||
});
|
||||
if (!foundModuleExports) {
|
||||
return;
|
||||
}
|
||||
commonjs.visitor.Program.exit.call(this, path, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//# sourceMappingURL=commonjs.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/commonjs.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/commonjs.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../build/babel/plugins/commonjs.ts"],"names":["commonjsPlugin","CommonJSModulePlugin","args","commonjs","visitor","Program","exit","path","state","foundModuleExports","traverse","MemberExpression","expressionPath","node","object","name","property","call"],"mappings":"AACA,OAAOA,cAAc,MAAM,4DAA4D,CAAA;AAEvF,qCAAqC;AACrC,eAAe,SAASC,oBAAoB,CAAC,GAAGC,IAAI,AAAK,EAAa;IACpE,MAAMC,QAAQ,GAAGH,cAAc,IAAIE,IAAI,CAAC;IACxC,OAAO;QACLE,OAAO,EAAE;YACPC,OAAO,EAAE;gBACPC,IAAI,EAACC,IAA6B,EAAEC,KAAK,EAAE;oBACzC,IAAIC,kBAAkB,GAAG,KAAK;oBAC9BF,IAAI,CAACG,QAAQ,CAAC;wBACZC,gBAAgB,EAACC,cAAmB,EAAE;4BACpC,IAAIA,cAAc,CAACC,IAAI,CAACC,MAAM,CAACC,IAAI,KAAK,QAAQ,EAAE,OAAM;4BACxD,IAAIH,cAAc,CAACC,IAAI,CAACG,QAAQ,CAACD,IAAI,KAAK,SAAS,EAAE,OAAM;4BAC3DN,kBAAkB,GAAG,IAAI;yBAC1B;qBACF,CAAC;oBAEF,IAAI,CAACA,kBAAkB,EAAE;wBACvB,OAAM;qBACP;oBAEDN,QAAQ,CAACC,OAAO,CAACC,OAAO,CAACC,IAAI,CAACW,IAAI,CAAC,IAAI,EAAEV,IAAI,EAAEC,KAAK,CAAC;iBACtD;aACF;SACF;KACF,CAAA;CACF,CAAA"}
|
||||
59
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/jsx-pragma.js
generated
vendored
Normal file
59
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/jsx-pragma.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import jsx from "next/dist/compiled/babel/plugin-syntax-jsx";
|
||||
export default function({ types: t }) {
|
||||
return {
|
||||
inherits: jsx,
|
||||
visitor: {
|
||||
JSXElement (_path, state) {
|
||||
state.set("jsx", true);
|
||||
},
|
||||
// Fragment syntax is still JSX since it compiles to createElement(),
|
||||
// but JSXFragment is not a JSXElement
|
||||
JSXFragment (_path, state) {
|
||||
state.set("jsx", true);
|
||||
},
|
||||
Program: {
|
||||
exit (path, state) {
|
||||
if (state.get("jsx")) {
|
||||
const pragma = t.identifier(state.opts.pragma);
|
||||
let importAs = pragma;
|
||||
// if there's already a React in scope, use that instead of adding an import
|
||||
const existingBinding = state.opts.reuseImport !== false && state.opts.importAs && path.scope.getBinding(state.opts.importAs);
|
||||
// var _jsx = _pragma.createElement;
|
||||
if (state.opts.property) {
|
||||
if (state.opts.importAs) {
|
||||
importAs = t.identifier(state.opts.importAs);
|
||||
} else {
|
||||
importAs = path.scope.generateUidIdentifier("pragma");
|
||||
}
|
||||
const mapping = t.variableDeclaration("var", [
|
||||
t.variableDeclarator(pragma, t.memberExpression(importAs, t.identifier(state.opts.property))),
|
||||
]);
|
||||
// if the React binding came from a require('react'),
|
||||
// make sure that our usage comes after it.
|
||||
let newPath;
|
||||
if (existingBinding && t.isVariableDeclarator(existingBinding.path.node) && t.isCallExpression(existingBinding.path.node.init) && t.isIdentifier(existingBinding.path.node.init.callee) && existingBinding.path.node.init.callee.name === "require") {
|
||||
[newPath] = existingBinding.path.parentPath.insertAfter(mapping);
|
||||
} else {
|
||||
[newPath] = path.unshiftContainer("body", mapping);
|
||||
}
|
||||
for (const declar of newPath.get("declarations")){
|
||||
path.scope.registerBinding(newPath.node.kind, declar);
|
||||
}
|
||||
}
|
||||
if (!existingBinding) {
|
||||
const importSpecifier = t.importDeclaration([
|
||||
state.opts.import ? t.importSpecifier(importAs, t.identifier(state.opts.import)) : state.opts.importNamespace ? t.importNamespaceSpecifier(importAs) : t.importDefaultSpecifier(importAs),
|
||||
], t.stringLiteral(state.opts.module || "react"));
|
||||
const [newPath] = path.unshiftContainer("body", importSpecifier);
|
||||
for (const specifier of newPath.get("specifiers")){
|
||||
path.scope.registerBinding("module", specifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//# sourceMappingURL=jsx-pragma.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/jsx-pragma.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/jsx-pragma.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../build/babel/plugins/jsx-pragma.ts"],"names":["jsx","types","t","inherits","visitor","JSXElement","_path","state","set","JSXFragment","Program","exit","path","get","pragma","identifier","opts","importAs","existingBinding","reuseImport","scope","getBinding","property","generateUidIdentifier","mapping","variableDeclaration","variableDeclarator","memberExpression","newPath","isVariableDeclarator","node","isCallExpression","init","isIdentifier","callee","name","parentPath","insertAfter","unshiftContainer","declar","registerBinding","kind","importSpecifier","importDeclaration","import","importNamespace","importNamespaceSpecifier","importDefaultSpecifier","stringLiteral","module","specifier"],"mappings":"AAKA,OAAOA,GAAG,MAAM,4CAA4C,CAAA;AAE5D,eAAe,SAAU,EACvBC,KAAK,EAAEC,CAAC,CAAA,EAGT,EAAkB;IACjB,OAAO;QACLC,QAAQ,EAAEH,GAAG;QACbI,OAAO,EAAE;YACPC,UAAU,EAACC,KAAK,EAAEC,KAAK,EAAE;gBACvBA,KAAK,CAACC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC;aACvB;YAED,qEAAqE;YACrE,sCAAsC;YACtCC,WAAW,EAACH,K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MAAM,EAAEI,eAAe,CAAC;4BAChE,KAAK,MAAMQ,SAAS,IAAItB,OAAO,CAACf,GAAG,CAAC,YAAY,CAAC,CAAE;gCACjDD,IAAI,CAACQ,KAAK,CAACoB,eAAe,CACxB,QAAQ,EACRU,SAAS,CACV;6BACF;yBACF;qBACF;iBACF;aACF;SACF;KACF,CAAA;CACF,CAAA"}
|
||||
20
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-font-unsupported.js
generated
vendored
Normal file
20
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-font-unsupported.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
export default function NextPageDisallowReExportAllExports() {
|
||||
return {
|
||||
visitor: {
|
||||
ImportDeclaration (path) {
|
||||
if ([
|
||||
"@next/font/local",
|
||||
"@next/font/google"
|
||||
].includes(path.node.source.value)) {
|
||||
var ref, ref1;
|
||||
const err = new SyntaxError(`"@next/font" requires SWC although Babel is being used due to a custom babel config being present.\nRead more: https://nextjs.org/docs/messages/babel-font-loader-conflict`);
|
||||
err.code = "BABEL_PARSE_ERROR";
|
||||
err.loc = (((ref = path.node.loc) == null ? void 0 : ref.start) ?? ((ref1 = path.node.loc) == null ? void 0 : ref1.end)) ?? path.node.loc;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//# sourceMappingURL=next-font-unsupported.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-font-unsupported.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-font-unsupported.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../build/babel/plugins/next-font-unsupported.ts"],"names":["NextPageDisallowReExportAllExports","visitor","ImportDeclaration","path","includes","node","source","value","err","SyntaxError","code","loc","start","end"],"mappings":"AAEA,eAAe,SAASA,kCAAkC,GAAmB;IAC3E,OAAO;QACLC,OAAO,EAAE;YACPC,iBAAiB,EAACC,IAAuC,EAAE;gBACzD,IACE;oBAAC,kBAAkB;oBAAE,mBAAmB;iBAAC,CAACC,QAAQ,CAChDD,IAAI,CAACE,IAAI,CAACC,MAAM,CAACC,KAAK,CACvB,EACD;wBAMEJ,GAAa,EAAWA,IAAa;oBALvC,MAAMK,GAAG,GAAG,IAAIC,WAAW,CACzB,CAAC,0KAA0K,CAAC,CAC7K,AACA;oBAAA,AAACD,GAAG,CAASE,IAAI,GAAG,mBAAmB,CACvC;oBAAA,AAACF,GAAG,CAASG,GAAG,GACfR,CAAAA,CAAAA,CAAAA,GAAa,GAAbA,IAAI,CAACE,IAAI,CAACM,GAAG,SAAO,GAApBR,KAAAA,CAAoB,GAApBA,GAAa,CAAES,KAAK,CAAA,IAAIT,CAAAA,CAAAA,IAAa,GAAbA,IAAI,CAACE,IAAI,CAACM,GAAG,SAAK,GAAlBR,KAAAA,CAAkB,GAAlBA,IAAa,CAAEU,GAAG,CAAA,CAAA,IAAIV,IAAI,CAACE,IAAI,CAACM,GAAG;oBAC7D,MAAMH,GAAG,CAAA;iBACV;aACF;SACF;KACF,CAAA;CACF,CAAA"}
|
||||
106
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-page-config.js
generated
vendored
Normal file
106
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-page-config.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
import { types as BabelTypes } from "next/dist/compiled/babel/core";
|
||||
import { STRING_LITERAL_DROP_BUNDLE } from "../../../shared/lib/constants";
|
||||
const CONFIG_KEY = "config";
|
||||
// replace program path with just a variable with the drop identifier
|
||||
function replaceBundle(path, t) {
|
||||
path.parentPath.replaceWith(t.program([
|
||||
t.variableDeclaration("const", [
|
||||
t.variableDeclarator(t.identifier(STRING_LITERAL_DROP_BUNDLE), t.stringLiteral(`${STRING_LITERAL_DROP_BUNDLE} ${Date.now()}`)),
|
||||
]),
|
||||
], []));
|
||||
}
|
||||
function errorMessage(state, details) {
|
||||
const pageName = (state.filename || "").split(state.cwd || "").pop() || "unknown";
|
||||
return `Invalid page config export found. ${details} in file ${pageName}. See: https://nextjs.org/docs/messages/invalid-page-config`;
|
||||
}
|
||||
// config to parsing pageConfig for client bundles
|
||||
export default function nextPageConfig({ types: t }) {
|
||||
return {
|
||||
visitor: {
|
||||
Program: {
|
||||
enter (path, state) {
|
||||
path.traverse({
|
||||
ExportDeclaration (exportPath, exportState) {
|
||||
var ref;
|
||||
if (BabelTypes.isExportNamedDeclaration(exportPath) && ((ref = exportPath.node.specifiers) == null ? void 0 : ref.some((specifier)=>{
|
||||
return (t.isIdentifier(specifier.exported) ? specifier.exported.name : specifier.exported.value) === CONFIG_KEY;
|
||||
})) && BabelTypes.isStringLiteral(exportPath.node.source)) {
|
||||
throw new Error(errorMessage(exportState, "Expected object but got export from"));
|
||||
}
|
||||
},
|
||||
ExportNamedDeclaration (exportPath, exportState) {
|
||||
var ref, ref1;
|
||||
if (exportState.bundleDropped || !exportPath.node.declaration && exportPath.node.specifiers.length === 0) {
|
||||
return;
|
||||
}
|
||||
const config = {};
|
||||
const declarations = [
|
||||
...((ref = exportPath.node.declaration) == null ? void 0 : ref.declarations) || [],
|
||||
(ref1 = exportPath.scope.getBinding(CONFIG_KEY)) == null ? void 0 : ref1.path.node,
|
||||
].filter(Boolean);
|
||||
for (const specifier of exportPath.node.specifiers){
|
||||
if ((t.isIdentifier(specifier.exported) ? specifier.exported.name : specifier.exported.value) === CONFIG_KEY) {
|
||||
// export {} from 'somewhere'
|
||||
if (BabelTypes.isStringLiteral(exportPath.node.source)) {
|
||||
throw new Error(errorMessage(exportState, `Expected object but got import`));
|
||||
// import hello from 'world'
|
||||
// export { hello as config }
|
||||
} else if (BabelTypes.isIdentifier(specifier.local)) {
|
||||
var ref2;
|
||||
if (BabelTypes.isImportSpecifier((ref2 = exportPath.scope.getBinding(specifier.local.name)) == null ? void 0 : ref2.path.node)) {
|
||||
throw new Error(errorMessage(exportState, `Expected object but got import`));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const declaration of declarations){
|
||||
if (!BabelTypes.isIdentifier(declaration.id, {
|
||||
name: CONFIG_KEY
|
||||
})) {
|
||||
continue;
|
||||
}
|
||||
let { init } = declaration;
|
||||
if (BabelTypes.isTSAsExpression(init)) {
|
||||
init = init.expression;
|
||||
}
|
||||
if (!BabelTypes.isObjectExpression(init)) {
|
||||
const got = init ? init.type : "undefined";
|
||||
throw new Error(errorMessage(exportState, `Expected object but got ${got}`));
|
||||
}
|
||||
for (const prop of init.properties){
|
||||
if (BabelTypes.isSpreadElement(prop)) {
|
||||
throw new Error(errorMessage(exportState, `Property spread is not allowed`));
|
||||
}
|
||||
const { name } = prop.key;
|
||||
if (BabelTypes.isIdentifier(prop.key, {
|
||||
name: "amp"
|
||||
})) {
|
||||
if (!BabelTypes.isObjectProperty(prop)) {
|
||||
throw new Error(errorMessage(exportState, `Invalid property "${name}"`));
|
||||
}
|
||||
if (!BabelTypes.isBooleanLiteral(prop.value) && !BabelTypes.isStringLiteral(prop.value)) {
|
||||
throw new Error(errorMessage(exportState, `Invalid value for "${name}"`));
|
||||
}
|
||||
config.amp = prop.value.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.amp === true) {
|
||||
var ref3, ref4;
|
||||
if (!((ref3 = exportState.file) == null ? void 0 : (ref4 = ref3.opts) == null ? void 0 : ref4.caller.isDev)) {
|
||||
// don't replace bundle in development so HMR can track
|
||||
// dependencies and trigger reload when they are changed
|
||||
replaceBundle(exportPath, t);
|
||||
}
|
||||
exportState.bundleDropped = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//# sourceMappingURL=next-page-config.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-page-config.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-page-config.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
15
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-page-disallow-re-export-all-exports.js
generated
vendored
Normal file
15
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-page-disallow-re-export-all-exports.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
export default function NextPageDisallowReExportAllExports() {
|
||||
return {
|
||||
visitor: {
|
||||
ExportAllDeclaration (path) {
|
||||
var ref, ref1;
|
||||
const err = new SyntaxError(`Using \`export * from '...'\` in a page is disallowed. Please use \`export { default } from '...'\` instead.\n` + `Read more: https://nextjs.org/docs/messages/export-all-in-page`);
|
||||
err.code = "BABEL_PARSE_ERROR";
|
||||
err.loc = (((ref = path.node.loc) == null ? void 0 : ref.start) ?? ((ref1 = path.node.loc) == null ? void 0 : ref1.end)) ?? path.node.loc;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//# sourceMappingURL=next-page-disallow-re-export-all-exports.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-page-disallow-re-export-all-exports.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-page-disallow-re-export-all-exports.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../build/babel/plugins/next-page-disallow-re-export-all-exports.ts"],"names":["NextPageDisallowReExportAllExports","visitor","ExportAllDeclaration","path","err","SyntaxError","code","loc","node","start","end"],"mappings":"AAEA,eAAe,SAASA,kCAAkC,GAAmB;IAC3E,OAAO;QACLC,OAAO,EAAE;YACPC,oBAAoB,EAACC,IAA0C,EAAE;oBAO7DA,GAAa,EAAWA,IAAa;gBANvC,MAAMC,GAAG,GAAG,IAAIC,WAAW,CACzB,CAAC,8GAA8G,CAAC,GAC9G,CAAC,8DAA8D,CAAC,CACnE,AACA;gBAAA,AAACD,GAAG,CAASE,IAAI,GAAG,mBAAmB,CACvC;gBAAA,AAACF,GAAG,CAASG,GAAG,GACfJ,CAAAA,CAAAA,CAAAA,GAAa,GAAbA,IAAI,CAACK,IAAI,CAACD,GAAG,SAAO,GAApBJ,KAAAA,CAAoB,GAApBA,GAAa,CAAEM,KAAK,CAAA,IAAIN,CAAAA,CAAAA,IAAa,GAAbA,IAAI,CAACK,IAAI,CAACD,GAAG,SAAK,GAAlBJ,KAAAA,CAAkB,GAAlBA,IAAa,CAAEO,GAAG,CAAA,CAAA,IAAIP,IAAI,CAACK,IAAI,CAACD,GAAG;gBAC7D,MAAMH,GAAG,CAAA;aACV;SACF;KACF,CAAA;CACF,CAAA"}
|
||||
298
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-ssg-transform.js
generated
vendored
Normal file
298
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-ssg-transform.js
generated
vendored
Normal file
@@ -0,0 +1,298 @@
|
||||
import { SERVER_PROPS_SSG_CONFLICT } from "../../../lib/constants";
|
||||
import { SERVER_PROPS_ID, STATIC_PROPS_ID } from "../../../shared/lib/constants";
|
||||
export const EXPORT_NAME_GET_STATIC_PROPS = "getStaticProps";
|
||||
export const EXPORT_NAME_GET_STATIC_PATHS = "getStaticPaths";
|
||||
export const EXPORT_NAME_GET_SERVER_PROPS = "getServerSideProps";
|
||||
const ssgExports = new Set([
|
||||
EXPORT_NAME_GET_STATIC_PROPS,
|
||||
EXPORT_NAME_GET_STATIC_PATHS,
|
||||
EXPORT_NAME_GET_SERVER_PROPS,
|
||||
// legacy methods added so build doesn't fail from importing
|
||||
// server-side only methods
|
||||
`unstable_getStaticProps`,
|
||||
`unstable_getStaticPaths`,
|
||||
`unstable_getServerProps`,
|
||||
`unstable_getServerSideProps`,
|
||||
]);
|
||||
function decorateSsgExport(t, path, state) {
|
||||
const gsspName = state.isPrerender ? STATIC_PROPS_ID : SERVER_PROPS_ID;
|
||||
const gsspId = t.identifier(gsspName);
|
||||
const addGsspExport = (exportPath)=>{
|
||||
if (state.done) {
|
||||
return;
|
||||
}
|
||||
state.done = true;
|
||||
const [pageCompPath] = exportPath.replaceWithMultiple([
|
||||
t.exportNamedDeclaration(t.variableDeclaration(// We use 'var' instead of 'let' or 'const' for ES5 support. Since
|
||||
// this runs in `Program#exit`, no ES2015 transforms (preset env)
|
||||
// will be ran against this code.
|
||||
"var", [
|
||||
t.variableDeclarator(gsspId, t.booleanLiteral(true))
|
||||
]), [
|
||||
t.exportSpecifier(gsspId, gsspId)
|
||||
]),
|
||||
exportPath.node,
|
||||
]);
|
||||
exportPath.scope.registerDeclaration(pageCompPath);
|
||||
};
|
||||
path.traverse({
|
||||
ExportDefaultDeclaration (exportDefaultPath) {
|
||||
addGsspExport(exportDefaultPath);
|
||||
},
|
||||
ExportNamedDeclaration (exportNamedPath) {
|
||||
addGsspExport(exportNamedPath);
|
||||
}
|
||||
});
|
||||
}
|
||||
const isDataIdentifier = (name, state)=>{
|
||||
if (ssgExports.has(name)) {
|
||||
if (name === EXPORT_NAME_GET_SERVER_PROPS) {
|
||||
if (state.isPrerender) {
|
||||
throw new Error(SERVER_PROPS_SSG_CONFLICT);
|
||||
}
|
||||
state.isServerProps = true;
|
||||
} else {
|
||||
if (state.isServerProps) {
|
||||
throw new Error(SERVER_PROPS_SSG_CONFLICT);
|
||||
}
|
||||
state.isPrerender = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
export default function nextTransformSsg({ types: t }) {
|
||||
function getIdentifier(path) {
|
||||
const parentPath = path.parentPath;
|
||||
if (parentPath.type === "VariableDeclarator") {
|
||||
const pp = parentPath;
|
||||
const name = pp.get("id");
|
||||
return name.node.type === "Identifier" ? name : null;
|
||||
}
|
||||
if (parentPath.type === "AssignmentExpression") {
|
||||
const pp = parentPath;
|
||||
const name = pp.get("left");
|
||||
return name.node.type === "Identifier" ? name : null;
|
||||
}
|
||||
if (path.node.type === "ArrowFunctionExpression") {
|
||||
return null;
|
||||
}
|
||||
return path.node.id && path.node.id.type === "Identifier" ? path.get("id") : null;
|
||||
}
|
||||
function isIdentifierReferenced(ident) {
|
||||
const b = ident.scope.getBinding(ident.node.name);
|
||||
if (b == null ? void 0 : b.referenced) {
|
||||
// Functions can reference themselves, so we need to check if there's a
|
||||
// binding outside the function scope or not.
|
||||
if (b.path.type === "FunctionDeclaration") {
|
||||
return !b.constantViolations.concat(b.referencePaths)// Check that every reference is contained within the function:
|
||||
.every((ref)=>ref.findParent((p)=>p === b.path));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function markFunction(path, state) {
|
||||
const ident = getIdentifier(path);
|
||||
if ((ident == null ? void 0 : ident.node) && isIdentifierReferenced(ident)) {
|
||||
state.refs.add(ident);
|
||||
}
|
||||
}
|
||||
function markImport(path, state) {
|
||||
const local = path.get("local");
|
||||
if (isIdentifierReferenced(local)) {
|
||||
state.refs.add(local);
|
||||
}
|
||||
}
|
||||
return {
|
||||
visitor: {
|
||||
Program: {
|
||||
enter (path, state) {
|
||||
state.refs = new Set();
|
||||
state.isPrerender = false;
|
||||
state.isServerProps = false;
|
||||
state.done = false;
|
||||
path.traverse({
|
||||
VariableDeclarator (variablePath, variableState) {
|
||||
if (variablePath.node.id.type === "Identifier") {
|
||||
const local = variablePath.get("id");
|
||||
if (isIdentifierReferenced(local)) {
|
||||
variableState.refs.add(local);
|
||||
}
|
||||
} else if (variablePath.node.id.type === "ObjectPattern") {
|
||||
const pattern = variablePath.get("id");
|
||||
const properties = pattern.get("properties");
|
||||
properties.forEach((p)=>{
|
||||
const local = p.get(p.node.type === "ObjectProperty" ? "value" : p.node.type === "RestElement" ? "argument" : function() {
|
||||
throw new Error("invariant");
|
||||
}());
|
||||
if (isIdentifierReferenced(local)) {
|
||||
variableState.refs.add(local);
|
||||
}
|
||||
});
|
||||
} else if (variablePath.node.id.type === "ArrayPattern") {
|
||||
const pattern = variablePath.get("id");
|
||||
const elements = pattern.get("elements");
|
||||
elements.forEach((e)=>{
|
||||
var ref, ref1;
|
||||
let local;
|
||||
if (((ref = e.node) == null ? void 0 : ref.type) === "Identifier") {
|
||||
local = e;
|
||||
} else if (((ref1 = e.node) == null ? void 0 : ref1.type) === "RestElement") {
|
||||
local = e.get("argument");
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (isIdentifierReferenced(local)) {
|
||||
variableState.refs.add(local);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
FunctionDeclaration: markFunction,
|
||||
FunctionExpression: markFunction,
|
||||
ArrowFunctionExpression: markFunction,
|
||||
ImportSpecifier: markImport,
|
||||
ImportDefaultSpecifier: markImport,
|
||||
ImportNamespaceSpecifier: markImport,
|
||||
ExportNamedDeclaration (exportNamedPath, exportNamedState) {
|
||||
const specifiers = exportNamedPath.get("specifiers");
|
||||
if (specifiers.length) {
|
||||
specifiers.forEach((s)=>{
|
||||
if (isDataIdentifier(t.isIdentifier(s.node.exported) ? s.node.exported.name : s.node.exported.value, exportNamedState)) {
|
||||
s.remove();
|
||||
}
|
||||
});
|
||||
if (exportNamedPath.node.specifiers.length < 1) {
|
||||
exportNamedPath.remove();
|
||||
}
|
||||
return;
|
||||
}
|
||||
const decl = exportNamedPath.get("declaration");
|
||||
if (decl == null || decl.node == null) {
|
||||
return;
|
||||
}
|
||||
switch(decl.node.type){
|
||||
case "FunctionDeclaration":
|
||||
{
|
||||
const name = decl.node.id.name;
|
||||
if (isDataIdentifier(name, exportNamedState)) {
|
||||
exportNamedPath.remove();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "VariableDeclaration":
|
||||
{
|
||||
const inner = decl.get("declarations");
|
||||
inner.forEach((d)=>{
|
||||
if (d.node.id.type !== "Identifier") {
|
||||
return;
|
||||
}
|
||||
const name = d.node.id.name;
|
||||
if (isDataIdentifier(name, exportNamedState)) {
|
||||
d.remove();
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}, state);
|
||||
if (!state.isPrerender && !state.isServerProps) {
|
||||
return;
|
||||
}
|
||||
const refs = state.refs;
|
||||
let count;
|
||||
function sweepFunction(sweepPath) {
|
||||
const ident = getIdentifier(sweepPath);
|
||||
if ((ident == null ? void 0 : ident.node) && refs.has(ident) && !isIdentifierReferenced(ident)) {
|
||||
++count;
|
||||
if (t.isAssignmentExpression(sweepPath.parentPath) || t.isVariableDeclarator(sweepPath.parentPath)) {
|
||||
sweepPath.parentPath.remove();
|
||||
} else {
|
||||
sweepPath.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
function sweepImport(sweepPath) {
|
||||
const local = sweepPath.get("local");
|
||||
if (refs.has(local) && !isIdentifierReferenced(local)) {
|
||||
++count;
|
||||
sweepPath.remove();
|
||||
if (sweepPath.parent.specifiers.length === 0) {
|
||||
sweepPath.parentPath.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
do {
|
||||
path.scope.crawl();
|
||||
count = 0;
|
||||
path.traverse({
|
||||
// eslint-disable-next-line no-loop-func
|
||||
VariableDeclarator (variablePath) {
|
||||
if (variablePath.node.id.type === "Identifier") {
|
||||
const local = variablePath.get("id");
|
||||
if (refs.has(local) && !isIdentifierReferenced(local)) {
|
||||
++count;
|
||||
variablePath.remove();
|
||||
}
|
||||
} else if (variablePath.node.id.type === "ObjectPattern") {
|
||||
const pattern = variablePath.get("id");
|
||||
const beforeCount = count;
|
||||
const properties = pattern.get("properties");
|
||||
properties.forEach((p)=>{
|
||||
const local = p.get(p.node.type === "ObjectProperty" ? "value" : p.node.type === "RestElement" ? "argument" : function() {
|
||||
throw new Error("invariant");
|
||||
}());
|
||||
if (refs.has(local) && !isIdentifierReferenced(local)) {
|
||||
++count;
|
||||
p.remove();
|
||||
}
|
||||
});
|
||||
if (beforeCount !== count && pattern.get("properties").length < 1) {
|
||||
variablePath.remove();
|
||||
}
|
||||
} else if (variablePath.node.id.type === "ArrayPattern") {
|
||||
const pattern = variablePath.get("id");
|
||||
const beforeCount = count;
|
||||
const elements = pattern.get("elements");
|
||||
elements.forEach((e)=>{
|
||||
var ref, ref2;
|
||||
let local;
|
||||
if (((ref = e.node) == null ? void 0 : ref.type) === "Identifier") {
|
||||
local = e;
|
||||
} else if (((ref2 = e.node) == null ? void 0 : ref2.type) === "RestElement") {
|
||||
local = e.get("argument");
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (refs.has(local) && !isIdentifierReferenced(local)) {
|
||||
++count;
|
||||
e.remove();
|
||||
}
|
||||
});
|
||||
if (beforeCount !== count && pattern.get("elements").length < 1) {
|
||||
variablePath.remove();
|
||||
}
|
||||
}
|
||||
},
|
||||
FunctionDeclaration: sweepFunction,
|
||||
FunctionExpression: sweepFunction,
|
||||
ArrowFunctionExpression: sweepFunction,
|
||||
ImportSpecifier: sweepImport,
|
||||
ImportDefaultSpecifier: sweepImport,
|
||||
ImportNamespaceSpecifier: sweepImport
|
||||
});
|
||||
}while (count);
|
||||
decorateSsgExport(t, path, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//# sourceMappingURL=next-ssg-transform.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-ssg-transform.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/next-ssg-transform.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
49
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/optimize-hook-destructuring.js
generated
vendored
Normal file
49
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/optimize-hook-destructuring.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
// matches any hook-like (the default)
|
||||
const isHook = /^use[A-Z]/;
|
||||
// matches only built-in hooks provided by React et al
|
||||
const isBuiltInHook = /^use(Callback|Context|DebugValue|Effect|ImperativeHandle|LayoutEffect|Memo|Reducer|Ref|State)$/;
|
||||
export default function({ types: t }) {
|
||||
const visitor = {
|
||||
CallExpression (path, state) {
|
||||
const onlyBuiltIns = state.opts.onlyBuiltIns;
|
||||
// if specified, options.lib is a list of libraries that provide hook functions
|
||||
const libs = state.opts.lib && (state.opts.lib === true ? [
|
||||
"react",
|
||||
"preact/hooks"
|
||||
] : [].concat(state.opts.lib));
|
||||
// skip function calls that are not the init of a variable declaration:
|
||||
if (!t.isVariableDeclarator(path.parent)) return;
|
||||
// skip function calls where the return value is not Array-destructured:
|
||||
if (!t.isArrayPattern(path.parent.id)) return;
|
||||
// name of the (hook) function being called:
|
||||
const hookName = path.node.callee.name;
|
||||
if (libs) {
|
||||
const binding = path.scope.getBinding(hookName);
|
||||
// not an import
|
||||
if (!binding || binding.kind !== "module") return;
|
||||
const specifier = binding.path.parent.source.value;
|
||||
// not a match
|
||||
if (!libs.some((lib)=>lib === specifier)) return;
|
||||
}
|
||||
// only match function calls with names that look like a hook
|
||||
if (!(onlyBuiltIns ? isBuiltInHook : isHook).test(hookName)) return;
|
||||
path.parent.id = t.objectPattern(path.parent.id.elements.reduce((patterns, element, i)=>{
|
||||
if (element === null) {
|
||||
return patterns;
|
||||
}
|
||||
return patterns.concat(t.objectProperty(t.numericLiteral(i), element));
|
||||
}, []));
|
||||
}
|
||||
};
|
||||
return {
|
||||
name: "optimize-hook-destructuring",
|
||||
visitor: {
|
||||
// this is a workaround to run before preset-env destroys destructured assignments
|
||||
Program (path, state) {
|
||||
path.traverse(visitor, state);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//# sourceMappingURL=optimize-hook-destructuring.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/optimize-hook-destructuring.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/optimize-hook-destructuring.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../build/babel/plugins/optimize-hook-destructuring.ts"],"names":["isHook","isBuiltInHook","types","t","visitor","CallExpression","path","state","onlyBuiltIns","opts","libs","lib","concat","isVariableDeclarator","parent","isArrayPattern","id","hookName","node","callee","name","binding","scope","getBinding","kind","specifier","source","value","some","test","objectPattern","elements","reduce","patterns","element","i","objectProperty","numericLiteral","Program","traverse"],"mappings":"AAMA,sCAAsC;AACtC,MAAMA,MAAM,cAAc;AAE1B,sDAAsD;AACtD,MAAMC,aAAa,mGAC+E;AAElG,eAAe,SAAU,EACvBC,KAAK,EAAEC,CAAC,CAAA,EAGT,EAAkB;IACjB,MAAMC,OAAO,GAAG;QACdC,cAAc,EAACC,IAAyC,EAAEC,KAAU,EAAE;YACpE,MAAMC,YAAY,GAAGD,KAAK,CAACE,IAAI,CAACD,YAAY;YAE5C,+EAA+E;YAC/E,MAAME,IAAI,GACRH,KAAK,CAACE,IAAI,CAACE,GAAG,IACd,CAACJ,KAAK,CAACE,IAAI,CAACE,GAAG,KAAK,IAAI,GACpB;gBAAC,OAAO;gBAAE,cAAc;aAAC,GACzB,EAAE,CAACC,MAAM,CAACL,KAAK,CAACE,IAAI,CAACE,GAAG,CAAC,CAAC;YAEhC,uEAAuE;YACvE,IAAI,CAACR,CAAC,CAACU,oBAAoB,CAACP,IAAI,CAACQ,MAAM,CAAC,EAAE,OAAM;YAEhD,wEAAwE;YACxE,IAAI,CAACX,CAAC,CAACY,cAAc,CAACT,IAAI,CAACQ,MAAM,CAACE,EAAE,CAAC,EAAE,OAAM;YAE7C,4CAA4C;YAC5C,MAAMC,QAAQ,GAAG,AAACX,IAAI,CAACY,IAAI,CAACC,MAAM,CAA2BC,IAAI;YAEjE,IAAIV,IAAI,EAAE;gBACR,MAAMW,OAAO,GAAGf,IAAI,CAACgB,KAAK,CAACC,UAAU,CAACN,QAAQ,CAAC;gBAC/C,gBAAgB;gBAChB,IAAI,CAACI,OAAO,IAAIA,OAAO,CAACG,IAAI,KAAK,QAAQ,EAAE,OAAM;gBAEjD,MAAMC,SAAS,GAAG,AAACJ,OAAO,CAACf,IAAI,CAACQ,MAAM,CACnCY,MAAM,CAACC,KAAK;gBACf,cAAc;gBACd,IAAI,CAACjB,IAAI,CAACkB,IAAI,CAAC,CAACjB,GAAQ,GAAKA,GAAG,KAAKc,SAAS,CAAC,EAAE,OAAM;aACxD;YAED,6DAA6D;YAC7D,IAAI,CAAC,CAACjB,YAAY,GAAGP,aAAa,GAAGD,MAAM,CAAC,CAAC6B,IAAI,CAACZ,QAAQ,CAAC,EAAE,OAAM;YAEnEX,IAAI,CAACQ,MAAM,CAACE,EAAE,GAAGb,CAAC,CAAC2B,aAAa,CAC9BxB,IAAI,CAACQ,MAAM,CAACE,EAAE,CAACe,QAAQ,CAACC,MAAM,CAC5B,CAACC,QAAQ,EAAEC,OAAO,EAAEC,CAAC,GAAK;gBACxB,IAAID,OAAO,KAAK,IAAI,EAAE;oBACpB,OAAOD,QAAQ,CAAA;iBAChB;gBAED,OAAOA,QAAQ,CAACrB,MAAM,CACpBT,CAAC,CAACiC,cAAc,CAACjC,CAAC,CAACkC,cAAc,CAACF,CAAC,CAAC,EAAED,OAAO,CAAC,CAC/C,CAAA;aACF,EACD,EAAE,CACH,CACF;SACF;KACF;IAED,OAAO;QACLd,IAAI,EAAE,6BAA6B;QACnChB,OAAO,EAAE;YACP,kFAAkF;YAClFkC,OAAO,EAAChC,IAAI,EAAEC,KAAK,EAAE;gBACnBD,IAAI,CAACiC,QAAQ,CAACnC,OAAO,EAAEG,KAAK,CAAC;aAC9B;SACF;KACF,CAAA;CACF,CAAA"}
|
||||
105
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/react-loadable-plugin.js
generated
vendored
Normal file
105
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/react-loadable-plugin.js
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
import { relative as relativePath } from "path";
|
||||
export default function({ types: t }) {
|
||||
return {
|
||||
visitor: {
|
||||
ImportDeclaration (path, state) {
|
||||
let source = path.node.source.value;
|
||||
if (source !== "next/dynamic") return;
|
||||
let defaultSpecifier = path.get("specifiers").find((specifier)=>{
|
||||
return specifier.isImportDefaultSpecifier();
|
||||
});
|
||||
if (!defaultSpecifier) return;
|
||||
const bindingName = defaultSpecifier.node.local.name;
|
||||
const binding = path.scope.getBinding(bindingName);
|
||||
if (!binding) {
|
||||
return;
|
||||
}
|
||||
binding.referencePaths.forEach((refPath)=>{
|
||||
var ref2, ref1;
|
||||
let callExpression = refPath.parentPath;
|
||||
if (callExpression.isMemberExpression() && callExpression.node.computed === false) {
|
||||
const property = callExpression.get("property");
|
||||
if (!Array.isArray(property) && property.isIdentifier({
|
||||
name: "Map"
|
||||
})) {
|
||||
callExpression = callExpression.parentPath;
|
||||
}
|
||||
}
|
||||
if (!callExpression.isCallExpression()) return;
|
||||
const callExpression_ = callExpression;
|
||||
let args = callExpression_.get("arguments");
|
||||
if (args.length > 2) {
|
||||
throw callExpression_.buildCodeFrameError("next/dynamic only accepts 2 arguments");
|
||||
}
|
||||
if (!args[0]) {
|
||||
return;
|
||||
}
|
||||
let loader;
|
||||
let options;
|
||||
if (args[0].isObjectExpression()) {
|
||||
options = args[0];
|
||||
} else {
|
||||
if (!args[1]) {
|
||||
callExpression_.node.arguments.push(t.objectExpression([]));
|
||||
}
|
||||
// This is needed as the code is modified above
|
||||
args = callExpression_.get("arguments");
|
||||
loader = args[0];
|
||||
options = args[1];
|
||||
}
|
||||
if (!options.isObjectExpression()) return;
|
||||
const options_ = options;
|
||||
let properties = options_.get("properties");
|
||||
let propertiesMap = {};
|
||||
properties.forEach((property)=>{
|
||||
const key = property.get("key");
|
||||
propertiesMap[key.node.name] = property;
|
||||
});
|
||||
if (propertiesMap.loadableGenerated) {
|
||||
return;
|
||||
}
|
||||
if (propertiesMap.loader) {
|
||||
loader = propertiesMap.loader.get("value");
|
||||
}
|
||||
if (propertiesMap.modules) {
|
||||
loader = propertiesMap.modules.get("value");
|
||||
}
|
||||
if (!loader || Array.isArray(loader)) {
|
||||
return;
|
||||
}
|
||||
const dynamicImports = [];
|
||||
const dynamicKeys = [];
|
||||
loader.traverse({
|
||||
Import (importPath) {
|
||||
var ref;
|
||||
const importArguments = importPath.parentPath.get("arguments");
|
||||
if (!Array.isArray(importArguments)) return;
|
||||
const node = importArguments[0].node;
|
||||
dynamicImports.push(node);
|
||||
dynamicKeys.push(t.binaryExpression("+", t.stringLiteral((((ref = state.file.opts.caller) == null ? void 0 : ref.pagesDir) ? relativePath(state.file.opts.caller.pagesDir, state.file.opts.filename) : state.file.opts.filename) + " -> "), node));
|
||||
}
|
||||
});
|
||||
if (!dynamicImports.length) return;
|
||||
options.node.properties.push(t.objectProperty(t.identifier("loadableGenerated"), t.objectExpression(((ref2 = state.file.opts.caller) == null ? void 0 : ref2.isDev) || ((ref1 = state.file.opts.caller) == null ? void 0 : ref1.isServer) ? [
|
||||
t.objectProperty(t.identifier("modules"), t.arrayExpression(dynamicKeys)),
|
||||
] : [
|
||||
t.objectProperty(t.identifier("webpack"), t.arrowFunctionExpression([], t.arrayExpression(dynamicImports.map((dynamicImport)=>{
|
||||
return t.callExpression(t.memberExpression(t.identifier("require"), t.identifier("resolveWeak")), [
|
||||
dynamicImport
|
||||
]);
|
||||
})))),
|
||||
])));
|
||||
// Turns `dynamic(import('something'))` into `dynamic(() => import('something'))` for backwards compat.
|
||||
// This is the replicate the behavior in versions below Next.js 7 where we magically handled not executing the `import()` too.
|
||||
// We'll deprecate this behavior and provide a codemod for it in 7.1.
|
||||
if (loader.isCallExpression()) {
|
||||
const arrowFunction = t.arrowFunctionExpression([], loader.node);
|
||||
loader.replaceWith(arrowFunction);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//# sourceMappingURL=react-loadable-plugin.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/react-loadable-plugin.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/build/babel/plugins/react-loadable-plugin.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
154
kitabcitab/node_modules/next/dist/esm/build/babel/preset.js
generated
vendored
Normal file
154
kitabcitab/node_modules/next/dist/esm/build/babel/preset.js
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
import { dirname } from "path";
|
||||
const isLoadIntentTest = process.env.NODE_ENV === "test";
|
||||
const isLoadIntentDevelopment = process.env.NODE_ENV === "development";
|
||||
// Resolve styled-jsx plugins
|
||||
function styledJsxOptions(options) {
|
||||
options = options || {};
|
||||
options.styleModule = "styled-jsx/style";
|
||||
if (!Array.isArray(options.plugins)) {
|
||||
return options;
|
||||
}
|
||||
options.plugins = options.plugins.map((plugin)=>{
|
||||
if (Array.isArray(plugin)) {
|
||||
const [name, pluginOptions] = plugin;
|
||||
return [
|
||||
require.resolve(name),
|
||||
pluginOptions
|
||||
];
|
||||
}
|
||||
return require.resolve(plugin);
|
||||
});
|
||||
return options;
|
||||
}
|
||||
// Taken from https://github.com/babel/babel/commit/d60c5e1736543a6eac4b549553e107a9ba967051#diff-b4beead8ad9195361b4537601cc22532R158
|
||||
function supportsStaticESM(caller) {
|
||||
return !!(caller == null ? void 0 : caller.supportsStaticESM);
|
||||
}
|
||||
export default ((api, options = {})=>{
|
||||
var ref, ref1;
|
||||
const supportsESM = api.caller(supportsStaticESM);
|
||||
const isServer = api.caller((caller)=>!!caller && caller.isServer);
|
||||
const isCallerDevelopment = api.caller((caller)=>{
|
||||
return caller == null ? void 0 : caller.isDev;
|
||||
});
|
||||
// Look at external intent if used without a caller (e.g. via Jest):
|
||||
const isTest = isCallerDevelopment == null && isLoadIntentTest;
|
||||
// Look at external intent if used without a caller (e.g. Storybook):
|
||||
const isDevelopment = isCallerDevelopment === true || isCallerDevelopment == null && isLoadIntentDevelopment;
|
||||
// Default to production mode if not `test` nor `development`:
|
||||
const isProduction = !(isTest || isDevelopment);
|
||||
const isBabelLoader = api.caller((caller)=>!!caller && (caller.name === "babel-loader" || caller.name === "next-babel-turbo-loader"));
|
||||
const useJsxRuntime = ((ref = options["preset-react"]) == null ? void 0 : ref.runtime) === "automatic" || Boolean(api.caller((caller)=>!!caller && caller.hasJsxRuntime)) && ((ref1 = options["preset-react"]) == null ? void 0 : ref1.runtime) !== "classic";
|
||||
const presetEnvConfig = {
|
||||
// In the test environment `modules` is often needed to be set to true, babel figures that out by itself using the `'auto'` option
|
||||
// In production/development this option is set to `false` so that webpack can handle import/export with tree-shaking
|
||||
modules: "auto",
|
||||
exclude: [
|
||||
"transform-typeof-symbol"
|
||||
],
|
||||
...options["preset-env"]
|
||||
};
|
||||
// When transpiling for the server or tests, target the current Node version
|
||||
// if not explicitly specified:
|
||||
if ((isServer || isTest) && (!presetEnvConfig.targets || !(typeof presetEnvConfig.targets === "object" && "node" in presetEnvConfig.targets))) {
|
||||
presetEnvConfig.targets = {
|
||||
// Targets the current process' version of Node. This requires apps be
|
||||
// built and deployed on the same version of Node.
|
||||
// This is the same as using "current" but explicit
|
||||
node: process.versions.node
|
||||
};
|
||||
}
|
||||
return {
|
||||
sourceType: "unambiguous",
|
||||
presets: [
|
||||
[
|
||||
require("next/dist/compiled/babel/preset-env"),
|
||||
presetEnvConfig
|
||||
],
|
||||
[
|
||||
require("next/dist/compiled/babel/preset-react"),
|
||||
{
|
||||
// This adds @babel/plugin-transform-react-jsx-source and
|
||||
// @babel/plugin-transform-react-jsx-self automatically in development
|
||||
development: isDevelopment || isTest,
|
||||
...useJsxRuntime ? {
|
||||
runtime: "automatic"
|
||||
} : {
|
||||
pragma: "__jsx"
|
||||
},
|
||||
...options["preset-react"]
|
||||
},
|
||||
],
|
||||
[
|
||||
require("next/dist/compiled/babel/preset-typescript"),
|
||||
{
|
||||
allowNamespaces: true,
|
||||
...options["preset-typescript"]
|
||||
},
|
||||
],
|
||||
],
|
||||
plugins: [
|
||||
!useJsxRuntime && [
|
||||
require("./plugins/jsx-pragma"),
|
||||
{
|
||||
// This produces the following injected import for modules containing JSX:
|
||||
// import React from 'react';
|
||||
// var __jsx = React.createElement;
|
||||
module: "react",
|
||||
importAs: "React",
|
||||
pragma: "__jsx",
|
||||
property: "createElement"
|
||||
},
|
||||
],
|
||||
[
|
||||
require("./plugins/optimize-hook-destructuring"),
|
||||
{
|
||||
// only optimize hook functions imported from React/Preact
|
||||
lib: true
|
||||
},
|
||||
],
|
||||
require("next/dist/compiled/babel/plugin-syntax-dynamic-import"),
|
||||
require("next/dist/compiled/babel/plugin-syntax-import-assertions"),
|
||||
require("./plugins/react-loadable-plugin"),
|
||||
[
|
||||
require("next/dist/compiled/babel/plugin-proposal-class-properties"),
|
||||
options["class-properties"] || {},
|
||||
],
|
||||
[
|
||||
require("next/dist/compiled/babel/plugin-proposal-object-rest-spread"),
|
||||
{
|
||||
useBuiltIns: true
|
||||
},
|
||||
],
|
||||
!isServer && [
|
||||
require("next/dist/compiled/babel/plugin-transform-runtime"),
|
||||
{
|
||||
corejs: false,
|
||||
helpers: true,
|
||||
regenerator: true,
|
||||
useESModules: supportsESM && presetEnvConfig.modules !== "commonjs",
|
||||
absoluteRuntime: isBabelLoader ? dirname(require.resolve("next/dist/compiled/@babel/runtime/package.json")) : undefined,
|
||||
...options["transform-runtime"]
|
||||
},
|
||||
],
|
||||
[
|
||||
isTest && options["styled-jsx"] && options["styled-jsx"]["babel-test"] ? require("styled-jsx/babel-test") : require("styled-jsx/babel"),
|
||||
styledJsxOptions(options["styled-jsx"]),
|
||||
],
|
||||
require("./plugins/amp-attributes"),
|
||||
isProduction && [
|
||||
require("next/dist/compiled/babel/plugin-transform-react-remove-prop-types"),
|
||||
{
|
||||
removeImport: true
|
||||
},
|
||||
],
|
||||
isServer && require("next/dist/compiled/babel/plugin-syntax-bigint"),
|
||||
// Always compile numeric separator because the resulting number is
|
||||
// smaller.
|
||||
require("next/dist/compiled/babel/plugin-proposal-numeric-separator"),
|
||||
require("next/dist/compiled/babel/plugin-proposal-export-namespace-from"),
|
||||
].filter(Boolean)
|
||||
};
|
||||
});
|
||||
|
||||
//# sourceMappingURL=preset.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/build/babel/preset.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/build/babel/preset.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user