@babel/core
Advanced tools
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| import gensync from 'gensync'; | ||
| import { l as loadConfig, r as run } from './index-DX1Zxy9A.js'; | ||
| import fs from 'node:fs'; | ||
| const readFile = gensync({ | ||
| sync: fs.readFileSync, | ||
| errback: fs.readFile | ||
| }); | ||
| const stat = gensync({ | ||
| sync: fs.statSync, | ||
| errback: fs.stat | ||
| }); | ||
| const transformFileRunner = gensync(function* (filename, opts) { | ||
| const options = { | ||
| ...opts, | ||
| filename | ||
| }; | ||
| const config = yield* loadConfig(options); | ||
| if (config === null) return null; | ||
| const code = yield* readFile(filename, "utf8"); | ||
| return yield* run(config, code); | ||
| }); | ||
| function transformFile(...args) { | ||
| transformFileRunner.errback(...args); | ||
| } | ||
| function transformFileSync(...args) { | ||
| return transformFileRunner.sync(...args); | ||
| } | ||
| function transformFileAsync(...args) { | ||
| return transformFileRunner.async(...args); | ||
| } | ||
| export { transformFile as a, transformFileAsync as b, readFile as r, stat as s, transformFileSync as t }; | ||
| //# sourceMappingURL=transform-file-BtKVvcOk.js.map |
| {"version":3,"file":"transform-file-BtKVvcOk.js","sources":["../src/gensync-utils/fs.ts","../src/transform-file.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport gensync from \"gensync\";\n\nexport const readFile = gensync<[filepath: string, encoding: \"utf8\"], string>({\n sync: fs.readFileSync,\n errback: fs.readFile,\n});\n\nexport const stat = gensync({\n sync: fs.statSync,\n errback: fs.stat,\n});\n","import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config/index.ts\";\nimport type { InputOptions, ResolvedConfig } from \"./config/index.ts\";\nimport { run } from \"./transformation/index.ts\";\nimport type { FileResult, FileResultCallback } from \"./transformation/index.ts\";\nimport * as fs from \"./gensync-utils/fs.ts\";\n\ntype transformFileBrowserType = typeof import(\"./transform-file-browser\");\ntype transformFileType = typeof import(\"./transform-file\");\n\n// Kind of gross, but essentially asserting that the exports of this module are the same as the\n// exports of transform-file-browser, since this file may be replaced at bundle time with\n// transform-file-browser.\n// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n({}) as any as transformFileBrowserType as transformFileType;\n\nconst transformFileRunner = gensync(function* (\n filename: string,\n opts?: InputOptions,\n): Handler<FileResult | null> {\n const options = { ...opts, filename };\n\n const config: ResolvedConfig | null = yield* loadConfig(options);\n if (config === null) return null;\n\n const code = yield* fs.readFile(filename, \"utf8\");\n return yield* run(config, code);\n});\n\n// @ts-expect-error TS doesn't detect that this signature is compatible\nexport function transformFile(\n filename: string,\n callback: FileResultCallback,\n): void;\nexport function transformFile(\n filename: string,\n opts: InputOptions | undefined | null,\n callback: FileResultCallback,\n): void;\nexport function transformFile(\n ...args: Parameters<typeof transformFileRunner.errback>\n) {\n transformFileRunner.errback(...args);\n}\n\nexport function transformFileSync(\n ...args: Parameters<typeof transformFileRunner.sync>\n) {\n return transformFileRunner.sync(...args);\n}\nexport function transformFileAsync(\n ...args: Parameters<typeof transformFileRunner.async>\n) {\n return transformFileRunner.async(...args);\n}\n"],"names":["readFile","gensync","sync","fs","readFileSync","errback","stat","statSync","transformFileRunner","filename","opts","options","config","loadConfig","code","run","transformFile","args","transformFileSync","transformFileAsync","async"],"mappings":";;;;AAGaA,MAAAA,QAAQ,GAAGC,OAAO,CAA+C;EAC5EC,IAAI,EAAEC,EAAE,CAACC,YAAY;EACrBC,OAAO,EAAEF,EAAE,CAACH,QAAAA;AACd,CAAC,EAAC;AAEWM,MAAAA,IAAI,GAAGL,OAAO,CAAC;EAC1BC,IAAI,EAAEC,EAAE,CAACI,QAAQ;EACjBF,OAAO,EAAEF,EAAE,CAACG,IAAAA;AACd,CAAC;;ACMD,MAAME,mBAAmB,GAAGP,OAAO,CAAC,WAClCQ,QAAgB,EAChBC,IAAmB,EACS;AAC5B,EAAA,MAAMC,OAAO,GAAG;AAAE,IAAA,GAAGD,IAAI;AAAED,IAAAA,QAAAA;GAAU,CAAA;AAErC,EAAA,MAAMG,MAA6B,GAAG,OAAOC,UAAU,CAACF,OAAO,CAAC,CAAA;AAChE,EAAA,IAAIC,MAAM,KAAK,IAAI,EAAE,OAAO,IAAI,CAAA;EAEhC,MAAME,IAAI,GAAG,OAAOX,QAAW,CAACM,QAAQ,EAAE,MAAM,CAAC,CAAA;AACjD,EAAA,OAAO,OAAOM,GAAG,CAACH,MAAM,EAAEE,IAAI,CAAC,CAAA;AACjC,CAAC,CAAC,CAAA;AAYK,SAASE,aAAaA,CAC3B,GAAGC,IAAoD,EACvD;AACAT,EAAAA,mBAAmB,CAACH,OAAO,CAAC,GAAGY,IAAI,CAAC,CAAA;AACtC,CAAA;AAEO,SAASC,iBAAiBA,CAC/B,GAAGD,IAAiD,EACpD;AACA,EAAA,OAAOT,mBAAmB,CAACN,IAAI,CAAC,GAAGe,IAAI,CAAC,CAAA;AAC1C,CAAA;AACO,SAASE,kBAAkBA,CAChC,GAAGF,IAAkD,EACrD;AACA,EAAA,OAAOT,mBAAmB,CAACY,KAAK,CAAC,GAAGH,IAAI,CAAC,CAAA;AAC3C;;;;"} |
| import path from 'node:path'; | ||
| import { m as makeStrongCache, i as isAsync, w as waitFor, a as makeWeakCache, b as makeWeakCacheSync } from '../../caching-2iA7hK9v.js'; | ||
| import { r as readFile, t as transformFileSync, s as stat } from '../../transform-file-Cc6w1JPg.js'; | ||
| import { r as readFile, t as transformFileSync, s as stat } from '../../transform-file-BtKVvcOk.js'; | ||
| import fs, { existsSync } from 'node:fs'; | ||
| import { C as ConfigError, m as makeConfigAPI, p as pathToPattern } from '../../index-BVo3ANpX.js'; | ||
| import { C as ConfigError, m as makeConfigAPI, p as pathToPattern } from '../../index-DX1Zxy9A.js'; | ||
| import { createDebug } from 'obug'; | ||
@@ -7,0 +7,0 @@ import json5 from 'json5'; |
+41
-38
| import * as _babel_traverse from '@babel/traverse'; | ||
| import _babel_traverse__default, { Visitor as Visitor$1, VisitWrapper, NodePath, Scope, HubInterface } from '@babel/traverse'; | ||
| import _babel_traverse__default, { VisitWrapper, Visitor as Visitor$1, NodePath, Scope, HubInterface } from '@babel/traverse'; | ||
| export { NodePath, Scope, default as traverse } from '@babel/traverse'; | ||
@@ -33,4 +33,7 @@ import * as t from '@babel/types'; | ||
| declare const ___PluginPass: typeof PluginPass; | ||
| type ___PluginTarget = PluginTarget; | ||
| type ___PresetAPI = PresetAPI; | ||
| type ___PresetItem = PresetItem; | ||
| type ___PresetObject = PresetObject; | ||
| type ___PresetTarget = PresetTarget; | ||
| declare const ___Scope: typeof Scope; | ||
@@ -66,5 +69,10 @@ type ___Visitor<S = unknown> = Visitor<S>; | ||
| declare namespace __ { | ||
| export { type ___CallerMetadata as CallerMetadata, type ___ConfigAPI as ConfigAPI, ___ConfigItem as ConfigItem, ___DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS, ___File as File, type ___FileResult as FileResult, type ___InputOptions as InputOptions, ___NodePath as NodePath, type ___NormalizedOptions as NormalizedOptions, ___PartialConfig as PartialConfig, type ___PluginAPI as PluginAPI, type ___PluginItem as PluginItem, type ___PluginObject as PluginObject, ___PluginPass as PluginPass, type ___PresetAPI as PresetAPI, type ___PresetObject as PresetObject, ___Scope as Scope, type ___Visitor as Visitor, export_default as buildExternalHelpers, ___createConfigItem as createConfigItem, ___createConfigItemAsync as createConfigItemAsync, ___createConfigItemSync as createConfigItemSync, ___getEnv as getEnv, ___loadOptions as loadOptions, ___loadOptionsAsync as loadOptionsAsync, ___loadOptionsSync as loadOptionsSync, ___loadPartialConfig as loadPartialConfig, ___loadPartialConfigAsync as loadPartialConfigAsync, ___loadPartialConfigSync as loadPartialConfigSync, ___parse as parse, ___parseAsync as parseAsync, ___parseSync as parseSync, ___resolvePlugin as resolvePlugin, ___resolvePreset as resolvePreset, ___template as template, ___tokTypes as tokTypes, ___transform as transform, ___transformAsync as transformAsync, ___transformFile as transformFile, ___transformFileAsync as transformFileAsync, ___transformFileSync as transformFileSync, ___transformFromAst as transformFromAst, ___transformFromAstAsync as transformFromAstAsync, ___transformFromAstSync as transformFromAstSync, ___transformSync as transformSync, _babel_traverse__default as traverse, t as types, ___version as version }; | ||
| export { type ___CallerMetadata as CallerMetadata, type ___ConfigAPI as ConfigAPI, ___ConfigItem as ConfigItem, ___DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS, ___File as File, type ___FileResult as FileResult, type ___InputOptions as InputOptions, ___NodePath as NodePath, type ___NormalizedOptions as NormalizedOptions, ___PartialConfig as PartialConfig, type ___PluginAPI as PluginAPI, type ___PluginItem as PluginItem, type ___PluginObject as PluginObject, ___PluginPass as PluginPass, type ___PluginTarget as PluginTarget, type ___PresetAPI as PresetAPI, type ___PresetItem as PresetItem, type ___PresetObject as PresetObject, type ___PresetTarget as PresetTarget, ___Scope as Scope, type ___Visitor as Visitor, export_default as buildExternalHelpers, ___createConfigItem as createConfigItem, ___createConfigItemAsync as createConfigItemAsync, ___createConfigItemSync as createConfigItemSync, ___getEnv as getEnv, ___loadOptions as loadOptions, ___loadOptionsAsync as loadOptionsAsync, ___loadOptionsSync as loadOptionsSync, ___loadPartialConfig as loadPartialConfig, ___loadPartialConfigAsync as loadPartialConfigAsync, ___loadPartialConfigSync as loadPartialConfigSync, ___parse as parse, ___parseAsync as parseAsync, ___parseSync as parseSync, ___resolvePlugin as resolvePlugin, ___resolvePreset as resolvePreset, ___template as template, ___tokTypes as tokTypes, ___transform as transform, ___transformAsync as transformAsync, ___transformFile as transformFile, ___transformFileAsync as transformFileAsync, ___transformFileSync as transformFileSync, ___transformFromAst as transformFromAst, ___transformFromAstAsync as transformFromAstAsync, ___transformFromAstSync as transformFromAstSync, ___transformSync as transformSync, _babel_traverse__default as traverse, t as types, ___version as version }; | ||
| } | ||
| declare const __marker: unique symbol; | ||
| type ReadonlyDeepArray<T> = readonly (T | ReadonlyDeepArray<T>)[] & { | ||
| [__marker]: true; | ||
| }; | ||
| type SimpleCacheConfigurator = { | ||
@@ -80,7 +88,2 @@ (forever: boolean): void; | ||
| declare const __marker: unique symbol; | ||
| type ReadonlyDeepArray<T> = readonly (T | ReadonlyDeepArray<T>)[] & { | ||
| [__marker]: true; | ||
| }; | ||
| type FileHandling = "transpile" | "ignored" | "unsupported"; | ||
@@ -189,26 +192,2 @@ | ||
| type PluginObject<S extends PluginPass = PluginPass> = { | ||
| name?: string; | ||
| manipulateOptions?: (options: ResolvedOptions, parserOpts: ParserOptions) => void; | ||
| pre?: (this: S, file: File) => void | Promise<void>; | ||
| post?: (this: S, file: File) => void | Promise<void>; | ||
| inherits?: (api: PluginAPI, options: unknown, dirname: string) => PluginObject; | ||
| visitor?: Visitor$1<S>; | ||
| parserOverride?: (...args: [...Parameters<typeof parse$1>, typeof parse$1]) => ReturnType<typeof parse$1>; | ||
| generatorOverride?: (ast: File["ast"], generatorOpts: GeneratorOptions, code: File["code"], generate: typeof babelGenerator) => GeneratorResult; | ||
| }; | ||
| declare class Plugin { | ||
| key: string | undefined | null; | ||
| manipulateOptions?: PluginObject["manipulateOptions"]; | ||
| post?: PluginObject["post"]; | ||
| pre?: PluginObject["pre"]; | ||
| visitor: PluginObject["visitor"]; | ||
| parserOverride?: PluginObject["parserOverride"]; | ||
| generatorOverride?: PluginObject["generatorOverride"]; | ||
| options: object; | ||
| externalDependencies: ReadonlyDeepArray<string>; | ||
| constructor(plugin: PluginObject, options: object, key?: string, externalDependencies?: ReadonlyDeepArray<string>); | ||
| } | ||
| type Assumptions = { | ||
@@ -327,5 +306,5 @@ arrayLikeIsIterable?: boolean; | ||
| }; | ||
| type PluginTarget = string | MaybeDefaultProperty<(api: PluginAPI, options?: object, dirname?: string) => PluginObject>; | ||
| type PluginTarget = string | MaybeDefaultProperty<(api: PluginAPI, options: object, dirname: string) => PluginObject>; | ||
| type PluginItem = ConfigItem<PluginAPI> | PluginTarget | [PluginTarget, object] | [PluginTarget, object, string]; | ||
| type PresetTarget = string | MaybeDefaultProperty<(api: PresetAPI, options?: object, dirname?: string) => PresetObject>; | ||
| type PresetTarget = string | MaybeDefaultProperty<(api: PresetAPI, options: object, dirname: string) => PresetObject>; | ||
| type PresetItem = ConfigItem<PresetAPI> | PresetTarget | [PresetTarget, object] | [PresetTarget, object, string]; | ||
@@ -350,2 +329,26 @@ type ConfigApplicableTest = MatchItem | MatchItem[]; | ||
| type PluginObject<S extends PluginPass = PluginPass> = { | ||
| name?: string; | ||
| manipulateOptions?: (options: ResolvedOptions, parserOpts: ParserOptions) => void; | ||
| pre?: (this: S, file: File) => void | Promise<void>; | ||
| post?: (this: S, file: File) => void | Promise<void>; | ||
| inherits?: (api: PluginAPI, options: unknown, dirname: string) => PluginObject; | ||
| visitor?: Visitor$1<S>; | ||
| parserOverride?: (...args: [...Parameters<typeof parse$1>, typeof parse$1]) => ReturnType<typeof parse$1>; | ||
| generatorOverride?: (ast: File["ast"], generatorOpts: GeneratorOptions, code: File["code"], generate: typeof babelGenerator) => GeneratorResult; | ||
| }; | ||
| declare class Plugin { | ||
| key: string | undefined | null; | ||
| manipulateOptions?: PluginObject["manipulateOptions"]; | ||
| post?: PluginObject["post"]; | ||
| pre?: PluginObject["pre"]; | ||
| visitor: PluginObject["visitor"]; | ||
| parserOverride?: PluginObject["parserOverride"]; | ||
| generatorOverride?: PluginObject["generatorOverride"]; | ||
| options: object; | ||
| externalDependencies: ReadonlyDeepArray<string>; | ||
| constructor(plugin: PluginObject, options: object, key?: string, externalDependencies?: ReadonlyDeepArray<string>); | ||
| } | ||
| declare function loadPartialConfig$1(opts?: InputOptions): Handler<PartialConfig | null>; | ||
@@ -383,6 +386,6 @@ | ||
| declare function loadOptions(opts: Parameters<typeof loadOptionsImpl>[0], callback?: (err: Error, val: ResolvedOptions | null) => void): void; | ||
| declare const createConfigItemRunner: gensync.Gensync<[value: string | ConfigItem<PresetAPI> | ((api: PresetAPI, options?: object, dirname?: string) => PresetObject) | { | ||
| default: (api: PresetAPI, options?: object, dirname?: string) => PresetObject; | ||
| } | [PresetTarget, object] | [PresetTarget, object, string] | ConfigItem<PluginAPI> | ((api: PluginAPI, options?: object, dirname?: string) => PluginObject) | { | ||
| default: (api: PluginAPI, options?: object, dirname?: string) => PluginObject; | ||
| declare const createConfigItemRunner: gensync.Gensync<[value: string | ConfigItem<PresetAPI> | ((api: PresetAPI, options: object, dirname: string) => PresetObject) | { | ||
| default: (api: PresetAPI, options: object, dirname: string) => PresetObject; | ||
| } | [PresetTarget, object] | [PresetTarget, object, string] | ConfigItem<PluginAPI> | ((api: PluginAPI, options: object, dirname: string) => PluginObject) | { | ||
| default: (api: PluginAPI, options: object, dirname: string) => PluginObject; | ||
| } | [PluginTarget, object] | [PluginTarget, object, string], ({ | ||
@@ -538,2 +541,2 @@ dirname?: string; | ||
| export { type CallerMetadata, type ConfigAPI, ConfigItem, DEFAULT_EXTENSIONS, File, type FileResult, type InputOptions, type NormalizedOptions, PartialConfig, type PluginAPI, type PluginItem, type PluginObject, PluginPass, type PresetAPI, type PresetObject, type Visitor, export_default as buildExternalHelpers, createConfigItem, createConfigItemAsync, createConfigItemSync, getEnv, loadOptions, loadOptionsAsync, loadOptionsSync, loadPartialConfig, loadPartialConfigAsync, loadPartialConfigSync, parse, parseAsync, parseSync, resolvePlugin, resolvePreset, transform, transformAsync, transformFile, transformFileAsync, transformFileSync, transformFromAst, transformFromAstAsync, transformFromAstSync, transformSync, version }; | ||
| export { type CallerMetadata, type ConfigAPI, ConfigItem, DEFAULT_EXTENSIONS, File, type FileResult, type InputOptions, type NormalizedOptions, PartialConfig, type PluginAPI, type PluginItem, type PluginObject, PluginPass, type PluginTarget, type PresetAPI, type PresetItem, type PresetObject, type PresetTarget, type Visitor, export_default as buildExternalHelpers, createConfigItem, createConfigItemAsync, createConfigItemSync, getEnv, loadOptions, loadOptionsAsync, loadOptionsSync, loadPartialConfig, loadPartialConfigAsync, loadPartialConfigSync, parse, parseAsync, parseSync, resolvePlugin, resolvePreset, transform, transformAsync, transformFile, transformFileAsync, transformFileSync, transformFromAst, transformFromAstAsync, transformFromAstSync, transformSync, version }; |
+1
-1
@@ -1,2 +0,2 @@ | ||
| export { D as DEFAULT_EXTENSIONS, F as File, d as buildExternalHelpers, e as createConfigItem, f as createConfigItemAsync, h as createConfigItemSync, g as getEnv, i as loadOptions, j as loadOptionsAsync, c as loadOptionsSync, k as loadPartialConfig, n as loadPartialConfigAsync, o as loadPartialConfigSync, y as parse, z as parseAsync, A as parseSync, a as resolvePlugin, b as resolvePreset, t as transform, q as transformAsync, u as transformFromAst, w as transformFromAstAsync, x as transformFromAstSync, s as transformSync, v as version } from './index-BVo3ANpX.js'; | ||
| export { D as DEFAULT_EXTENSIONS, F as File, d as buildExternalHelpers, e as createConfigItem, f as createConfigItemAsync, h as createConfigItemSync, g as getEnv, i as loadOptions, j as loadOptionsAsync, c as loadOptionsSync, k as loadPartialConfig, n as loadPartialConfigAsync, o as loadPartialConfigSync, y as parse, z as parseAsync, A as parseSync, a as resolvePlugin, b as resolvePreset, t as transform, q as transformAsync, u as transformFromAst, w as transformFromAstAsync, x as transformFromAstSync, s as transformSync, v as version } from './index-DX1Zxy9A.js'; | ||
| import '#config/files'; | ||
@@ -3,0 +3,0 @@ import * as _t from '@babel/types'; |
| import 'gensync'; | ||
| import './index-BVo3ANpX.js'; | ||
| export { a as transformFile, b as transformFileAsync, t as transformFileSync } from './transform-file-Cc6w1JPg.js'; | ||
| import './index-DX1Zxy9A.js'; | ||
| export { a as transformFile, b as transformFileAsync, t as transformFileSync } from './transform-file-BtKVvcOk.js'; | ||
| import '@babel/helpers'; | ||
@@ -5,0 +5,0 @@ import '@babel/traverse'; |
+15
-15
| { | ||
| "name": "@babel/core", | ||
| "version": "8.0.0-rc.1", | ||
| "version": "8.0.0-rc.2", | ||
| "description": "Babel compiler core.", | ||
@@ -41,10 +41,10 @@ "main": "./lib/index.js", | ||
| "dependencies": { | ||
| "@babel/code-frame": "^8.0.0-rc.1", | ||
| "@babel/generator": "^8.0.0-rc.1", | ||
| "@babel/helper-compilation-targets": "^8.0.0-rc.1", | ||
| "@babel/helpers": "^8.0.0-rc.1", | ||
| "@babel/parser": "^8.0.0-rc.1", | ||
| "@babel/template": "^8.0.0-rc.1", | ||
| "@babel/traverse": "^8.0.0-rc.1", | ||
| "@babel/types": "^8.0.0-rc.1", | ||
| "@babel/code-frame": "^8.0.0-rc.2", | ||
| "@babel/generator": "^8.0.0-rc.2", | ||
| "@babel/helper-compilation-targets": "^8.0.0-rc.2", | ||
| "@babel/helpers": "^8.0.0-rc.2", | ||
| "@babel/parser": "^8.0.0-rc.2", | ||
| "@babel/template": "^8.0.0-rc.2", | ||
| "@babel/traverse": "^8.0.0-rc.2", | ||
| "@babel/types": "^8.0.0-rc.2", | ||
| "@jridgewell/remapping": "^2.3.5", | ||
@@ -60,8 +60,8 @@ "@types/gensync": "^1.0.0", | ||
| "devDependencies": { | ||
| "@babel/helper-transform-fixture-test-runner": "^8.0.0-rc.1", | ||
| "@babel/plugin-syntax-flow": "^8.0.0-rc.1", | ||
| "@babel/plugin-transform-flow-strip-types": "^8.0.0-rc.1", | ||
| "@babel/plugin-transform-modules-commonjs": "^8.0.0-rc.1", | ||
| "@babel/preset-env": "^8.0.0-rc.1", | ||
| "@babel/preset-typescript": "^8.0.0-rc.1", | ||
| "@babel/helper-transform-fixture-test-runner": "^8.0.0-rc.2", | ||
| "@babel/plugin-syntax-flow": "^8.0.0-rc.2", | ||
| "@babel/plugin-transform-flow-strip-types": "^8.0.0-rc.2", | ||
| "@babel/plugin-transform-modules-commonjs": "^8.0.0-rc.2", | ||
| "@babel/preset-env": "^8.0.0-rc.2", | ||
| "@babel/preset-typescript": "^8.0.0-rc.2", | ||
| "@jridgewell/trace-mapping": "^0.3.28", | ||
@@ -68,0 +68,0 @@ "@types/convert-source-map": "^2.0.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| import gensync from 'gensync'; | ||
| import { l as loadConfig, r as run } from './index-BVo3ANpX.js'; | ||
| import fs from 'node:fs'; | ||
| const readFile = gensync({ | ||
| sync: fs.readFileSync, | ||
| errback: fs.readFile | ||
| }); | ||
| const stat = gensync({ | ||
| sync: fs.statSync, | ||
| errback: fs.stat | ||
| }); | ||
| const transformFileRunner = gensync(function* (filename, opts) { | ||
| const options = { | ||
| ...opts, | ||
| filename | ||
| }; | ||
| const config = yield* loadConfig(options); | ||
| if (config === null) return null; | ||
| const code = yield* readFile(filename, "utf8"); | ||
| return yield* run(config, code); | ||
| }); | ||
| function transformFile(...args) { | ||
| transformFileRunner.errback(...args); | ||
| } | ||
| function transformFileSync(...args) { | ||
| return transformFileRunner.sync(...args); | ||
| } | ||
| function transformFileAsync(...args) { | ||
| return transformFileRunner.async(...args); | ||
| } | ||
| export { transformFile as a, transformFileAsync as b, readFile as r, stat as s, transformFileSync as t }; | ||
| //# sourceMappingURL=transform-file-Cc6w1JPg.js.map |
| {"version":3,"file":"transform-file-Cc6w1JPg.js","sources":["../src/gensync-utils/fs.ts","../src/transform-file.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport gensync from \"gensync\";\n\nexport const readFile = gensync<[filepath: string, encoding: \"utf8\"], string>({\n sync: fs.readFileSync,\n errback: fs.readFile,\n});\n\nexport const stat = gensync({\n sync: fs.statSync,\n errback: fs.stat,\n});\n","import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config/index.ts\";\nimport type { InputOptions, ResolvedConfig } from \"./config/index.ts\";\nimport { run } from \"./transformation/index.ts\";\nimport type { FileResult, FileResultCallback } from \"./transformation/index.ts\";\nimport * as fs from \"./gensync-utils/fs.ts\";\n\ntype transformFileBrowserType = typeof import(\"./transform-file-browser\");\ntype transformFileType = typeof import(\"./transform-file\");\n\n// Kind of gross, but essentially asserting that the exports of this module are the same as the\n// exports of transform-file-browser, since this file may be replaced at bundle time with\n// transform-file-browser.\n// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n({}) as any as transformFileBrowserType as transformFileType;\n\nconst transformFileRunner = gensync(function* (\n filename: string,\n opts?: InputOptions,\n): Handler<FileResult | null> {\n const options = { ...opts, filename };\n\n const config: ResolvedConfig | null = yield* loadConfig(options);\n if (config === null) return null;\n\n const code = yield* fs.readFile(filename, \"utf8\");\n return yield* run(config, code);\n});\n\n// @ts-expect-error TS doesn't detect that this signature is compatible\nexport function transformFile(\n filename: string,\n callback: FileResultCallback,\n): void;\nexport function transformFile(\n filename: string,\n opts: InputOptions | undefined | null,\n callback: FileResultCallback,\n): void;\nexport function transformFile(\n ...args: Parameters<typeof transformFileRunner.errback>\n) {\n transformFileRunner.errback(...args);\n}\n\nexport function transformFileSync(\n ...args: Parameters<typeof transformFileRunner.sync>\n) {\n return transformFileRunner.sync(...args);\n}\nexport function transformFileAsync(\n ...args: Parameters<typeof transformFileRunner.async>\n) {\n return transformFileRunner.async(...args);\n}\n"],"names":["readFile","gensync","sync","fs","readFileSync","errback","stat","statSync","transformFileRunner","filename","opts","options","config","loadConfig","code","run","transformFile","args","transformFileSync","transformFileAsync","async"],"mappings":";;;;AAGaA,MAAAA,QAAQ,GAAGC,OAAO,CAA+C;EAC5EC,IAAI,EAAEC,EAAE,CAACC,YAAY;EACrBC,OAAO,EAAEF,EAAE,CAACH,QAAAA;AACd,CAAC,EAAC;AAEWM,MAAAA,IAAI,GAAGL,OAAO,CAAC;EAC1BC,IAAI,EAAEC,EAAE,CAACI,QAAQ;EACjBF,OAAO,EAAEF,EAAE,CAACG,IAAAA;AACd,CAAC;;ACMD,MAAME,mBAAmB,GAAGP,OAAO,CAAC,WAClCQ,QAAgB,EAChBC,IAAmB,EACS;AAC5B,EAAA,MAAMC,OAAO,GAAG;AAAE,IAAA,GAAGD,IAAI;AAAED,IAAAA,QAAAA;GAAU,CAAA;AAErC,EAAA,MAAMG,MAA6B,GAAG,OAAOC,UAAU,CAACF,OAAO,CAAC,CAAA;AAChE,EAAA,IAAIC,MAAM,KAAK,IAAI,EAAE,OAAO,IAAI,CAAA;EAEhC,MAAME,IAAI,GAAG,OAAOX,QAAW,CAACM,QAAQ,EAAE,MAAM,CAAC,CAAA;AACjD,EAAA,OAAO,OAAOM,GAAG,CAACH,MAAM,EAAEE,IAAI,CAAC,CAAA;AACjC,CAAC,CAAC,CAAA;AAYK,SAASE,aAAaA,CAC3B,GAAGC,IAAoD,EACvD;AACAT,EAAAA,mBAAmB,CAACH,OAAO,CAAC,GAAGY,IAAI,CAAC,CAAA;AACtC,CAAA;AAEO,SAASC,iBAAiBA,CAC/B,GAAGD,IAAiD,EACpD;AACA,EAAA,OAAOT,mBAAmB,CAACN,IAAI,CAAC,GAAGe,IAAI,CAAC,CAAA;AAC1C,CAAA;AACO,SAASE,kBAAkBA,CAChC,GAAGF,IAAkD,EACrD;AACA,EAAA,OAAOT,mBAAmB,CAACY,KAAK,CAAC,GAAGH,IAAI,CAAC,CAAA;AAC3C;;;;"} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
585993
0.06%4666
0.06%- Removed
Updated
Updated
Updated
Updated
Updated
Updated