Initial commit
This commit is contained in:
commit
78f8d225ee
21173 changed files with 2907774 additions and 0 deletions
433
node_modules/next/dist/build/swc/generated-native.d.ts
generated
vendored
Normal file
433
node_modules/next/dist/build/swc/generated-native.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,433 @@
|
|||
// Manual additions to make the generated types below work.
|
||||
|
||||
import type { TurbopackResult } from './types'
|
||||
|
||||
export type TurboTasks = { readonly __tag: unique symbol }
|
||||
export type ExternalEndpoint = { readonly __tag: unique symbol }
|
||||
export type NextTurboTasks = { readonly __tag: unique symbol }
|
||||
export type RefCell = { readonly __tag: unique symbol }
|
||||
export type NapiRouteHas = {
|
||||
type: string
|
||||
key?: string
|
||||
value?: string
|
||||
readonly __tag: unique symbol
|
||||
}
|
||||
|
||||
export function lightningCssTransform(args: object): Promise<unknown>
|
||||
export function lightningCssTransformStyleAttribute(
|
||||
args: object
|
||||
): Promise<unknown>
|
||||
|
||||
// GENERATED-TYPES-BELOW
|
||||
// DO NOT MANUALLY EDIT THESE TYPES
|
||||
// You can regenerate this file by running `pnpm swc-build-native` in the root of the repo.
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
/* auto-generated by NAPI-RS */
|
||||
|
||||
export class ExternalObject<T> {
|
||||
readonly '': {
|
||||
readonly '': unique symbol
|
||||
[K: symbol]: T
|
||||
}
|
||||
}
|
||||
export interface TransformOutput {
|
||||
code: string
|
||||
map?: string
|
||||
output?: string
|
||||
diagnostics: Array<string>
|
||||
}
|
||||
export declare function mdxCompile(
|
||||
value: string,
|
||||
option: Buffer,
|
||||
signal?: AbortSignal | undefined | null
|
||||
): Promise<unknown>
|
||||
export declare function mdxCompileSync(value: string, option: Buffer): string
|
||||
export declare function minify(
|
||||
input: Buffer,
|
||||
opts: Buffer,
|
||||
signal?: AbortSignal | undefined | null
|
||||
): Promise<TransformOutput>
|
||||
export declare function minifySync(input: Buffer, opts: Buffer): TransformOutput
|
||||
export interface NapiEndpointConfig {}
|
||||
export interface NapiServerPath {
|
||||
path: string
|
||||
contentHash: string
|
||||
}
|
||||
export interface NapiWrittenEndpoint {
|
||||
type: string
|
||||
entryPath?: string
|
||||
clientPaths: Array<string>
|
||||
serverPaths: Array<NapiServerPath>
|
||||
config: NapiEndpointConfig
|
||||
}
|
||||
export declare function endpointWriteToDisk(endpoint: {
|
||||
__napiType: 'Endpoint'
|
||||
}): Promise<TurbopackResult>
|
||||
export declare function endpointServerChangedSubscribe(
|
||||
endpoint: { __napiType: 'Endpoint' },
|
||||
issues: boolean,
|
||||
func: (...args: any[]) => any
|
||||
): { __napiType: 'RootTask' }
|
||||
export declare function endpointClientChangedSubscribe(
|
||||
endpoint: { __napiType: 'Endpoint' },
|
||||
func: (...args: any[]) => any
|
||||
): { __napiType: 'RootTask' }
|
||||
export interface NapiEnvVar {
|
||||
name: string
|
||||
value: string
|
||||
}
|
||||
export interface NapiDraftModeOptions {
|
||||
previewModeId: string
|
||||
previewModeEncryptionKey: string
|
||||
previewModeSigningKey: string
|
||||
}
|
||||
export interface NapiWatchOptions {
|
||||
/** Whether to watch the filesystem for file changes. */
|
||||
enable: boolean
|
||||
/**
|
||||
* Enable polling at a certain interval if the native file watching doesn't work (e.g.
|
||||
* docker).
|
||||
*/
|
||||
pollIntervalMs?: number
|
||||
}
|
||||
export interface NapiProjectOptions {
|
||||
/**
|
||||
* A root path from which all files must be nested under. Trying to access
|
||||
* a file outside this root will fail. Think of this as a chroot.
|
||||
*/
|
||||
rootPath: string
|
||||
/** A path inside the root_path which contains the app/pages directories. */
|
||||
projectPath: string
|
||||
/**
|
||||
* next.config's distDir. Project initialization occurs eariler than
|
||||
* deserializing next.config, so passing it as separate option.
|
||||
*/
|
||||
distDir: string
|
||||
/** Filesystem watcher options. */
|
||||
watch: NapiWatchOptions
|
||||
/** The contents of next.config.js, serialized to JSON. */
|
||||
nextConfig: string
|
||||
/** The contents of ts/config read by load-jsconfig, serialized to JSON. */
|
||||
jsConfig: string
|
||||
/** A map of environment variables to use when compiling code. */
|
||||
env: Array<NapiEnvVar>
|
||||
/**
|
||||
* A map of environment variables which should get injected at compile
|
||||
* time.
|
||||
*/
|
||||
defineEnv: NapiDefineEnv
|
||||
/** The mode in which Next.js is running. */
|
||||
dev: boolean
|
||||
/** The server actions encryption key. */
|
||||
encryptionKey: string
|
||||
/** The build id. */
|
||||
buildId: string
|
||||
/** Options for draft mode. */
|
||||
previewProps: NapiDraftModeOptions
|
||||
/** The browserslist query to use for targeting browsers. */
|
||||
browserslistQuery: string
|
||||
/**
|
||||
* When the code is minified, this opts out of the default mangling of
|
||||
* local names for variables, functions etc., which can be useful for
|
||||
* debugging/profiling purposes.
|
||||
*/
|
||||
noMangling: boolean
|
||||
}
|
||||
/** [NapiProjectOptions] with all fields optional. */
|
||||
export interface NapiPartialProjectOptions {
|
||||
/**
|
||||
* A root path from which all files must be nested under. Trying to access
|
||||
* a file outside this root will fail. Think of this as a chroot.
|
||||
*/
|
||||
rootPath?: string
|
||||
/** A path inside the root_path which contains the app/pages directories. */
|
||||
projectPath?: string
|
||||
/**
|
||||
* next.config's distDir. Project initialization occurs eariler than
|
||||
* deserializing next.config, so passing it as separate option.
|
||||
*/
|
||||
distDir?: string | undefined | null
|
||||
/** Filesystem watcher options. */
|
||||
watch?: NapiWatchOptions
|
||||
/** The contents of next.config.js, serialized to JSON. */
|
||||
nextConfig?: string
|
||||
/** The contents of ts/config read by load-jsconfig, serialized to JSON. */
|
||||
jsConfig?: string
|
||||
/** A map of environment variables to use when compiling code. */
|
||||
env?: Array<NapiEnvVar>
|
||||
/**
|
||||
* A map of environment variables which should get injected at compile
|
||||
* time.
|
||||
*/
|
||||
defineEnv?: NapiDefineEnv
|
||||
/** The mode in which Next.js is running. */
|
||||
dev?: boolean
|
||||
/** The server actions encryption key. */
|
||||
encryptionKey?: string
|
||||
/** The build id. */
|
||||
buildId?: string
|
||||
/** Options for draft mode. */
|
||||
previewProps?: NapiDraftModeOptions
|
||||
/** The browserslist query to use for targeting browsers. */
|
||||
browserslistQuery?: string
|
||||
/**
|
||||
* When the code is minified, this opts out of the default mangling of
|
||||
* local names for variables, functions etc., which can be useful for
|
||||
* debugging/profiling purposes.
|
||||
*/
|
||||
noMangling?: boolean
|
||||
}
|
||||
export interface NapiDefineEnv {
|
||||
client: Array<NapiEnvVar>
|
||||
edge: Array<NapiEnvVar>
|
||||
nodejs: Array<NapiEnvVar>
|
||||
}
|
||||
export interface NapiTurboEngineOptions {
|
||||
/** Use the new backend with persistent caching enabled. */
|
||||
persistentCaching?: boolean
|
||||
/** An upper bound of memory that turbopack will attempt to stay under. */
|
||||
memoryLimit?: number
|
||||
/** Track dependencies between tasks. If false, any change during build will error. */
|
||||
dependencyTracking?: boolean
|
||||
}
|
||||
export declare function projectNew(
|
||||
options: NapiProjectOptions,
|
||||
turboEngineOptions: NapiTurboEngineOptions
|
||||
): Promise<{ __napiType: 'Project' }>
|
||||
export declare function projectUpdate(
|
||||
project: { __napiType: 'Project' },
|
||||
options: NapiPartialProjectOptions
|
||||
): Promise<void>
|
||||
/**
|
||||
* Runs exit handlers for the project registered using the [`ExitHandler`] API.
|
||||
*
|
||||
* This is called by `project_shutdown`, so if you're calling that API, you shouldn't call this
|
||||
* one.
|
||||
*/
|
||||
export declare function projectOnExit(project: {
|
||||
__napiType: 'Project'
|
||||
}): Promise<void>
|
||||
/**
|
||||
* Runs `project_on_exit`, and then waits for turbo_tasks to gracefully shut down.
|
||||
*
|
||||
* This is used in builds where it's important that we completely persist turbo-tasks to disk, but
|
||||
* it's skipped in the development server (`project_on_exit` is used instead with a short timeout),
|
||||
* where we prioritize fast exit and user responsiveness over all else.
|
||||
*/
|
||||
export declare function projectShutdown(project: {
|
||||
__napiType: 'Project'
|
||||
}): Promise<void>
|
||||
export interface AppPageNapiRoute {
|
||||
/** The relative path from project_path to the route file */
|
||||
originalName?: string
|
||||
htmlEndpoint?: ExternalObject<ExternalEndpoint>
|
||||
rscEndpoint?: ExternalObject<ExternalEndpoint>
|
||||
}
|
||||
export interface NapiRoute {
|
||||
/** The router path */
|
||||
pathname: string
|
||||
/** The relative path from project_path to the route file */
|
||||
originalName?: string
|
||||
/** The type of route, eg a Page or App */
|
||||
type: string
|
||||
pages?: Array<AppPageNapiRoute>
|
||||
endpoint?: ExternalObject<ExternalEndpoint>
|
||||
htmlEndpoint?: ExternalObject<ExternalEndpoint>
|
||||
rscEndpoint?: ExternalObject<ExternalEndpoint>
|
||||
dataEndpoint?: ExternalObject<ExternalEndpoint>
|
||||
}
|
||||
export interface NapiMiddleware {
|
||||
endpoint: ExternalObject<ExternalEndpoint>
|
||||
}
|
||||
export interface NapiInstrumentation {
|
||||
nodeJs: ExternalObject<ExternalEndpoint>
|
||||
edge: ExternalObject<ExternalEndpoint>
|
||||
}
|
||||
export interface NapiEntrypoints {
|
||||
routes: Array<NapiRoute>
|
||||
middleware?: NapiMiddleware
|
||||
instrumentation?: NapiInstrumentation
|
||||
pagesDocumentEndpoint: ExternalObject<ExternalEndpoint>
|
||||
pagesAppEndpoint: ExternalObject<ExternalEndpoint>
|
||||
pagesErrorEndpoint: ExternalObject<ExternalEndpoint>
|
||||
}
|
||||
export declare function projectWriteAllEntrypointsToDisk(
|
||||
project: { __napiType: 'Project' },
|
||||
appDirOnly: boolean
|
||||
): Promise<TurbopackResult>
|
||||
export declare function projectEntrypointsSubscribe(
|
||||
project: { __napiType: 'Project' },
|
||||
func: (...args: any[]) => any
|
||||
): { __napiType: 'RootTask' }
|
||||
export declare function projectHmrEvents(
|
||||
project: { __napiType: 'Project' },
|
||||
identifier: string,
|
||||
func: (...args: any[]) => any
|
||||
): { __napiType: 'RootTask' }
|
||||
export interface HmrIdentifiers {
|
||||
identifiers: Array<string>
|
||||
}
|
||||
export declare function projectHmrIdentifiersSubscribe(
|
||||
project: { __napiType: 'Project' },
|
||||
func: (...args: any[]) => any
|
||||
): { __napiType: 'RootTask' }
|
||||
export interface NapiUpdateMessage {
|
||||
updateType: string
|
||||
value?: NapiUpdateInfo
|
||||
}
|
||||
export interface NapiUpdateInfo {
|
||||
duration: number
|
||||
tasks: number
|
||||
}
|
||||
/**
|
||||
* Subscribes to lifecycle events of the compilation.
|
||||
*
|
||||
* Emits an [UpdateMessage::Start] event when any computation starts.
|
||||
* Emits an [UpdateMessage::End] event when there was no computation for the
|
||||
* specified time (`aggregation_ms`). The [UpdateMessage::End] event contains
|
||||
* information about the computations that happened since the
|
||||
* [UpdateMessage::Start] event. It contains the duration of the computation
|
||||
* (excluding the idle time that was spend waiting for `aggregation_ms`), and
|
||||
* the number of tasks that were executed.
|
||||
*
|
||||
* The signature of the `func` is `(update_message: UpdateMessage) => void`.
|
||||
*/
|
||||
export declare function projectUpdateInfoSubscribe(
|
||||
project: { __napiType: 'Project' },
|
||||
aggregationMs: number,
|
||||
func: (...args: any[]) => any
|
||||
): void
|
||||
export interface StackFrame {
|
||||
isServer: boolean
|
||||
isInternal?: boolean
|
||||
originalFile?: string
|
||||
file: string
|
||||
line?: number
|
||||
column?: number
|
||||
methodName?: string
|
||||
}
|
||||
export declare function projectTraceSource(
|
||||
project: { __napiType: 'Project' },
|
||||
frame: StackFrame,
|
||||
currentDirectoryFileUrl: string
|
||||
): Promise<StackFrame | null>
|
||||
export declare function projectGetSourceForAsset(
|
||||
project: { __napiType: 'Project' },
|
||||
filePath: string
|
||||
): Promise<string | null>
|
||||
export declare function projectGetSourceMap(
|
||||
project: { __napiType: 'Project' },
|
||||
filePath: string
|
||||
): Promise<string | null>
|
||||
export declare function projectGetSourceMapSync(
|
||||
project: { __napiType: 'Project' },
|
||||
filePath: string
|
||||
): string | null
|
||||
export declare function rootTaskDispose(rootTask: {
|
||||
__napiType: 'RootTask'
|
||||
}): void
|
||||
export interface NapiIssue {
|
||||
severity: string
|
||||
stage: string
|
||||
filePath: string
|
||||
title: any
|
||||
description?: any
|
||||
detail?: any
|
||||
source?: NapiIssueSource
|
||||
documentationLink: string
|
||||
subIssues: Array<NapiIssue>
|
||||
}
|
||||
export interface NapiIssueSource {
|
||||
source: NapiSource
|
||||
range?: NapiIssueSourceRange
|
||||
}
|
||||
export interface NapiIssueSourceRange {
|
||||
start: NapiSourcePos
|
||||
end: NapiSourcePos
|
||||
}
|
||||
export interface NapiSource {
|
||||
ident: string
|
||||
content?: string
|
||||
}
|
||||
export interface NapiSourcePos {
|
||||
line: number
|
||||
column: number
|
||||
}
|
||||
export interface NapiDiagnostic {
|
||||
category: string
|
||||
name: string
|
||||
payload: Record<string, string>
|
||||
}
|
||||
export declare function parse(
|
||||
src: string,
|
||||
options: Buffer,
|
||||
filename?: string | undefined | null,
|
||||
signal?: AbortSignal | undefined | null
|
||||
): Promise<string>
|
||||
export declare function isReactCompilerRequired(
|
||||
filename: string,
|
||||
signal?: AbortSignal | undefined | null
|
||||
): Promise<boolean>
|
||||
export declare function transform(
|
||||
src: string | Buffer | undefined,
|
||||
isModule: boolean,
|
||||
options: Buffer,
|
||||
signal?: AbortSignal | undefined | null
|
||||
): Promise<unknown>
|
||||
export declare function transformSync(
|
||||
src: string | Buffer | undefined,
|
||||
isModule: boolean,
|
||||
options: Buffer
|
||||
): object
|
||||
export declare function startTurbopackTraceServer(path: string): void
|
||||
export interface NextBuildContext {
|
||||
/** The root directory of the workspace. */
|
||||
root?: string
|
||||
/** The project's directory. */
|
||||
dir?: string
|
||||
/**
|
||||
* next.config.js's distDir. Current there's some early stage setup
|
||||
* requires this Before construct a context to read next.config.js,
|
||||
* which we passes separately here.
|
||||
*/
|
||||
distDir?: string
|
||||
/** The build ID. */
|
||||
buildId?: string
|
||||
/** The rewrites, as computed by Next.js. */
|
||||
rewrites?: NapiRewrites
|
||||
defineEnv: NapiDefineEnv
|
||||
}
|
||||
/** Keep in sync with [`next_core::next_config::Rewrites`] */
|
||||
export interface NapiRewrites {
|
||||
fallback: Array<NapiRewrite>
|
||||
afterFiles: Array<NapiRewrite>
|
||||
beforeFiles: Array<NapiRewrite>
|
||||
}
|
||||
/** Keep in sync with [`next_core::next_config::Rewrite`] */
|
||||
export interface NapiRewrite {
|
||||
source: string
|
||||
destination: string
|
||||
basePath?: boolean
|
||||
locale?: boolean
|
||||
has?: Array<NapiRouteHas>
|
||||
missing?: Array<NapiRouteHas>
|
||||
}
|
||||
export declare function getTargetTriple(): string
|
||||
/**
|
||||
* Initialize tracing subscriber to emit traces. This configures subscribers
|
||||
* for Trace Event Format <https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview>.
|
||||
*/
|
||||
export declare function initCustomTraceSubscriber(
|
||||
traceOutFilePath?: string | undefined | null
|
||||
): ExternalObject<RefCell>
|
||||
/**
|
||||
* Teardown currently running tracing subscriber to flush out remaining traces.
|
||||
* This should be called when parent node.js process exits, otherwise generated
|
||||
* trace may drop traces in the buffer.
|
||||
*/
|
||||
export declare function teardownTraceSubscriber(
|
||||
guardExternal: ExternalObject<RefCell>
|
||||
): void
|
||||
53
node_modules/next/dist/build/swc/generated-wasm.d.ts
generated
vendored
Normal file
53
node_modules/next/dist/build/swc/generated-wasm.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
// DO NOT MANUALLY EDIT THESE TYPES
|
||||
// You can regenerate this file by running `pnpm swc-build-wasm` in the root of the repo.
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* @param {string} s
|
||||
* @param {any} opts
|
||||
* @returns {any}
|
||||
*/
|
||||
export function minifySync(s: string, opts: any): any
|
||||
/**
|
||||
* @param {string} s
|
||||
* @param {any} opts
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export function minify(s: string, opts: any): Promise<any>
|
||||
/**
|
||||
* @param {any} s
|
||||
* @param {any} opts
|
||||
* @returns {any}
|
||||
*/
|
||||
export function transformSync(s: any, opts: any): any
|
||||
/**
|
||||
* @param {any} s
|
||||
* @param {any} opts
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export function transform(s: any, opts: any): Promise<any>
|
||||
/**
|
||||
* @param {string} s
|
||||
* @param {any} opts
|
||||
* @returns {any}
|
||||
*/
|
||||
export function parseSync(s: string, opts: any): any
|
||||
/**
|
||||
* @param {string} s
|
||||
* @param {any} opts
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export function parse(s: string, opts: any): Promise<any>
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {any} opts
|
||||
* @returns {any}
|
||||
*/
|
||||
export function mdxCompileSync(value: string, opts: any): any
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {any} opts
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export function mdxCompile(value: string, opts: any): Promise<any>
|
||||
1
node_modules/next/dist/build/swc/helpers.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/build/swc/helpers.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare function __nextjs_pure<T>(expr: T): T;
|
||||
15
node_modules/next/dist/build/swc/helpers.js
generated
vendored
Normal file
15
node_modules/next/dist/build/swc/helpers.js
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "__nextjs_pure", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return __nextjs_pure;
|
||||
}
|
||||
});
|
||||
function __nextjs_pure(expr) {
|
||||
return expr;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=helpers.js.map
|
||||
1
node_modules/next/dist/build/swc/helpers.js.map
generated
vendored
Normal file
1
node_modules/next/dist/build/swc/helpers.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../src/build/swc/helpers.ts"],"sourcesContent":["export function __nextjs_pure<T>(expr: T): T {\n return expr\n}\n"],"names":["__nextjs_pure","expr"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,cAAiBC,IAAO;IACtC,OAAOA;AACT"}
|
||||
38
node_modules/next/dist/build/swc/index.d.ts
generated
vendored
Normal file
38
node_modules/next/dist/build/swc/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import { type DefineEnvPluginOptions } from '../webpack/plugins/define-env-plugin';
|
||||
import type { Binding, DefineEnv } from './types';
|
||||
/**
|
||||
* Based on napi-rs's target triples, returns triples that have corresponding next-swc binaries.
|
||||
*/
|
||||
export declare function getSupportedArchTriples(): Record<string, any>;
|
||||
export declare const lockfilePatchPromise: {
|
||||
cur?: Promise<void>;
|
||||
};
|
||||
export declare function loadBindings(useWasmBinary?: boolean): Promise<Binding>;
|
||||
export declare function createDefineEnv({ isTurbopack, clientRouterFilters, config, dev, distDir, fetchCacheKeyPrefix, hasRewrites, middlewareMatchers, }: Omit<DefineEnvPluginOptions, 'isClient' | 'isNodeOrEdgeCompilation' | 'isEdgeServer' | 'isNodeServer'>): DefineEnv;
|
||||
export declare function isWasm(): Promise<boolean>;
|
||||
export declare function transform(src: string, options?: any): Promise<any>;
|
||||
export declare function transformSync(src: string, options?: any): any;
|
||||
export declare function minify(src: string, options: any): Promise<{
|
||||
code: string;
|
||||
map: any;
|
||||
}>;
|
||||
export declare function isReactCompilerRequired(filename: string): Promise<boolean>;
|
||||
export declare function parse(src: string, options: any): Promise<any>;
|
||||
export declare function getBinaryMetadata(): {
|
||||
target: string | undefined;
|
||||
};
|
||||
/**
|
||||
* Initialize trace subscriber to emit traces.
|
||||
*
|
||||
*/
|
||||
export declare function initCustomTraceSubscriber(traceFileName?: string): void;
|
||||
/**
|
||||
* Teardown swc's trace subscriber if there's an initialized flush guard exists.
|
||||
*
|
||||
* This is workaround to amend behavior with process.exit
|
||||
* (https://github.com/vercel/next.js/blob/4db8c49cc31e4fc182391fae6903fb5ef4e8c66e/packages/next/bin/next.ts#L134=)
|
||||
* seems preventing napi's cleanup hook execution (https://github.com/swc-project/swc/blob/main/crates/node/src/util.rs#L48-L51=),
|
||||
*
|
||||
* instead parent process manually drops guard when process gets signal to exit.
|
||||
*/
|
||||
export declare const teardownTraceSubscriber: () => void;
|
||||
1075
node_modules/next/dist/build/swc/index.js
generated
vendored
Normal file
1075
node_modules/next/dist/build/swc/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
node_modules/next/dist/build/swc/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/build/swc/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
15
node_modules/next/dist/build/swc/jest-transformer.d.ts
generated
vendored
Normal file
15
node_modules/next/dist/build/swc/jest-transformer.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import type { Config } from '@jest/types';
|
||||
import type { NextConfig, ExperimentalConfig } from '../../server/config-shared';
|
||||
import type { ResolvedBaseUrl } from '../load-jsconfig';
|
||||
type TransformerConfig = Config.TransformerConfig[1];
|
||||
export interface JestTransformerConfig extends TransformerConfig {
|
||||
jsConfig: any;
|
||||
resolvedBaseUrl?: ResolvedBaseUrl;
|
||||
pagesDir?: string;
|
||||
serverComponents?: boolean;
|
||||
isEsmProject: boolean;
|
||||
modularizeImports?: NextConfig['modularizeImports'];
|
||||
swcPlugins: ExperimentalConfig['swcPlugins'];
|
||||
compilerOptions: NextConfig['compiler'];
|
||||
}
|
||||
export {};
|
||||
75
node_modules/next/dist/build/swc/jest-transformer.js
generated
vendored
Normal file
75
node_modules/next/dist/build/swc/jest-transformer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
Copyright (c) 2021 The swc Project Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
const _vm = /*#__PURE__*/ _interop_require_default(require("vm"));
|
||||
const _index = require("./index");
|
||||
const _options = require("./options");
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
// Jest use the `vm` [Module API](https://nodejs.org/api/vm.html#vm_class_vm_module) for ESM.
|
||||
// see https://github.com/facebook/jest/issues/9430
|
||||
const isSupportEsm = 'Module' in _vm.default;
|
||||
function getJestConfig(jestConfig) {
|
||||
return 'config' in jestConfig ? jestConfig.config : jestConfig;
|
||||
}
|
||||
function isEsm(isEsmProject, filename, jestConfig) {
|
||||
var _jestConfig_extensionsToTreatAsEsm;
|
||||
return /\.jsx?$/.test(filename) && isEsmProject || ((_jestConfig_extensionsToTreatAsEsm = jestConfig.extensionsToTreatAsEsm) == null ? void 0 : _jestConfig_extensionsToTreatAsEsm.some((ext)=>filename.endsWith(ext)));
|
||||
}
|
||||
const createTransformer = (inputOptions)=>({
|
||||
process (src, filename, jestOptions) {
|
||||
const jestConfig = getJestConfig(jestOptions);
|
||||
const swcTransformOpts = (0, _options.getJestSWCOptions)({
|
||||
isServer: jestConfig.testEnvironment === 'node' || jestConfig.testEnvironment.includes('jest-environment-node'),
|
||||
filename,
|
||||
jsConfig: inputOptions == null ? void 0 : inputOptions.jsConfig,
|
||||
resolvedBaseUrl: inputOptions == null ? void 0 : inputOptions.resolvedBaseUrl,
|
||||
pagesDir: inputOptions == null ? void 0 : inputOptions.pagesDir,
|
||||
serverComponents: inputOptions == null ? void 0 : inputOptions.serverComponents,
|
||||
modularizeImports: inputOptions == null ? void 0 : inputOptions.modularizeImports,
|
||||
swcPlugins: inputOptions == null ? void 0 : inputOptions.swcPlugins,
|
||||
compilerOptions: inputOptions == null ? void 0 : inputOptions.compilerOptions,
|
||||
serverReferenceHashSalt: '',
|
||||
esm: isSupportEsm && isEsm(Boolean(inputOptions == null ? void 0 : inputOptions.isEsmProject), filename, jestConfig)
|
||||
});
|
||||
return (0, _index.transformSync)(src, {
|
||||
...swcTransformOpts,
|
||||
filename
|
||||
});
|
||||
}
|
||||
});
|
||||
module.exports = {
|
||||
createTransformer
|
||||
};
|
||||
|
||||
//# sourceMappingURL=jest-transformer.js.map
|
||||
1
node_modules/next/dist/build/swc/jest-transformer.js.map
generated
vendored
Normal file
1
node_modules/next/dist/build/swc/jest-transformer.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
166
node_modules/next/dist/build/swc/options.d.ts
generated
vendored
Normal file
166
node_modules/next/dist/build/swc/options.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
import { type WebpackLayerName } from '../../lib/constants';
|
||||
import type { NextConfig, ExperimentalConfig } from '../../server/config-shared';
|
||||
import type { ResolvedBaseUrl } from '../load-jsconfig';
|
||||
export declare function getParserOptions({ filename, jsConfig, ...rest }: any): any;
|
||||
export declare function getJestSWCOptions({ isServer, filename, esm, modularizeImports, swcPlugins, compilerOptions, jsConfig, resolvedBaseUrl, pagesDir, serverReferenceHashSalt, }: {
|
||||
isServer: boolean;
|
||||
filename: string;
|
||||
esm: boolean;
|
||||
modularizeImports?: NextConfig['modularizeImports'];
|
||||
swcPlugins: ExperimentalConfig['swcPlugins'];
|
||||
compilerOptions: NextConfig['compiler'];
|
||||
jsConfig: any;
|
||||
resolvedBaseUrl?: ResolvedBaseUrl;
|
||||
pagesDir?: string;
|
||||
serverComponents?: boolean;
|
||||
serverReferenceHashSalt: string;
|
||||
}): {
|
||||
env: {
|
||||
targets: {
|
||||
node: string;
|
||||
};
|
||||
};
|
||||
module: {
|
||||
type: string;
|
||||
};
|
||||
disableNextSsg: boolean;
|
||||
disablePageConfig: boolean;
|
||||
pagesDir: string | undefined;
|
||||
cssEnv?: {
|
||||
targets: string[];
|
||||
} | undefined;
|
||||
serverComponents: {
|
||||
isReactServerLayer: boolean;
|
||||
dynamicIoEnabled: boolean | undefined;
|
||||
useCacheEnabled: boolean | undefined;
|
||||
} | undefined;
|
||||
serverActions: {
|
||||
isReactServerLayer: boolean;
|
||||
isDevelopment: boolean;
|
||||
useCacheEnabled: boolean | undefined;
|
||||
hashSalt: string;
|
||||
cacheKinds: string[];
|
||||
} | undefined;
|
||||
preferEsm: boolean;
|
||||
lintCodemodComments: boolean;
|
||||
debugFunctionName: boolean;
|
||||
emotion?: {
|
||||
importMap?: {
|
||||
[importName: string]: {
|
||||
[exportName: string]: {
|
||||
canonicalImport?: [string, string];
|
||||
styledBaseImport?: [string, string];
|
||||
};
|
||||
};
|
||||
} | undefined;
|
||||
labelFormat?: string | undefined;
|
||||
sourcemap: boolean;
|
||||
enabled: boolean;
|
||||
autoLabel: boolean;
|
||||
} | null | undefined;
|
||||
styledComponents?: {
|
||||
displayName: boolean;
|
||||
topLevelImportPaths?: string[];
|
||||
ssr?: boolean;
|
||||
fileName?: boolean;
|
||||
meaninglessFileNames?: string[];
|
||||
minify?: boolean;
|
||||
transpileTemplateLiterals?: boolean;
|
||||
namespace?: string;
|
||||
pure?: boolean;
|
||||
cssProp?: boolean;
|
||||
} | null | undefined;
|
||||
jsc: {
|
||||
externalHelpers: boolean;
|
||||
parser: any;
|
||||
experimental: {
|
||||
keepImportAttributes: boolean;
|
||||
emitAssertForImportAttributes: boolean;
|
||||
plugins: any[][];
|
||||
cacheRoot: string | undefined;
|
||||
};
|
||||
transform: {
|
||||
legacyDecorator: boolean;
|
||||
decoratorMetadata: boolean;
|
||||
useDefineForClassFields: boolean;
|
||||
react: {
|
||||
importSource: any;
|
||||
runtime: string;
|
||||
pragmaFrag: string;
|
||||
throwIfNamespace: boolean;
|
||||
development: boolean;
|
||||
useBuiltins: boolean;
|
||||
refresh: boolean;
|
||||
};
|
||||
optimizer: {
|
||||
simplify: boolean;
|
||||
globals: {
|
||||
typeofs: {
|
||||
window: string;
|
||||
};
|
||||
envs: {
|
||||
NODE_ENV: string;
|
||||
};
|
||||
} | null;
|
||||
};
|
||||
regenerator: {
|
||||
importPath: string;
|
||||
};
|
||||
hidden?: {
|
||||
jest: boolean;
|
||||
} | undefined;
|
||||
};
|
||||
baseUrl?: string | undefined;
|
||||
paths?: any;
|
||||
};
|
||||
sourceMaps: string | undefined;
|
||||
removeConsole: boolean | {
|
||||
exclude?: string[];
|
||||
} | undefined;
|
||||
reactRemoveProperties: boolean | {
|
||||
properties?: string[];
|
||||
} | undefined;
|
||||
modularizeImports: {
|
||||
[k: string]: {
|
||||
transform: string | string[][];
|
||||
preventFullImport?: boolean;
|
||||
skipDefaultConversion?: boolean;
|
||||
};
|
||||
} | undefined;
|
||||
relay: {
|
||||
src: string;
|
||||
artifactDirectory?: string;
|
||||
language?: "typescript" | "javascript" | "flow";
|
||||
eagerEsModules?: boolean;
|
||||
} | undefined;
|
||||
styledJsx: boolean | {
|
||||
useLightningcss?: boolean;
|
||||
} | {
|
||||
useLightningcss: any;
|
||||
};
|
||||
};
|
||||
export declare function getLoaderSWCOptions({ filename, development, isServer, pagesDir, appDir, isPageFile, isDynamicIo, hasReactRefresh, modularizeImports, optimizeServerReact, optimizePackageImports, swcPlugins, compilerOptions, jsConfig, supportedBrowsers, swcCacheDir, relativeFilePathFromRoot, serverComponents, serverReferenceHashSalt, bundleLayer, esm, cacheHandlers, useCacheEnabled, }: {
|
||||
filename: string;
|
||||
development: boolean;
|
||||
isServer: boolean;
|
||||
pagesDir?: string;
|
||||
appDir?: string;
|
||||
isPageFile: boolean;
|
||||
hasReactRefresh: boolean;
|
||||
optimizeServerReact?: boolean;
|
||||
modularizeImports: NextConfig['modularizeImports'];
|
||||
isDynamicIo?: boolean;
|
||||
optimizePackageImports?: NonNullable<NextConfig['experimental']>['optimizePackageImports'];
|
||||
swcPlugins: ExperimentalConfig['swcPlugins'];
|
||||
compilerOptions: NextConfig['compiler'];
|
||||
jsConfig: any;
|
||||
supportedBrowsers: string[] | undefined;
|
||||
swcCacheDir: string;
|
||||
relativeFilePathFromRoot: string;
|
||||
esm?: boolean;
|
||||
serverComponents?: boolean;
|
||||
serverReferenceHashSalt: string;
|
||||
bundleLayer?: WebpackLayerName;
|
||||
cacheHandlers: ExperimentalConfig['cacheHandlers'];
|
||||
useCacheEnabled?: boolean;
|
||||
}): any;
|
||||
385
node_modules/next/dist/build/swc/options.js
generated
vendored
Normal file
385
node_modules/next/dist/build/swc/options.js
generated
vendored
Normal file
|
|
@ -0,0 +1,385 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
getJestSWCOptions: null,
|
||||
getLoaderSWCOptions: null,
|
||||
getParserOptions: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
getJestSWCOptions: function() {
|
||||
return getJestSWCOptions;
|
||||
},
|
||||
getLoaderSWCOptions: function() {
|
||||
return getLoaderSWCOptions;
|
||||
},
|
||||
getParserOptions: function() {
|
||||
return getParserOptions;
|
||||
}
|
||||
});
|
||||
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
||||
const _constants = require("../../lib/constants");
|
||||
const _utils = require("../utils");
|
||||
const _escaperegexp = require("../../shared/lib/escape-regexp");
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
const nextDirname = _path.default.dirname(require.resolve('next/package.json'));
|
||||
const nextDistPath = new RegExp(`${(0, _escaperegexp.escapeStringRegexp)(nextDirname)}[\\/]dist[\\/](shared[\\/]lib|client|pages)`);
|
||||
const nodeModulesPath = /[\\/]node_modules[\\/]/;
|
||||
const regeneratorRuntimePath = require.resolve('next/dist/compiled/regenerator-runtime');
|
||||
function isTypeScriptFile(filename) {
|
||||
return filename.endsWith('.ts') || filename.endsWith('.tsx');
|
||||
}
|
||||
function isCommonJSFile(filename) {
|
||||
return filename.endsWith('.cjs');
|
||||
}
|
||||
// Ensure Next.js internals and .cjs files are output as CJS modules,
|
||||
// By default all modules are output as ESM or will treated as CJS if next-swc/auto-cjs plugin detects file is CJS.
|
||||
function shouldOutputCommonJs(filename) {
|
||||
return isCommonJSFile(filename) || nextDistPath.test(filename);
|
||||
}
|
||||
function getParserOptions({ filename, jsConfig, ...rest }) {
|
||||
var _jsConfig_compilerOptions;
|
||||
const isTSFile = filename.endsWith('.ts');
|
||||
const hasTsSyntax = isTypeScriptFile(filename);
|
||||
const enableDecorators = Boolean(jsConfig == null ? void 0 : (_jsConfig_compilerOptions = jsConfig.compilerOptions) == null ? void 0 : _jsConfig_compilerOptions.experimentalDecorators);
|
||||
return {
|
||||
...rest,
|
||||
syntax: hasTsSyntax ? 'typescript' : 'ecmascript',
|
||||
dynamicImport: true,
|
||||
decorators: enableDecorators,
|
||||
// Exclude regular TypeScript files from React transformation to prevent e.g. generic parameters and angle-bracket type assertion from being interpreted as JSX tags.
|
||||
[hasTsSyntax ? 'tsx' : 'jsx']: !isTSFile,
|
||||
importAssertions: true
|
||||
};
|
||||
}
|
||||
function getBaseSWCOptions({ filename, jest, development, hasReactRefresh, globalWindow, esm, modularizeImports, swcPlugins, compilerOptions, resolvedBaseUrl, jsConfig, supportedBrowsers, swcCacheDir, serverComponents, serverReferenceHashSalt, bundleLayer, isDynamicIo, cacheHandlers, useCacheEnabled }) {
|
||||
var _jsConfig_compilerOptions, _jsConfig_compilerOptions1, _jsConfig_compilerOptions2, _jsConfig_compilerOptions3, _jsConfig_compilerOptions4, _jsConfig_experimental;
|
||||
const isReactServerLayer = (0, _utils.isWebpackServerOnlyLayer)(bundleLayer);
|
||||
const isAppRouterPagesLayer = (0, _utils.isWebpackAppPagesLayer)(bundleLayer);
|
||||
const parserConfig = getParserOptions({
|
||||
filename,
|
||||
jsConfig
|
||||
});
|
||||
const paths = jsConfig == null ? void 0 : (_jsConfig_compilerOptions = jsConfig.compilerOptions) == null ? void 0 : _jsConfig_compilerOptions.paths;
|
||||
const enableDecorators = Boolean(jsConfig == null ? void 0 : (_jsConfig_compilerOptions1 = jsConfig.compilerOptions) == null ? void 0 : _jsConfig_compilerOptions1.experimentalDecorators);
|
||||
const emitDecoratorMetadata = Boolean(jsConfig == null ? void 0 : (_jsConfig_compilerOptions2 = jsConfig.compilerOptions) == null ? void 0 : _jsConfig_compilerOptions2.emitDecoratorMetadata);
|
||||
const useDefineForClassFields = Boolean(jsConfig == null ? void 0 : (_jsConfig_compilerOptions3 = jsConfig.compilerOptions) == null ? void 0 : _jsConfig_compilerOptions3.useDefineForClassFields);
|
||||
const plugins = (swcPlugins ?? []).filter(Array.isArray).map(([name, options])=>[
|
||||
require.resolve(name),
|
||||
options
|
||||
]);
|
||||
return {
|
||||
jsc: {
|
||||
...resolvedBaseUrl && paths ? {
|
||||
baseUrl: resolvedBaseUrl.baseUrl,
|
||||
paths
|
||||
} : {},
|
||||
externalHelpers: !process.versions.pnp && !jest,
|
||||
parser: parserConfig,
|
||||
experimental: {
|
||||
keepImportAttributes: true,
|
||||
emitAssertForImportAttributes: true,
|
||||
plugins,
|
||||
cacheRoot: swcCacheDir
|
||||
},
|
||||
transform: {
|
||||
// Enables https://github.com/swc-project/swc/blob/0359deb4841be743d73db4536d4a22ac797d7f65/crates/swc_ecma_ext_transforms/src/jest.rs
|
||||
...jest ? {
|
||||
hidden: {
|
||||
jest: true
|
||||
}
|
||||
} : {},
|
||||
legacyDecorator: enableDecorators,
|
||||
decoratorMetadata: emitDecoratorMetadata,
|
||||
useDefineForClassFields: useDefineForClassFields,
|
||||
react: {
|
||||
importSource: (jsConfig == null ? void 0 : (_jsConfig_compilerOptions4 = jsConfig.compilerOptions) == null ? void 0 : _jsConfig_compilerOptions4.jsxImportSource) ?? ((compilerOptions == null ? void 0 : compilerOptions.emotion) && !isReactServerLayer ? '@emotion/react' : 'react'),
|
||||
runtime: 'automatic',
|
||||
pragmaFrag: 'React.Fragment',
|
||||
throwIfNamespace: true,
|
||||
development: !!development,
|
||||
useBuiltins: true,
|
||||
refresh: !!hasReactRefresh
|
||||
},
|
||||
optimizer: {
|
||||
simplify: false,
|
||||
globals: jest ? null : {
|
||||
typeofs: {
|
||||
window: globalWindow ? 'object' : 'undefined'
|
||||
},
|
||||
envs: {
|
||||
NODE_ENV: development ? '"development"' : '"production"'
|
||||
}
|
||||
}
|
||||
},
|
||||
regenerator: {
|
||||
importPath: regeneratorRuntimePath
|
||||
}
|
||||
}
|
||||
},
|
||||
sourceMaps: jest ? 'inline' : undefined,
|
||||
removeConsole: compilerOptions == null ? void 0 : compilerOptions.removeConsole,
|
||||
// disable "reactRemoveProperties" when "jest" is true
|
||||
// otherwise the setting from next.config.js will be used
|
||||
reactRemoveProperties: jest ? false : compilerOptions == null ? void 0 : compilerOptions.reactRemoveProperties,
|
||||
// Map the k-v map to an array of pairs.
|
||||
modularizeImports: modularizeImports ? Object.fromEntries(Object.entries(modularizeImports).map(([mod, config])=>[
|
||||
mod,
|
||||
{
|
||||
...config,
|
||||
transform: typeof config.transform === 'string' ? config.transform : Object.entries(config.transform).map(([key, value])=>[
|
||||
key,
|
||||
value
|
||||
])
|
||||
}
|
||||
])) : undefined,
|
||||
relay: compilerOptions == null ? void 0 : compilerOptions.relay,
|
||||
// Always transform styled-jsx and error when `client-only` condition is triggered
|
||||
styledJsx: (compilerOptions == null ? void 0 : compilerOptions.styledJsx) ?? {
|
||||
useLightningcss: (jsConfig == null ? void 0 : (_jsConfig_experimental = jsConfig.experimental) == null ? void 0 : _jsConfig_experimental.useLightningcss) ?? false
|
||||
},
|
||||
// Disable css-in-js libs (without client-only integration) transform on server layer for server components
|
||||
...!isReactServerLayer && {
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
emotion: getEmotionOptions(compilerOptions == null ? void 0 : compilerOptions.emotion, development),
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
styledComponents: getStyledComponentsOptions(compilerOptions == null ? void 0 : compilerOptions.styledComponents, development)
|
||||
},
|
||||
serverComponents: serverComponents && !jest ? {
|
||||
isReactServerLayer,
|
||||
dynamicIoEnabled: isDynamicIo,
|
||||
useCacheEnabled
|
||||
} : undefined,
|
||||
serverActions: isAppRouterPagesLayer && !jest ? {
|
||||
isReactServerLayer,
|
||||
isDevelopment: development,
|
||||
useCacheEnabled,
|
||||
hashSalt: serverReferenceHashSalt,
|
||||
cacheKinds: [
|
||||
'default',
|
||||
'remote'
|
||||
].concat(cacheHandlers ? Object.keys(cacheHandlers) : [])
|
||||
} : undefined,
|
||||
// For app router we prefer to bundle ESM,
|
||||
// On server side of pages router we prefer CJS.
|
||||
preferEsm: esm,
|
||||
lintCodemodComments: true,
|
||||
debugFunctionName: development,
|
||||
...supportedBrowsers && supportedBrowsers.length > 0 ? {
|
||||
cssEnv: {
|
||||
targets: supportedBrowsers
|
||||
}
|
||||
} : {}
|
||||
};
|
||||
}
|
||||
function getStyledComponentsOptions(styledComponentsConfig, development) {
|
||||
if (!styledComponentsConfig) {
|
||||
return null;
|
||||
} else if (typeof styledComponentsConfig === 'object') {
|
||||
return {
|
||||
...styledComponentsConfig,
|
||||
displayName: styledComponentsConfig.displayName ?? Boolean(development)
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
displayName: Boolean(development)
|
||||
};
|
||||
}
|
||||
}
|
||||
function getEmotionOptions(emotionConfig, development) {
|
||||
if (!emotionConfig) {
|
||||
return null;
|
||||
}
|
||||
let autoLabel = !!development;
|
||||
switch(typeof emotionConfig === 'object' && emotionConfig.autoLabel){
|
||||
case 'never':
|
||||
autoLabel = false;
|
||||
break;
|
||||
case 'always':
|
||||
autoLabel = true;
|
||||
break;
|
||||
case 'dev-only':
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return {
|
||||
enabled: true,
|
||||
autoLabel,
|
||||
sourcemap: development,
|
||||
...typeof emotionConfig === 'object' && {
|
||||
importMap: emotionConfig.importMap,
|
||||
labelFormat: emotionConfig.labelFormat,
|
||||
sourcemap: development && emotionConfig.sourceMap
|
||||
}
|
||||
};
|
||||
}
|
||||
function getJestSWCOptions({ isServer, filename, esm, modularizeImports, swcPlugins, compilerOptions, jsConfig, resolvedBaseUrl, pagesDir, serverReferenceHashSalt }) {
|
||||
let baseOptions = getBaseSWCOptions({
|
||||
filename,
|
||||
jest: true,
|
||||
development: false,
|
||||
hasReactRefresh: false,
|
||||
globalWindow: !isServer,
|
||||
modularizeImports,
|
||||
swcPlugins,
|
||||
compilerOptions,
|
||||
jsConfig,
|
||||
resolvedBaseUrl,
|
||||
supportedBrowsers: undefined,
|
||||
esm,
|
||||
// Don't apply server layer transformations for Jest
|
||||
// Disable server / client graph assertions for Jest
|
||||
bundleLayer: undefined,
|
||||
serverComponents: false,
|
||||
serverReferenceHashSalt
|
||||
});
|
||||
const useCjsModules = shouldOutputCommonJs(filename);
|
||||
return {
|
||||
...baseOptions,
|
||||
env: {
|
||||
targets: {
|
||||
// Targets the current version of Node.js
|
||||
node: process.versions.node
|
||||
}
|
||||
},
|
||||
module: {
|
||||
type: esm && !useCjsModules ? 'es6' : 'commonjs'
|
||||
},
|
||||
disableNextSsg: true,
|
||||
disablePageConfig: true,
|
||||
pagesDir
|
||||
};
|
||||
}
|
||||
function getLoaderSWCOptions({ // This is not passed yet as "paths" resolving is handled by webpack currently.
|
||||
// resolvedBaseUrl,
|
||||
filename, development, isServer, pagesDir, appDir, isPageFile, isDynamicIo, hasReactRefresh, modularizeImports, optimizeServerReact, optimizePackageImports, swcPlugins, compilerOptions, jsConfig, supportedBrowsers, swcCacheDir, relativeFilePathFromRoot, serverComponents, serverReferenceHashSalt, bundleLayer, esm, cacheHandlers, useCacheEnabled }) {
|
||||
let baseOptions = getBaseSWCOptions({
|
||||
filename,
|
||||
development,
|
||||
globalWindow: !isServer,
|
||||
hasReactRefresh,
|
||||
modularizeImports,
|
||||
swcPlugins,
|
||||
compilerOptions,
|
||||
jsConfig,
|
||||
// resolvedBaseUrl,
|
||||
supportedBrowsers,
|
||||
swcCacheDir,
|
||||
bundleLayer,
|
||||
serverComponents,
|
||||
serverReferenceHashSalt,
|
||||
esm: !!esm,
|
||||
isDynamicIo,
|
||||
cacheHandlers,
|
||||
useCacheEnabled
|
||||
});
|
||||
baseOptions.fontLoaders = {
|
||||
fontLoaders: [
|
||||
'next/font/local',
|
||||
'next/font/google'
|
||||
],
|
||||
relativeFilePathFromRoot
|
||||
};
|
||||
baseOptions.cjsRequireOptimizer = {
|
||||
packages: {
|
||||
'next/server': {
|
||||
transforms: {
|
||||
NextRequest: 'next/dist/server/web/spec-extension/request',
|
||||
NextResponse: 'next/dist/server/web/spec-extension/response',
|
||||
ImageResponse: 'next/dist/server/web/spec-extension/image-response',
|
||||
userAgentFromString: 'next/dist/server/web/spec-extension/user-agent',
|
||||
userAgent: 'next/dist/server/web/spec-extension/user-agent'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (optimizeServerReact && isServer && !development) {
|
||||
baseOptions.optimizeServerReact = {
|
||||
optimize_use_state: false
|
||||
};
|
||||
}
|
||||
// Modularize import optimization for barrel files
|
||||
if (optimizePackageImports) {
|
||||
baseOptions.autoModularizeImports = {
|
||||
packages: optimizePackageImports
|
||||
};
|
||||
}
|
||||
const isNodeModules = nodeModulesPath.test(filename);
|
||||
const isAppBrowserLayer = bundleLayer === _constants.WEBPACK_LAYERS.appPagesBrowser;
|
||||
const moduleResolutionConfig = shouldOutputCommonJs(filename) ? {
|
||||
module: {
|
||||
type: 'commonjs'
|
||||
}
|
||||
} : {};
|
||||
let options;
|
||||
if (isServer) {
|
||||
options = {
|
||||
...baseOptions,
|
||||
...moduleResolutionConfig,
|
||||
// Disables getStaticProps/getServerSideProps tree shaking on the server compilation for pages
|
||||
disableNextSsg: true,
|
||||
disablePageConfig: true,
|
||||
isDevelopment: development,
|
||||
isServerCompiler: isServer,
|
||||
pagesDir,
|
||||
appDir,
|
||||
preferEsm: !!esm,
|
||||
isPageFile,
|
||||
env: {
|
||||
targets: {
|
||||
// Targets the current version of Node.js
|
||||
node: process.versions.node
|
||||
}
|
||||
}
|
||||
};
|
||||
} else {
|
||||
options = {
|
||||
...baseOptions,
|
||||
...moduleResolutionConfig,
|
||||
disableNextSsg: !isPageFile,
|
||||
isDevelopment: development,
|
||||
isServerCompiler: isServer,
|
||||
pagesDir,
|
||||
appDir,
|
||||
isPageFile,
|
||||
...supportedBrowsers && supportedBrowsers.length > 0 ? {
|
||||
env: {
|
||||
targets: supportedBrowsers
|
||||
}
|
||||
} : {}
|
||||
};
|
||||
if (!options.env) {
|
||||
// Matches default @babel/preset-env behavior
|
||||
options.jsc.target = 'es5';
|
||||
}
|
||||
}
|
||||
// For node_modules in app browser layer, we don't need to do any server side transformation.
|
||||
// Only keep server actions transform to discover server actions from client components.
|
||||
if (isAppBrowserLayer && isNodeModules) {
|
||||
var _options_jsc_transform_optimizer_globals;
|
||||
options.disableNextSsg = true;
|
||||
options.disablePageConfig = true;
|
||||
options.isPageFile = false;
|
||||
options.optimizeServerReact = undefined;
|
||||
options.cjsRequireOptimizer = undefined;
|
||||
// Disable optimizer for node_modules in app browser layer, to avoid unnecessary replacement.
|
||||
// e.g. typeof window could result differently in js worker or browser.
|
||||
if (((_options_jsc_transform_optimizer_globals = options.jsc.transform.optimizer.globals) == null ? void 0 : _options_jsc_transform_optimizer_globals.typeofs) && !filename.includes(nextDirname)) {
|
||||
delete options.jsc.transform.optimizer.globals.typeofs.window;
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=options.js.map
|
||||
1
node_modules/next/dist/build/swc/options.js.map
generated
vendored
Normal file
1
node_modules/next/dist/build/swc/options.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
349
node_modules/next/dist/build/swc/types.d.ts
generated
vendored
Normal file
349
node_modules/next/dist/build/swc/types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,349 @@
|
|||
import type { NextConfigComplete } from '../../server/config-shared';
|
||||
import type { __ApiPreviewProps } from '../../server/api-utils';
|
||||
import type { ExternalObject, RefCell, NapiTurboEngineOptions } from './generated-native';
|
||||
export type { NapiTurboEngineOptions as TurboEngineOptions };
|
||||
export interface Binding {
|
||||
isWasm: boolean;
|
||||
turbo: {
|
||||
createProject(options: ProjectOptions, turboEngineOptions?: NapiTurboEngineOptions): Promise<Project>;
|
||||
startTurbopackTraceServer(traceFilePath: string): void;
|
||||
nextBuild?: any;
|
||||
};
|
||||
mdx: {
|
||||
compile(src: string, options: any): any;
|
||||
compileSync(src: string, options: any): any;
|
||||
};
|
||||
minify(src: string, options: any): Promise<any>;
|
||||
minifySync(src: string, options: any): any;
|
||||
transform(src: string, options: any): Promise<any>;
|
||||
transformSync(src: string, options: any): any;
|
||||
parse(src: string, options: any): Promise<string>;
|
||||
getTargetTriple(): string | undefined;
|
||||
initCustomTraceSubscriber?(traceOutFilePath?: string): ExternalObject<RefCell>;
|
||||
teardownTraceSubscriber?(guardExternal: ExternalObject<RefCell>): void;
|
||||
css: {
|
||||
lightning: {
|
||||
transform(transformOptions: any): Promise<any>;
|
||||
transformStyleAttr(transformAttrOptions: any): Promise<any>;
|
||||
};
|
||||
};
|
||||
reactCompiler: {
|
||||
isReactCompilerRequired(filename: string): Promise<boolean>;
|
||||
};
|
||||
}
|
||||
export type StyledString = {
|
||||
type: 'text';
|
||||
value: string;
|
||||
} | {
|
||||
type: 'code';
|
||||
value: string;
|
||||
} | {
|
||||
type: 'strong';
|
||||
value: string;
|
||||
} | {
|
||||
type: 'stack';
|
||||
value: StyledString[];
|
||||
} | {
|
||||
type: 'line';
|
||||
value: StyledString[];
|
||||
};
|
||||
export interface Issue {
|
||||
severity: string;
|
||||
stage: string;
|
||||
filePath: string;
|
||||
title: StyledString;
|
||||
description?: StyledString;
|
||||
detail?: StyledString;
|
||||
source?: {
|
||||
source: {
|
||||
ident: string;
|
||||
content?: string;
|
||||
};
|
||||
range?: {
|
||||
start: {
|
||||
line: number;
|
||||
column: number;
|
||||
};
|
||||
end: {
|
||||
line: number;
|
||||
column: number;
|
||||
};
|
||||
};
|
||||
};
|
||||
documentationLink: string;
|
||||
subIssues: Issue[];
|
||||
}
|
||||
export interface Diagnostics {
|
||||
category: string;
|
||||
name: string;
|
||||
payload: unknown;
|
||||
}
|
||||
export type TurbopackResult<T = {}> = T & {
|
||||
issues: Issue[];
|
||||
diagnostics: Diagnostics[];
|
||||
};
|
||||
export interface Middleware {
|
||||
endpoint: Endpoint;
|
||||
}
|
||||
export interface Instrumentation {
|
||||
nodeJs: Endpoint;
|
||||
edge: Endpoint;
|
||||
}
|
||||
export interface RawEntrypoints {
|
||||
routes: Map<string, Route>;
|
||||
middleware?: Middleware;
|
||||
instrumentation?: Instrumentation;
|
||||
pagesDocumentEndpoint: Endpoint;
|
||||
pagesAppEndpoint: Endpoint;
|
||||
pagesErrorEndpoint: Endpoint;
|
||||
}
|
||||
interface BaseUpdate {
|
||||
resource: {
|
||||
headers: unknown;
|
||||
path: string;
|
||||
};
|
||||
diagnostics: unknown[];
|
||||
issues: Issue[];
|
||||
}
|
||||
interface IssuesUpdate extends BaseUpdate {
|
||||
type: 'issues';
|
||||
}
|
||||
interface EcmascriptMergedUpdate {
|
||||
type: 'EcmascriptMergedUpdate';
|
||||
chunks: {
|
||||
[moduleName: string]: {
|
||||
type: 'partial';
|
||||
};
|
||||
};
|
||||
entries: {
|
||||
[moduleName: string]: {
|
||||
code: string;
|
||||
map: string;
|
||||
url: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
interface PartialUpdate extends BaseUpdate {
|
||||
type: 'partial';
|
||||
instruction: {
|
||||
type: 'ChunkListUpdate';
|
||||
merged: EcmascriptMergedUpdate[] | undefined;
|
||||
};
|
||||
}
|
||||
export type Update = IssuesUpdate | PartialUpdate;
|
||||
export interface HmrIdentifiers {
|
||||
identifiers: string[];
|
||||
}
|
||||
/** @see https://github.com/vercel/next.js/blob/415cd74b9a220b6f50da64da68c13043e9b02995/packages/next-swc/crates/napi/src/next_api/project.rs#L824-L833 */
|
||||
export interface TurbopackStackFrame {
|
||||
isServer: boolean;
|
||||
isInternal?: boolean;
|
||||
file: string;
|
||||
originalFile?: string;
|
||||
/** 1-indexed, unlike source map tokens */
|
||||
line?: number;
|
||||
/** 1-indexed, unlike source map tokens */
|
||||
column?: number;
|
||||
methodName?: string;
|
||||
}
|
||||
export type UpdateMessage = {
|
||||
updateType: 'start';
|
||||
} | {
|
||||
updateType: 'end';
|
||||
value: UpdateInfo;
|
||||
};
|
||||
export interface UpdateInfo {
|
||||
duration: number;
|
||||
tasks: number;
|
||||
}
|
||||
export interface Project {
|
||||
update(options: Partial<ProjectOptions>): Promise<void>;
|
||||
writeAllEntrypointsToDisk(appDirOnly: boolean): Promise<TurbopackResult<RawEntrypoints>>;
|
||||
entrypointsSubscribe(): AsyncIterableIterator<TurbopackResult<RawEntrypoints>>;
|
||||
hmrEvents(identifier: string): AsyncIterableIterator<TurbopackResult<Update>>;
|
||||
hmrIdentifiersSubscribe(): AsyncIterableIterator<TurbopackResult<HmrIdentifiers>>;
|
||||
getSourceForAsset(filePath: string): Promise<string | null>;
|
||||
getSourceMap(filePath: string): Promise<string | null>;
|
||||
getSourceMapSync(filePath: string): string | null;
|
||||
traceSource(stackFrame: TurbopackStackFrame, currentDirectoryFileUrl: string): Promise<TurbopackStackFrame | null>;
|
||||
updateInfoSubscribe(aggregationMs: number): AsyncIterableIterator<TurbopackResult<UpdateMessage>>;
|
||||
shutdown(): Promise<void>;
|
||||
onExit(): Promise<void>;
|
||||
}
|
||||
export type Route = {
|
||||
type: 'conflict';
|
||||
} | {
|
||||
type: 'app-page';
|
||||
pages: {
|
||||
originalName: string;
|
||||
htmlEndpoint: Endpoint;
|
||||
rscEndpoint: Endpoint;
|
||||
}[];
|
||||
} | {
|
||||
type: 'app-route';
|
||||
originalName: string;
|
||||
endpoint: Endpoint;
|
||||
} | {
|
||||
type: 'page';
|
||||
htmlEndpoint: Endpoint;
|
||||
dataEndpoint: Endpoint;
|
||||
} | {
|
||||
type: 'page-api';
|
||||
endpoint: Endpoint;
|
||||
};
|
||||
export interface Endpoint {
|
||||
/** Write files for the endpoint to disk. */
|
||||
writeToDisk(): Promise<TurbopackResult<WrittenEndpoint>>;
|
||||
/**
|
||||
* Listen to client-side changes to the endpoint.
|
||||
* After clientChanged() has been awaited it will listen to changes.
|
||||
* The async iterator will yield for each change.
|
||||
*/
|
||||
clientChanged(): Promise<AsyncIterableIterator<TurbopackResult>>;
|
||||
/**
|
||||
* Listen to server-side changes to the endpoint.
|
||||
* After serverChanged() has been awaited it will listen to changes.
|
||||
* The async iterator will yield for each change.
|
||||
*/
|
||||
serverChanged(includeIssues: boolean): Promise<AsyncIterableIterator<TurbopackResult>>;
|
||||
}
|
||||
interface EndpointConfig {
|
||||
dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static';
|
||||
dynamicParams?: boolean;
|
||||
revalidate?: 'never' | 'force-cache' | number;
|
||||
fetchCache?: 'auto' | 'default-cache' | 'only-cache' | 'force-cache' | 'default-no-store' | 'only-no-store' | 'force-no-store';
|
||||
runtime?: 'nodejs' | 'edge';
|
||||
preferredRegion?: string;
|
||||
}
|
||||
export type ServerPath = {
|
||||
path: string;
|
||||
contentHash: string;
|
||||
};
|
||||
export type WrittenEndpoint = {
|
||||
type: 'nodejs';
|
||||
/** The entry path for the endpoint. */
|
||||
entryPath: string;
|
||||
/** All client paths that have been written for the endpoint. */
|
||||
clientPaths: string[];
|
||||
/** All server paths that have been written for the endpoint. */
|
||||
serverPaths: ServerPath[];
|
||||
config: EndpointConfig;
|
||||
} | {
|
||||
type: 'edge';
|
||||
/** All client paths that have been written for the endpoint. */
|
||||
clientPaths: string[];
|
||||
/** All server paths that have been written for the endpoint. */
|
||||
serverPaths: ServerPath[];
|
||||
config: EndpointConfig;
|
||||
} | {
|
||||
type: 'none';
|
||||
clientPaths: [];
|
||||
serverPaths: [];
|
||||
config: EndpointConfig;
|
||||
};
|
||||
export interface ProjectOptions {
|
||||
/**
|
||||
* A root path from which all files must be nested under. Trying to access
|
||||
* a file outside this root will fail. Think of this as a chroot.
|
||||
*/
|
||||
rootPath: string;
|
||||
/**
|
||||
* A path inside the root_path which contains the app/pages directories.
|
||||
*/
|
||||
projectPath: string;
|
||||
/**
|
||||
* The path to the .next directory.
|
||||
*/
|
||||
distDir: string;
|
||||
/**
|
||||
* The next.config.js contents.
|
||||
*/
|
||||
nextConfig: NextConfigComplete;
|
||||
/**
|
||||
* Jsconfig, or tsconfig contents.
|
||||
*
|
||||
* Next.js implicitly requires to read it to support few options
|
||||
* https://nextjs.org/docs/architecture/nextjs-compiler#legacy-decorators
|
||||
* https://nextjs.org/docs/architecture/nextjs-compiler#importsource
|
||||
*/
|
||||
jsConfig: {
|
||||
compilerOptions: object;
|
||||
};
|
||||
/**
|
||||
* A map of environment variables to use when compiling code.
|
||||
*/
|
||||
env: Record<string, string>;
|
||||
defineEnv: DefineEnv;
|
||||
/**
|
||||
* Whether to watch the filesystem for file changes.
|
||||
*/
|
||||
watch: {
|
||||
enable: boolean;
|
||||
pollIntervalMs?: number;
|
||||
};
|
||||
/**
|
||||
* The mode in which Next.js is running.
|
||||
*/
|
||||
dev: boolean;
|
||||
/**
|
||||
* The server actions encryption key.
|
||||
*/
|
||||
encryptionKey: string;
|
||||
/**
|
||||
* The build id.
|
||||
*/
|
||||
buildId: string;
|
||||
/**
|
||||
* Options for draft mode.
|
||||
*/
|
||||
previewProps: __ApiPreviewProps;
|
||||
/**
|
||||
* The browserslist query to use for targeting browsers.
|
||||
*/
|
||||
browserslistQuery: string;
|
||||
/**
|
||||
* When the code is minified, this opts out of the default mangling of local
|
||||
* names for variables, functions etc., which can be useful for
|
||||
* debugging/profiling purposes.
|
||||
*/
|
||||
noMangling: boolean;
|
||||
}
|
||||
export interface DefineEnv {
|
||||
client: RustifiedEnv;
|
||||
edge: RustifiedEnv;
|
||||
nodejs: RustifiedEnv;
|
||||
}
|
||||
export type RustifiedEnv = {
|
||||
name: string;
|
||||
value: string;
|
||||
}[];
|
||||
export interface GlobalEntrypoints {
|
||||
app: Endpoint | undefined;
|
||||
document: Endpoint | undefined;
|
||||
error: Endpoint | undefined;
|
||||
middleware: Middleware | undefined;
|
||||
instrumentation: Instrumentation | undefined;
|
||||
}
|
||||
export type PageRoute = {
|
||||
type: 'page';
|
||||
htmlEndpoint: Endpoint;
|
||||
dataEndpoint: Endpoint;
|
||||
} | {
|
||||
type: 'page-api';
|
||||
endpoint: Endpoint;
|
||||
};
|
||||
export type AppRoute = {
|
||||
type: 'app-page';
|
||||
htmlEndpoint: Endpoint;
|
||||
rscEndpoint: Endpoint;
|
||||
} | {
|
||||
type: 'app-route';
|
||||
endpoint: Endpoint;
|
||||
};
|
||||
export type PageEntrypoints = Map<string, PageRoute>;
|
||||
export type AppEntrypoints = Map<string, AppRoute>;
|
||||
export type Entrypoints = {
|
||||
global: GlobalEntrypoints;
|
||||
page: PageEntrypoints;
|
||||
app: AppEntrypoints;
|
||||
};
|
||||
6
node_modules/next/dist/build/swc/types.js
generated
vendored
Normal file
6
node_modules/next/dist/build/swc/types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
node_modules/next/dist/build/swc/types.js.map
generated
vendored
Normal file
1
node_modules/next/dist/build/swc/types.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":[],"names":[],"mappings":""}
|
||||
Loading…
Add table
Add a link
Reference in a new issue