@sanity/pkg-utils 2.3.12 → 2.3.13-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/_chunks/{build-11470607.cjs → build-fabfa3af.cjs} +6 -6
  2. package/dist/_chunks/build-fabfa3af.cjs.map +1 -0
  3. package/dist/_chunks/{buildAction-e950d498.cjs → buildAction-dae78abb.cjs} +2 -2
  4. package/dist/_chunks/{buildAction-e950d498.cjs.map → buildAction-dae78abb.cjs.map} +1 -1
  5. package/dist/_chunks/{check-0665cb35.cjs → check-332a2bb9.cjs} +3 -3
  6. package/dist/_chunks/{check-0665cb35.cjs.map → check-332a2bb9.cjs.map} +1 -1
  7. package/dist/_chunks/{checkAction-c3e5da35.cjs → checkAction-c39d7dbf.cjs} +2 -2
  8. package/dist/_chunks/{checkAction-c3e5da35.cjs.map → checkAction-c39d7dbf.cjs.map} +1 -1
  9. package/dist/_chunks/{consoleSpy-d738cb9f.cjs → consoleSpy-686c350b.cjs} +52 -12
  10. package/dist/_chunks/consoleSpy-686c350b.cjs.map +1 -0
  11. package/dist/_chunks/{index-70f8931a.cjs → index-1811ae9f.cjs} +25 -7
  12. package/dist/_chunks/index-1811ae9f.cjs.map +1 -0
  13. package/dist/_chunks/{init-2377e6e5.cjs → init-e45c0c31.cjs} +2 -2
  14. package/dist/_chunks/{init-2377e6e5.cjs.map → init-e45c0c31.cjs.map} +1 -1
  15. package/dist/_chunks/{initAction-2abd8576.cjs → initAction-48ce747a.cjs} +2 -2
  16. package/dist/_chunks/{initAction-2abd8576.cjs.map → initAction-48ce747a.cjs.map} +1 -1
  17. package/dist/_chunks/{logger-c593f06b.cjs → logger-718e11be.cjs} +8 -6
  18. package/dist/_chunks/logger-718e11be.cjs.map +1 -0
  19. package/dist/_chunks/{watch-d390d5e4.cjs → watch-4e565bee.cjs} +4 -4
  20. package/dist/_chunks/{watch-d390d5e4.cjs.map → watch-4e565bee.cjs.map} +1 -1
  21. package/dist/_chunks/{watchAction-63c8a721.cjs → watchAction-a5721084.cjs} +2 -2
  22. package/dist/_chunks/{watchAction-63c8a721.cjs.map → watchAction-a5721084.cjs.map} +1 -1
  23. package/dist/cli.cjs +5 -5
  24. package/dist/index.cjs +7 -7
  25. package/dist/index.d.ts +9 -2
  26. package/dist/index.js +80 -21
  27. package/dist/index.js.map +1 -1
  28. package/package.json +3 -2
  29. package/src/node/core/config/types.ts +5 -0
  30. package/src/node/core/pkg/loadPkgWithReporting.ts +91 -18
  31. package/src/node/core/pkg/types.ts +4 -2
  32. package/src/node/core/pkg/validatePkg.ts +5 -3
  33. package/src/node/resolveBuildTasks.ts +2 -2
  34. package/src/node/tasks/rollup/resolveRollupConfig.ts +10 -4
  35. package/src/node/tasks/rollup/rollupTask.ts +20 -0
  36. package/dist/_chunks/build-11470607.cjs.map +0 -1
  37. package/dist/_chunks/consoleSpy-d738cb9f.cjs.map +0 -1
  38. package/dist/_chunks/index-70f8931a.cjs.map +0 -1
  39. package/dist/_chunks/logger-c593f06b.cjs.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/pkg-utils",
3
- "version": "2.3.12",
3
+ "version": "2.3.13-canary.1",
4
4
  "description": "Simple utilities for modern npm packages.",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -26,8 +26,8 @@
26
26
  ".": {
27
27
  "types": "./dist/index.d.ts",
28
28
  "source": "./src/node/index.ts",
29
- "require": "./dist/index.cjs",
30
29
  "import": "./dist/index.js",
30
+ "require": "./dist/index.cjs",
31
31
  "default": "./dist/index.js"
32
32
  },
33
33
  "./package.json": "./package.json"
@@ -155,6 +155,7 @@
155
155
  "rimraf": "^4.4.1",
156
156
  "rollup": "^3.27.2",
157
157
  "rollup-plugin-esbuild": "^5.0.0",
158
+ "rollup-plugin-preserve-directives": "^0.2.0",
158
159
  "rxjs": "^7.8.1",
159
160
  "treeify": "^1.1.0",
160
161
  "uuid": "^9.0.0",
@@ -114,6 +114,11 @@ export interface PkgConfigOptions {
114
114
  * Build package with support for legacy exports (writes root `<export>.js` files)
115
115
  */
116
116
  legacyExports?: boolean
117
+ /**
118
+ * Preserves module directives, such as `'use client'`
119
+ * @alpha
120
+ */
121
+ preserveModuleDirectives?: boolean
117
122
  minify?: boolean
118
123
  /** @alpha */
119
124
  rollup?: {
@@ -15,6 +15,7 @@ export async function loadPkgWithReporting(options: {
15
15
 
16
16
  try {
17
17
  const pkg = await loadPkg({cwd})
18
+ let shouldError = false
18
19
 
19
20
  // validate exports
20
21
  if (pkg.exports) {
@@ -28,33 +29,105 @@ export async function loadPkgWithReporting(options: {
28
29
  const keys = Object.keys(exp)
29
30
 
30
31
  if (!assertFirst('types', keys)) {
31
- logger.warn(`exports["${expPath}"]: the \`types\` property should be the first property`)
32
+ shouldError = true
33
+ logger.error(`exports["${expPath}"]: the \`types\` property should be the first property`)
32
34
  }
33
35
 
34
- if (!assertOrder('require', 'import', keys)) {
35
- logger.warn(
36
- `exports["${expPath}"]: the \`require\` property should come before the \`import\` property`,
37
- )
38
- }
39
-
40
- if (!assertOrder('require', 'node', keys)) {
41
- logger.warn(
42
- `exports["${expPath}"]: the \`require\` property should come before the \`node\` property`,
43
- )
44
- }
45
-
46
- if (!assertOrder('node', 'import', keys)) {
47
- logger.warn(
48
- `exports["${expPath}"]: the \`node\` property should come before \`import\` property`,
49
- )
36
+ if (exp.node) {
37
+ const nodeKeys = Object.keys(exp.node)
38
+
39
+ if (!assertOrder('module', 'import', nodeKeys)) {
40
+ shouldError = true
41
+ logger.error(
42
+ `exports["${expPath}"]: the \`node.module\` property should come before the \`node.import\` property`,
43
+ )
44
+ }
45
+
46
+ if (!assertOrder('import', 'require', nodeKeys)) {
47
+ logger.warn(
48
+ `exports["${expPath}"]: the \`node.import\` property should come before the \`node.require\` property`,
49
+ )
50
+ }
51
+
52
+ if (!assertOrder('module', 'require', nodeKeys)) {
53
+ logger.warn(
54
+ `exports["${expPath}"]: the \`node.module\` property should come before \`node.require\` property`,
55
+ )
56
+ }
57
+
58
+ if (exp.import && exp.node.import && !assertOrder('node', 'import', keys)) {
59
+ shouldError = true
60
+ logger.error(
61
+ `exports["${expPath}"]: the \`node\` property should come before the \`import\` property`,
62
+ )
63
+ }
64
+
65
+ if (exp.module && exp.node.module && !assertOrder('node', 'module', keys)) {
66
+ shouldError = true
67
+ logger.error(
68
+ `exports["${expPath}"]: the \`node\` property should come before the \`module\` property`,
69
+ )
70
+ }
71
+
72
+ // If there's a `node.import` property but not a `node.require` we can assume `node.import` is wrapping `import` and `node.module` should be added for bundlers
73
+ if (exp.node.import && !exp.node.require && !exp.node.module) {
74
+ shouldError = true
75
+ logger.error(
76
+ `exports["${expPath}"]: the \`node.module\` property should be added so bundlers don't unintentionally try to bundle \`node.import\``,
77
+ )
78
+ }
79
+
80
+ if (
81
+ exp.node.import &&
82
+ !exp.node.require &&
83
+ exp.node.module &&
84
+ exp.import &&
85
+ exp.node.module !== exp.import
86
+ ) {
87
+ shouldError = true
88
+ logger.error(
89
+ `exports["${expPath}"]: the \`node.module\` property should match \`import\``,
90
+ )
91
+ }
92
+
93
+ if (exp.require && exp.node.require && exp.require === exp.node.require) {
94
+ shouldError = true
95
+ logger.error(
96
+ `exports["${expPath}"]: the \`node.require\` property isn't necessary as it's identical to \`require\``,
97
+ )
98
+ } else if (exp.require && exp.node.require && !assertOrder('node', 'require', keys)) {
99
+ shouldError = true
100
+ logger.error(
101
+ `exports["${expPath}"]: the \`node\` property should come before the \`require\` property`,
102
+ )
103
+ }
104
+ } else {
105
+ if (!assertOrder('import', 'require', keys)) {
106
+ logger.warn(
107
+ `exports["${expPath}"]: the \`import\` property should come before the \`require\` property`,
108
+ )
109
+ }
110
+
111
+ if (!assertOrder('module', 'import', keys)) {
112
+ logger.warn(
113
+ `exports["${expPath}"]: the \`module\` property should come before \`import\` property`,
114
+ )
115
+ }
50
116
  }
51
117
 
52
118
  if (!assertLast('default', keys)) {
53
- logger.warn(`exports["${expPath}"]: the \`default\` property should be the last property`)
119
+ shouldError = true
120
+ logger.error(
121
+ `exports["${expPath}"]: the \`default\` property should be the last property`,
122
+ )
54
123
  }
55
124
  }
56
125
  }
57
126
 
127
+ if (shouldError) {
128
+ process.exit(1)
129
+ }
130
+
58
131
  return pkg
59
132
  } catch (err) {
60
133
  if (err instanceof ZodError) {
@@ -19,14 +19,16 @@ export interface PackageJSON {
19
19
  types?: string
20
20
  browser?: {
21
21
  source: string
22
- require?: string
23
22
  import?: string
23
+ require?: string
24
24
  }
25
25
  node?: {
26
26
  source?: string
27
- require?: string
27
+ module?: string
28
28
  import?: string
29
+ require?: string
29
30
  }
31
+ module?: string
30
32
  import?: string
31
33
  require?: string
32
34
  default: string
@@ -23,22 +23,24 @@ const pkgSchema = z.object({
23
23
  z.object({
24
24
  types: z.optional(z.string()),
25
25
  source: z.string(),
26
- require: z.optional(z.string()),
27
26
  browser: z.optional(
28
27
  z.object({
29
28
  source: z.string(),
30
- require: z.optional(z.string()),
31
29
  import: z.optional(z.string()),
30
+ require: z.optional(z.string()),
32
31
  }),
33
32
  ),
34
33
  node: z.optional(
35
34
  z.object({
36
35
  source: z.optional(z.string()),
37
- require: z.optional(z.string()),
36
+ module: z.optional(z.string()),
38
37
  import: z.optional(z.string()),
38
+ require: z.optional(z.string()),
39
39
  }),
40
40
  ),
41
+ module: z.optional(z.string()),
41
42
  import: z.optional(z.string()),
43
+ require: z.optional(z.string()),
42
44
  default: z.string(),
43
45
  }),
44
46
  ]),
@@ -164,7 +164,7 @@ export function resolveBuildTasks(ctx: BuildContext): BuildTask[] {
164
164
  exp.node &&
165
165
  !exp.node.source &&
166
166
  exp.node.import &&
167
- exp.node.require &&
167
+ (exp.node.require || exp.require) &&
168
168
  (exp.node.import.endsWith('.cjs.js') || exp.node.import.endsWith('.cjs.mjs'))
169
169
  ) {
170
170
  const importId = path.join(pkg.name, exp._path)
@@ -172,7 +172,7 @@ export function resolveBuildTasks(ctx: BuildContext): BuildTask[] {
172
172
  nodeReexportCjsEntries.push({
173
173
  importId,
174
174
  import: exp.node.import,
175
- require: exp.node.require,
175
+ require: (exp.node.require || exp.require)!,
176
176
  })
177
177
  }
178
178
  }
@@ -8,6 +8,7 @@ import terser from '@rollup/plugin-terser'
8
8
  import path from 'path'
9
9
  import {InputOptions, OutputOptions, Plugin} from 'rollup'
10
10
  import esbuild from 'rollup-plugin-esbuild'
11
+ import preserveDirectives from 'rollup-plugin-preserve-directives'
11
12
 
12
13
  import {BuildContext, DEFAULT_BROWSERSLIST_QUERY, resolveConfigProperty} from '../../core'
13
14
  import {RollupTask, RollupWatchTask} from '../types'
@@ -111,10 +112,12 @@ export function resolveRollupConfig(
111
112
  }),
112
113
  minify &&
113
114
  terser({
114
- compress: {
115
- // Needed until https://github.com/terser/terser/issues/1320 is fixed
116
- directives: false,
117
- },
115
+ compress: config?.preserveModuleDirectives
116
+ ? {
117
+ // Needed until https://github.com/terser/terser/issues/1320 is fixed
118
+ directives: false,
119
+ }
120
+ : true,
118
121
  output: {
119
122
  comments: (_node, comment) => {
120
123
  const text = comment.value
@@ -130,6 +133,8 @@ export function resolveRollupConfig(
130
133
  },
131
134
  },
132
135
  }),
136
+ // Allows marking export files with `'use client'` at the top
137
+ config?.preserveModuleDirectives && preserveDirectives(),
133
138
  ].filter(Boolean) as Plugin[]
134
139
 
135
140
  const userPlugins = config?.rollup?.plugins
@@ -212,6 +217,7 @@ export function resolveRollupConfig(
212
217
  minifyInternalExports: minify,
213
218
  sourcemap: config?.sourcemap ?? true,
214
219
  hoistTransitiveImports: false,
220
+ preserveModules: config?.preserveModuleDirectives ? true : false,
215
221
  },
216
222
  }
217
223
  }
@@ -114,6 +114,26 @@ async function execPromise(ctx: BuildContext, task: RollupTask) {
114
114
  const bundle = await rollup({
115
115
  ...inputOptions,
116
116
  onwarn(warning) {
117
+ if (
118
+ // Ignore the directive warning until the preserveDirectives plugin does it automatically: https://github.com/Ephem/rollup-plugin-preserve-directives#rollup-plugin-preserve-directives-warning
119
+ warning.message.includes(
120
+ 'Module level directives cause errors when bundled, "use client" in',
121
+ )
122
+ ) {
123
+ // If the preserve option isn't enabled, then extend the message with a note about how to enable
124
+ if (!ctx.config?.preserveModuleDirectives) {
125
+ consoleSpy.messages.push({
126
+ type: 'warn',
127
+ code: warning.code,
128
+ args: [
129
+ `${warning.message} You can preserve it by setting "preserveModuleDirectives: true" in your "package.config.ts"`,
130
+ ],
131
+ })
132
+ }
133
+
134
+ return
135
+ }
136
+
117
137
  consoleSpy.messages.push({
118
138
  type: 'warn',
119
139
  code: warning.code,
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-11470607.cjs","sources":["../../src/node/resolveBuildTasks.ts","../../src/node/spinner.ts","../../src/node/build.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\n\nimport {BuildContext, PkgExport, PkgFormat, PkgRuntime} from './core'\nimport {BuildTask, DtsTask, NodeReExportFromCJSTask, RollupTask, RollupTaskEntry} from './tasks'\n\n/** @internal */\nexport function resolveBuildTasks(ctx: BuildContext): BuildTask[] {\n const {config, cwd, pkg, target} = ctx\n\n const bundles = config?.bundles || []\n\n const tasks: BuildTask[] = []\n\n const exports = Object.entries(ctx.exports || {}).map(\n ([_path, exp]) => ({_path, ...exp}) as PkgExport & {_path: string},\n )\n\n const dtsTask: DtsTask = {\n type: 'build:dts',\n entries: [],\n }\n\n const rollupTasks: Record<string, RollupTask> = {}\n\n function addRollupTaskEntry(format: PkgFormat, runtime: PkgRuntime, entry: RollupTaskEntry) {\n const buildId = `${format}:${runtime}`\n\n if (rollupTasks[buildId]) {\n rollupTasks[buildId].entries.push(entry)\n } else {\n rollupTasks[buildId] = {\n type: 'build:js',\n buildId,\n entries: [entry],\n runtime,\n format,\n target: target[runtime],\n }\n }\n }\n\n // Parse `dts` tasks\n for (const exp of exports) {\n const importId = path.join(pkg.name, exp._path)\n\n if (exp.types) {\n dtsTask.entries.push({\n importId,\n exportPath: exp._path,\n sourcePath: exp.source,\n targetPath: exp.types,\n })\n }\n }\n\n // Add dts task\n if (dtsTask.entries.length) {\n tasks.push(dtsTask)\n }\n\n if (!ctx.emitDeclarationOnly) {\n // Parse rollup:commonjs:* tasks\n for (const exp of exports) {\n const output = exp.require\n\n if (!output) continue\n\n addRollupTaskEntry('commonjs', ctx.runtime, {\n path: exp._path,\n source: exp.source,\n output,\n })\n }\n\n // Parse rollup:esm:* tasks\n for (const exp of exports) {\n const output = exp.import\n\n if (!output) continue\n\n addRollupTaskEntry('esm', ctx.runtime, {\n path: exp._path,\n source: exp.source,\n output,\n })\n }\n\n // Parse rollup:commonjs:browser tasks\n for (const exp of exports) {\n const output = exp.browser?.require\n\n if (!output) continue\n\n addRollupTaskEntry('commonjs', 'browser', {\n path: exp._path,\n source: exp.browser?.source || exp.source,\n output,\n })\n }\n\n // Parse rollup:esm:browser tasks\n for (const exp of exports) {\n const output = exp.browser?.import\n\n if (!output) continue\n\n addRollupTaskEntry('esm', 'browser', {\n path: exp._path,\n source: exp.browser?.source || exp.source,\n output,\n })\n }\n\n for (const bundle of bundles) {\n const idx = bundles.indexOf(bundle)\n\n if (bundle.require) {\n addRollupTaskEntry('commonjs', bundle.runtime || ctx.runtime, {\n path: `__$$bundle_cjs_${idx}$$__`,\n source: bundle.source,\n output: bundle.require,\n })\n }\n\n if (bundle.import) {\n addRollupTaskEntry('esm', bundle.runtime || ctx.runtime, {\n path: `__$$bundle_esm_${idx}$$__`,\n source: bundle.source,\n output: bundle.import,\n })\n }\n }\n\n tasks.push(...Object.values(rollupTasks))\n\n // Write legacy exports files\n if (config?.legacyExports) {\n for (const exp of exports) {\n if (exp._exported && exp._path !== '.') {\n const relativeTargetPath = (exp.browser?.import || exp.import || '').replace(\n /\\.[^/.]+$/,\n '',\n )\n\n if (relativeTargetPath) {\n fs.writeFileSync(\n path.resolve(cwd, `${exp._path}.js`),\n [`// AUTO-GENERATED – DO NOT EDIT`, `export * from '${relativeTargetPath}'`, ``].join(\n '\\n',\n ),\n )\n }\n }\n }\n }\n }\n\n const nodeReexportCjsEntries: NodeReExportFromCJSTask['entries'] = []\n\n // Parse tasks to re-export from CommonJS for Node.js\n for (const exp of exports) {\n if (\n exp.node &&\n !exp.node.source &&\n exp.node.import &&\n exp.node.require &&\n (exp.node.import.endsWith('.cjs.js') || exp.node.import.endsWith('.cjs.mjs'))\n ) {\n const importId = path.join(pkg.name, exp._path)\n\n nodeReexportCjsEntries.push({\n importId,\n import: exp.node.import,\n require: exp.node.require,\n })\n }\n }\n\n if (nodeReexportCjsEntries.length) {\n tasks.push({\n type: 'node:reexport-cjs',\n entries: nodeReexportCjsEntries,\n })\n }\n\n return tasks\n}\n","/* eslint-disable no-console */\n\nimport chalk from 'chalk'\n\nexport function createSpinner(msg: string): {complete: () => void; error: () => void} {\n const startTime = Date.now()\n\n console.log(msg)\n\n return {\n complete: () => {\n console.log(`${chalk.green('[success]')} ${chalk.gray(`${Date.now() - startTime}ms`)}`)\n },\n error: () => {\n console.log(`${chalk.red(`[error]`)} ${chalk.gray(`${Date.now() - startTime}ms`)}`)\n },\n }\n}\n","import {getPkgExtMap, loadConfig, loadPkgWithReporting} from './core'\nimport {createLogger} from './logger'\nimport {resolveBuildContext} from './resolveBuildContext'\nimport {resolveBuildTasks} from './resolveBuildTasks'\nimport {createSpinner} from './spinner'\nimport {BuildTask, buildTaskHandlers, TaskHandler} from './tasks'\n\n/**\n * Build the distribution files of a npm package.\n *\n * @example\n * ```ts\n * import {build} from '@sanity/pkg-utils'\n *\n * build({\n * cwd: process.cwd(),\n * tsconfig: 'tsconfig.dist.json,\n * }).then(() => {\n * console.log('successfully built')\n * }).catch((err) => {\n * console.log(`build error: ${err.message}`)\n * })\n * ```\n *\n * @public\n */\nexport async function build(options: {\n cwd: string\n emitDeclarationOnly?: boolean\n strict?: boolean\n tsconfig?: string\n}): Promise<void> {\n const {cwd, emitDeclarationOnly, strict = false, tsconfig: tsconfigOption} = options\n const logger = createLogger()\n\n const pkg = await loadPkgWithReporting({cwd, logger})\n const config = await loadConfig({cwd})\n const extMap = getPkgExtMap({legacyExports: config?.legacyExports ?? false})\n const tsconfig = tsconfigOption || config?.tsconfig || 'tsconfig.json'\n\n const ctx = await resolveBuildContext({\n config,\n cwd,\n emitDeclarationOnly,\n extMap,\n logger,\n pkg,\n strict,\n tsconfig,\n })\n\n const buildTasks = resolveBuildTasks(ctx)\n\n for (const task of buildTasks) {\n const handler = buildTaskHandlers[task.type] as TaskHandler<BuildTask>\n const taskName = handler.name(ctx, task)\n\n const spinner = createSpinner(taskName)\n\n try {\n const result = await handler.exec(ctx, task).toPromise()\n\n spinner.complete()\n ctx.logger.log()\n\n handler.complete(ctx, task, result)\n } catch (err) {\n spinner.error()\n\n if (err instanceof Error) {\n const RE_CWD = new RegExp(`${cwd}`, 'g')\n\n ctx.logger.error(err.message.replace(RE_CWD, '.'))\n ctx.logger.log()\n }\n\n handler.error(ctx, task, err)\n\n process.exit(1)\n }\n }\n}\n"],"names":["resolveBuildTasks","ctx","_a","_b","_c","_d","_e","config","cwd","pkg","target","bundles","tasks","exports","Object","entries","map","_ref","_path","exp","dtsTask","type","rollupTasks","addRollupTaskEntry","format","runtime","entry","buildId","concat","push","importId","path","join","name","types","exportPath","sourcePath","source","targetPath","length","emitDeclarationOnly","output","require","import","browser","bundle","idx","indexOf","values","legacyExports","_exported","relativeTargetPath","replace","fs","writeFileSync","resolve","nodeReexportCjsEntries","node","endsWith","createSpinner","msg","startTime","Date","now","console","log","complete","chalk","green","default","gray","error","red","build","options","_ref2","strict","tsconfig","tsconfigOption","logger","createLogger","loadPkgWithReporting","loadConfig","extMap","getPkgExtMap","resolveBuildContext","buildTasks","task","handler","buildTaskHandlers","taskName","spinner","result","exec","toPromise","err","Error","RE_CWD","RegExp","message","process","exit"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOO,SAASA,kBAAkBC,GAAgC,EAAA;EAPlE,IAAAC,EAAA,EAAAC,EAAA,EAAAC,EAAA,EAAAC,EAAA,EAAAC,EAAA;EAQE,MA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AwB,GAAA,CAAII,QAAQ/C,OAAQ,CAAA6C,MAAA,EAAQ,GAAG,CAAC,CAAA;QACjDhG,GAAA,CAAI8E,OAAOd,GAAI,EAAA;MACjB;MAEQuB,OAAA,CAAAjB,KAAA,CAAMtE,GAAK,EAAAsF,IAAA,EAAMQ,GAAG,CAAA;MAE5BK,OAAA,CAAQC,KAAK,CAAC,CAAA;IAChB;EACF;AACF;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"consoleSpy-d738cb9f.cjs","sources":["../../src/node/core/config/findConfigFile.ts","../../src/node/core/config/loadConfig.ts","../../src/node/core/config/resolveConfigProperty.ts","../../src/node/core/defaults.ts","../../src/node/core/pkg/loadPkg.ts","../../src/node/core/pkg/helpers.ts","../../src/node/core/pkg/loadPkgWithReporting.ts","../../src/node/core/pkg/validateExports.ts","../../src/node/core/pkg/parseExports.ts","../../src/node/core/pkg/pkgExt.ts","../../src/node/core/ts/loadTSConfig.ts","../../src/node/core/findCommonPath.ts","../../src/node/resolveBrowserslistVersions.ts","../../src/node/resolveBrowserTarget.ts","../../src/node/resolveNodeTarget.ts","../../src/node/resolveBuildContext.ts","../../src/node/consoleSpy.ts"],"sourcesContent":["import findConfig from 'find-config'\nimport path from 'path'\n\nimport {fileExists} from '../../fileExists'\n\nconst CONFIG_FILE_NAMES = [\n 'package.config.ts',\n 'package.config.js',\n 'package.config.cjs',\n 'package.config.mjs',\n]\n\n/** @internal */\nexport function findConfigFile(cwd: string): string | undefined {\n const pkgJsonPath = findConfig('package.json', {cwd})\n\n if (!pkgJsonPath) return undefined\n\n const pkgPath = path.dirname(pkgJsonPath)\n\n for (const fileName of CONFIG_FILE_NAMES) {\n const configPath = path.resolve(pkgPath, fileName)\n\n const exists = fileExists(configPath)\n\n if (exists) {\n return configPath\n }\n }\n\n return undefined\n}\n","import {register} from 'esbuild-register/dist/node'\nimport path from 'path'\nimport pkgUp from 'pkg-up'\n\nimport {findConfigFile} from './findConfigFile'\nimport {PkgConfigOptions} from './types'\n\n/** @internal */\nexport async function loadConfig(options: {cwd: string}): Promise<PkgConfigOptions | undefined> {\n const {cwd} = options\n\n const pkgPath = await pkgUp({cwd})\n\n if (!pkgPath) return undefined\n\n const root = path.dirname(pkgPath)\n\n const configFile = await findConfigFile(root)\n\n if (!configFile) {\n return undefined\n }\n\n // Do not accept config files outside of the root\n if (!configFile.startsWith(cwd)) {\n return undefined\n }\n\n const esbuildOptions = {extensions: ['.js', '.mjs', '.ts']}\n\n const {unregister} = globalThis.__DEV__ ? {unregister: () => undefined} : register(esbuildOptions)\n\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const mod = require(configFile)\n\n unregister()\n\n return mod?.default || mod || undefined\n}\n","import {PkgConfigProperty, PkgConfigPropertyResolver} from './types'\n\n/** @internal */\nexport function resolveConfigProperty<T>(\n prop: PkgConfigProperty<T> | undefined,\n initialValue: T,\n): T {\n if (!prop) return initialValue\n\n if (typeof prop === 'function') {\n return (prop as PkgConfigPropertyResolver<T>)(initialValue)\n }\n\n return prop\n}\n","/** @public */\nexport const DEFAULT_BROWSERSLIST_QUERY = [\n '> 0.2% and supports es6-module and supports es6-module-dynamic-import',\n 'not dead',\n 'not IE 11',\n 'maintained node versions',\n]\n","import fs from 'fs/promises'\nimport pkgUp from 'pkg-up'\n\nimport {PackageJSON} from './types'\nimport {validatePkg} from './validatePkg'\n\n/** @internal */\nexport async function loadPkg(options: {cwd: string}): Promise<PackageJSON> {\n const {cwd} = options\n\n const pkgPath = await pkgUp({cwd})\n\n if (!pkgPath) throw new Error('no package.json found')\n\n const buf = await fs.readFile(pkgPath)\n\n const raw = JSON.parse(buf.toString())\n\n validatePkg(raw)\n\n return raw\n}\n","/** @internal */\nexport function assertFirst<T>(a: T, arr: T[]): boolean {\n const aIdx = arr.indexOf(a)\n\n // if not found, then we don't care\n if (aIdx === -1) {\n return true\n }\n\n return aIdx === 0\n}\n\n/** @internal */\nexport function assertLast<T>(a: T, arr: T[]): boolean {\n const aIdx = arr.indexOf(a)\n\n // if not found, then we don't care\n if (aIdx === -1) {\n return true\n }\n\n return aIdx === arr.length - 1\n}\n\n/** @internal */\nexport function assertOrder<T>(a: T, b: T, arr: T[]): boolean {\n const aIdx = arr.indexOf(a)\n const bIdx = arr.indexOf(b)\n\n // if either is not found, then we don't care\n if (aIdx === -1 || bIdx === -1) {\n return true\n }\n\n return aIdx < bIdx\n}\n","import chalk from 'chalk'\nimport {ZodError} from 'zod'\n\nimport {Logger} from '../../logger'\nimport {assertFirst, assertLast, assertOrder} from './helpers'\nimport {loadPkg} from './loadPkg'\nimport {PackageJSON} from './types'\n\n/** @internal */\nexport async function loadPkgWithReporting(options: {\n cwd: string\n logger: Logger\n}): Promise<PackageJSON> {\n const {cwd, logger} = options\n\n try {\n const pkg = await loadPkg({cwd})\n\n // validate exports\n if (pkg.exports) {\n const _exports = Object.entries(pkg.exports)\n\n for (const [expPath, exp] of _exports) {\n if (typeof exp === 'string') {\n continue\n }\n\n const keys = Object.keys(exp)\n\n if (!assertFirst('types', keys)) {\n logger.warn(`exports[\"${expPath}\"]: the \\`types\\` property should be the first property`)\n }\n\n if (!assertOrder('require', 'import', keys)) {\n logger.warn(\n `exports[\"${expPath}\"]: the \\`require\\` property should come before the \\`import\\` property`,\n )\n }\n\n if (!assertOrder('require', 'node', keys)) {\n logger.warn(\n `exports[\"${expPath}\"]: the \\`require\\` property should come before the \\`node\\` property`,\n )\n }\n\n if (!assertOrder('node', 'import', keys)) {\n logger.warn(\n `exports[\"${expPath}\"]: the \\`node\\` property should come before \\`import\\` property`,\n )\n }\n\n if (!assertLast('default', keys)) {\n logger.warn(`exports[\"${expPath}\"]: the \\`default\\` property should be the last property`)\n }\n }\n }\n\n return pkg\n } catch (err) {\n if (err instanceof ZodError) {\n for (const issue of err.issues) {\n if (issue.code === 'invalid_type') {\n logger.error(\n [\n `\\`${formatPath(issue.path)}\\` `,\n `in \\`./package.json\\` must be of type ${chalk.magenta(issue.expected)} `,\n `(received ${chalk.magenta(issue.received)})`,\n ].join(''),\n )\n continue\n }\n\n logger.error(issue)\n }\n } else {\n logger.error(err)\n }\n\n process.exit(1)\n }\n}\n\nfunction formatPath(segments: Array<string | number>) {\n return segments\n .map((s, idx) => {\n if (idx === 0) return s\n\n if (typeof s === 'number') {\n return `[${s}]`\n }\n\n if (s.startsWith('.')) {\n return `[\"${s}\"]`\n }\n\n return `.${s}`\n })\n .join('')\n}\n","import {PkgExport} from '../config'\nimport {PkgExtMap} from './pkgExt'\nimport {PackageJSON} from './types'\n\nexport function validateExports(\n _exports: (PkgExport & {_path: string})[],\n options: {extMap: PkgExtMap; pkg: PackageJSON},\n): string[] {\n const {extMap, pkg} = options\n const ext = extMap[pkg.type || 'commonjs']\n\n const errors: string[] = []\n\n for (const exp of _exports) {\n if (exp.require && !exp.require.endsWith(ext.commonjs)) {\n errors.push(\n `package.json with \\`type: \"${pkg.type}\"\\` - \\`exports[\"${exp._path}\"].require\\` must end with \"${ext.commonjs}\"`,\n )\n }\n\n if (exp.import && !exp.import.endsWith(ext.esm)) {\n errors.push(\n `package.json with \\`type: \"${pkg.type}\"\\` - \\`exports[\"${exp._path}\"].import\\` must end with \"${ext.esm}\"`,\n )\n }\n }\n\n return errors\n}\n","import {PkgExport} from '../config'\nimport {isRecord} from '../isRecord'\nimport {PkgExtMap} from './pkgExt'\nimport {PackageJSON} from './types'\nimport {validateExports} from './validateExports'\n\n/** @internal */\nexport function parseExports(options: {\n extMap: PkgExtMap\n pkg: PackageJSON\n strict: boolean\n}): (PkgExport & {_path: string})[] {\n const {extMap, pkg, strict} = options\n\n const rootExport: PkgExport & {_path: string} = {\n _exported: true,\n _path: '.',\n types: pkg.types,\n source: pkg.source || '',\n browser: pkg.browser && {\n source: pkg.source || '',\n require: pkg.main && pkg.browser[pkg.main],\n import: pkg.module && pkg.browser[pkg.module],\n },\n require: pkg.main,\n import: pkg.module,\n default: pkg.module || pkg.main || '',\n }\n\n const extraExports: (PkgExport & {_path: string})[] = []\n\n const errors: string[] = []\n\n if (pkg.exports) {\n if (strict && !pkg.exports['./package.json']) {\n errors.push('package.json: `exports[\"./package.json\"] must be declared.')\n }\n\n for (const [exportPath, exportEntry] of Object.entries(pkg.exports)) {\n if (exportPath.endsWith('.json')) {\n if (exportPath === './package.json') {\n if (exportEntry !== './package.json') {\n errors.push('package.json: `exports[\"./package.json\"] must be \"./package.json\".')\n }\n }\n } else if (isRecord(exportEntry)) {\n if (exportPath === '.') {\n if (\n exportEntry.require &&\n rootExport.require &&\n exportEntry.require !== rootExport.require\n ) {\n errors.push(\n 'package.json: mismatch between \"main\" and \"exports.require\". These must be equal.',\n )\n }\n\n if (exportEntry.import && rootExport.import && exportEntry.import !== rootExport.import) {\n errors.push(\n 'package.json: mismatch between \"module\" and \"exports.import\" These must be equal.',\n )\n }\n\n if (exportEntry.types && rootExport.types && exportEntry.types !== rootExport.types) {\n errors.push(\n 'package.json: mismatch between \"types\" and \"exports.types\". These must be equal.',\n )\n }\n\n if (exportEntry.source && rootExport.source && exportEntry.source !== rootExport.source) {\n errors.push(\n 'package.json: mismatch between \"source\" and \"exports.source\". These must be equal.',\n )\n }\n\n Object.assign(rootExport, exportEntry)\n } else {\n const extraExport: PkgExport & {_path: string} = {\n _exported: true,\n _path: exportPath,\n ...exportEntry,\n }\n\n extraExports.push(extraExport)\n }\n } else {\n errors.push('package.json: exports must be an object')\n }\n }\n }\n\n const _exports = [rootExport, ...extraExports]\n\n errors.push(...validateExports(_exports, {extMap, pkg}))\n\n if (errors.length) {\n throw new Error('\\n- ' + errors.join('\\n- '))\n }\n\n return _exports\n}\n","/** @internal */\nexport interface PkgExtMap {\n commonjs: {commonjs: string; esm: string}\n module: {commonjs: string; esm: string}\n}\n\n/** @internal */\nexport const DEFAULT_PKG_EXT_MAP: PkgExtMap = {\n // pkg.type: \"commonjs\"\n commonjs: {\n commonjs: '.js',\n esm: '.mjs',\n },\n\n // pkg.type: \"module\"\n module: {\n commonjs: '.cjs',\n esm: '.js',\n },\n}\n\n/** @internal */\nexport function getPkgExtMap(options: {legacyExports: boolean}): PkgExtMap {\n const {legacyExports} = options\n\n const ret = {...DEFAULT_PKG_EXT_MAP}\n\n // Fall back to legacy file extensions for package.json with `\"type\": \"commonjs\"`\n // NOTE: Not supported by Node 14+ and will be removed in a future version\n if (legacyExports) {\n ret['commonjs'] = {\n commonjs: '.js',\n esm: '.esm.js',\n }\n }\n\n return ret\n}\n","import ts from 'typescript'\n\n/** @internal */\nexport async function loadTSConfig(options: {\n cwd: string\n tsconfigPath: string\n}): Promise<ts.ParsedCommandLine> {\n const {cwd, tsconfigPath} = options\n\n const configPath = ts.findConfigFile(cwd, ts.sys.fileExists, tsconfigPath)\n\n if (!configPath) {\n throw new Error(`could not find a valid '${tsconfigPath}'`)\n }\n\n const configFile = ts.readConfigFile(configPath, ts.sys.readFile)\n\n return ts.parseJsonConfigFileContent(configFile.config, ts.sys, cwd)\n}\n","import path from 'path'\n\nexport function pathContains(containerPath: string, itemPath: string): boolean {\n return !path.relative(containerPath, itemPath).startsWith('..')\n}\n\nexport function findCommonDirPath(filePaths: string[]): string | undefined {\n let ret: string | undefined = undefined\n\n for (const filePath of filePaths) {\n let dirPath = path.dirname(filePath)\n\n if (!ret) {\n ret = dirPath\n continue\n }\n\n while (dirPath !== ret) {\n dirPath = path.dirname(dirPath)\n\n if (dirPath === ret) {\n break\n }\n\n if (pathContains(dirPath, ret)) {\n ret = dirPath\n break\n }\n\n if (dirPath === '.') return undefined\n }\n }\n\n return ret\n}\n","import browserslist from 'browserslist'\n\nexport interface PackageTargetVersions {\n chrome: string[]\n ff: string[]\n edge: string[]\n iosSaf: string[]\n saf: string[]\n opera: string[]\n node: string[]\n}\n\nfunction sortAsNumber(a: string, b: string) {\n const aVersion = Number(a)\n const bVersion = Number(b)\n\n return aVersion - bVersion\n}\n\nexport function resolveBrowserslistVersions(query: string[]): PackageTargetVersions {\n const result = browserslist(query)\n\n const entries = result.map((key) => {\n const [name, version] = key.split(' ')\n\n return {name, version: version.split('-')[0].split('.')[0]}\n })\n\n const andChr = entries.filter((b) => b.name === 'and_chr')\n const andFf = entries.filter((b) => b.name === 'and_ff')\n const chrome = entries.filter((b) => b.name === 'chrome')\n const edge = entries.filter((b) => b.name === 'edge')\n const ff = entries.filter((b) => b.name === 'firefox')\n const iosSaf = entries.filter((b) => b.name === 'ios_saf')\n const saf = entries.filter((b) => b.name === 'safari')\n const opera = entries.filter((b) => b.name === 'opera')\n const node = entries.filter((b) => b.name === 'node')\n\n // versions\n const versions: PackageTargetVersions = {\n chrome: andChr.concat(chrome).map((b) => b.version),\n ff: andFf.concat(ff).map((b) => b.version),\n edge: edge.map((b) => b.version),\n iosSaf: iosSaf.map((b) => b.version),\n saf: saf.map((b) => b.version),\n opera: opera.map((b) => b.version),\n node: node.map((b) => b.version),\n }\n\n // sort\n versions.chrome.sort(sortAsNumber)\n versions.ff.sort(sortAsNumber)\n versions.edge.sort(sortAsNumber)\n versions.iosSaf.sort(sortAsNumber)\n versions.saf.sort(sortAsNumber)\n versions.opera.sort(sortAsNumber)\n versions.node.sort(sortAsNumber)\n\n return versions\n}\n","import {PackageTargetVersions} from './resolveBrowserslistVersions'\n\nexport function resolveBrowserTarget(versions: PackageTargetVersions): string[] | undefined {\n const target: string[] = []\n\n if (versions.chrome.length) {\n target.push(`chrome${versions.chrome[0]}`)\n }\n\n if (versions.ff.length) {\n target.push(`firefox${versions.ff[0]}`)\n }\n\n if (versions.edge.length) {\n target.push(`edge${versions.edge[0]}`)\n }\n\n if (versions.iosSaf.length) {\n target.push(`ios${versions.iosSaf[0]}`)\n }\n\n if (versions.saf.length) {\n target.push(`safari${versions.saf[0]}`)\n }\n\n if (versions.opera.length) {\n target.push(`opera${versions.opera[0]}`)\n }\n\n if (target.length === 0) {\n return undefined\n }\n\n return target\n}\n","import {PackageTargetVersions} from './resolveBrowserslistVersions'\n\nexport function resolveNodeTarget(versions: PackageTargetVersions): string[] | undefined {\n const target: string[] = []\n\n if (versions.node.length) {\n target.push(`node${versions.node[0]}`)\n }\n\n if (target.length === 0) {\n return undefined\n }\n\n return target\n}\n","import path from 'path'\n\nimport {\n BuildContext,\n DEFAULT_BROWSERSLIST_QUERY,\n loadTSConfig,\n PackageJSON,\n parseExports,\n PkgConfigOptions,\n PkgExports,\n PkgExtMap,\n PkgRuntime,\n resolveConfigProperty,\n} from './core'\nimport {findCommonDirPath, pathContains} from './core/findCommonPath'\nimport {Logger} from './logger'\nimport {resolveBrowserslistVersions} from './resolveBrowserslistVersions'\nimport {resolveBrowserTarget} from './resolveBrowserTarget'\nimport {resolveNodeTarget} from './resolveNodeTarget'\n\nexport async function resolveBuildContext(options: {\n config?: PkgConfigOptions\n cwd: string\n emitDeclarationOnly?: boolean\n extMap: PkgExtMap\n logger: Logger\n pkg: PackageJSON\n strict: boolean\n tsconfig: string\n}): Promise<BuildContext> {\n const {\n config,\n cwd,\n emitDeclarationOnly = false,\n extMap,\n logger,\n pkg,\n strict,\n tsconfig: tsconfigPath,\n } = options\n const tsconfig = await loadTSConfig({cwd, tsconfigPath})\n const targetVersions = resolveBrowserslistVersions(pkg.browserslist || DEFAULT_BROWSERSLIST_QUERY)\n const nodeTarget = resolveNodeTarget(targetVersions)\n const webTarget = resolveBrowserTarget(targetVersions)\n\n if (!nodeTarget) {\n throw new Error('no matching `node` target')\n }\n\n if (!webTarget) {\n throw new Error('no matching `web` target')\n }\n\n const target: Record<PkgRuntime, string[]> = {\n '*': webTarget.concat(nodeTarget),\n browser: webTarget,\n node: nodeTarget,\n }\n\n const parsedExports = parseExports({extMap, pkg, strict}).reduce<PkgExports>((acc, x) => {\n const {_path: exportPath, ...exportEntry} = x\n\n return {...acc, [exportPath]: exportEntry}\n }, {})\n\n const exports = resolveConfigProperty(config?.exports, parsedExports)\n\n const parsedExternal = [\n ...(pkg.dependencies ? Object.keys(pkg.dependencies) : []),\n ...(pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : []),\n ]\n\n // Merge externals if an array is provided, replace if it's a function\n const external =\n config && Array.isArray(config.external)\n ? [...parsedExternal, ...config.external]\n : resolveConfigProperty(config?.external, parsedExternal)\n\n const outputPaths = Object.values(exports)\n .flatMap((exportEntry) => {\n return [\n exportEntry.import,\n exportEntry.require,\n exportEntry.browser?.import,\n exportEntry.browser?.require,\n exportEntry.node?.source && exportEntry.node.import,\n exportEntry.node?.source && exportEntry.node.require,\n ].filter(Boolean) as string[]\n })\n .map((p) => path.resolve(cwd, p))\n\n const commonDistPath = findCommonDirPath(outputPaths)\n\n if (commonDistPath === cwd) {\n throw new Error(\n 'all output files must share a common parent directory which is not the root package directory',\n )\n }\n\n if (commonDistPath && !pathContains(cwd, commonDistPath)) {\n throw new Error('all output files must be located within the package')\n }\n\n const configDistPath = config?.dist ? path.resolve(cwd, config.dist) : undefined\n\n if (\n configDistPath &&\n commonDistPath &&\n configDistPath !== commonDistPath &&\n !pathContains(configDistPath, commonDistPath)\n ) {\n logger.log(`did you mean to configure \\`dist: './${path.relative(cwd, commonDistPath)}'\\`?`)\n\n throw new Error('all output files must be located with the configured `dist` path')\n }\n\n const distPath = configDistPath || commonDistPath\n\n if (!distPath) {\n throw new Error('could not detect `dist` path')\n }\n\n const ctx: BuildContext = {\n config,\n cwd,\n distPath,\n emitDeclarationOnly,\n exports,\n external,\n extMap,\n files: [],\n logger,\n pkg,\n runtime: config?.runtime ?? '*',\n strict,\n target,\n ts: {\n config: tsconfig,\n configPath: tsconfigPath,\n },\n }\n\n return ctx\n}\n","/* eslint-disable no-console */\n\nexport interface ConsoleSpyMsg {\n type: 'log' | 'warn' | 'error'\n code?: string\n args: unknown[]\n}\n\nexport interface ConsoleSpy {\n messages: ConsoleSpyMsg[]\n restore: () => void\n}\n\nexport function createConsoleSpy(options?: {\n onRestored?: (messages: ConsoleSpyMsg[]) => void\n}): ConsoleSpy {\n const {onRestored} = options || {}\n\n const original = {\n log: console.log,\n warn: console.warn,\n error: console.error,\n }\n\n const messages: ConsoleSpyMsg[] = []\n\n console.log = (...args: unknown[]) => messages.push({type: 'log', args})\n console.warn = (...args: unknown[]) => messages.push({type: 'warn', args})\n console.error = (...args: unknown[]) => messages.push({type: 'error', args})\n\n return {\n messages,\n restore: () => {\n console.log = original.log\n console.warn = original.warn\n console.error = original.error\n\n onRestored?.(messages)\n },\n }\n}\n"],"names":["CONFIG_FILE_NAMES","findConfigFile","cwd","pkgJsonPath","findConfig","default","pkgPath","path","dirname","fileName","configPath","resolve","exists","fileExists","loadConfig","options","pkgUp","root","configFile","startsWith","esbuildOptions","extensions","unregister","globalThis","__DEV__","register","mod","require","resolveConfigProperty","prop","initialValue","DEFAULT_BROWSERSLIST_QUERY","loadPkg","Error","buf","fs","readFile","raw","JSON","parse","toString","validatePkg","assertFirst","a","arr","aIdx","indexOf","assertLast","length","assertOrder","b","bIdx","loadPkgWithReporting","logger","pkg","exports","_exports","Object","entries","expPath","exp","keys","warn","concat","err","ZodError","issue","issues","code","error","formatPath","chalk","magenta","expected","received","join","process","exit","segments","map","s","idx","validateExports","extMap","ext","type","errors","endsWith","commonjs","push","_path","import","esm","parseExports","strict","rootExport","_exported","types","source","browser","main","module","extraExports","exportPath","exportEntry","isRecord","assign","extraExport","DEFAULT_PKG_EXT_MAP","getPkgExtMap","legacyExports","ret","loadTSConfig","tsconfigPath","ts","sys","readConfigFile","parseJsonConfigFileContent","config","pathContains","containerPath","itemPath","relative","findCommonDirPath","filePaths","filePath","dirPath","sortAsNumber","aVersion","Number","bVersion","resolveBrowserslistVersions","query","result","browserslist","key","name","version","split","andChr","filter","andFf","chrome","edge","ff","iosSaf","saf","opera","node","versions","sort","resolveBrowserTarget","target","resolveNodeTarget","resolveBuildContext","_ref","emitDeclarationOnly","tsconfig","targetVersions","nodeTarget","webTarget","parsedExports","reduce","acc","x","parsedExternal","dependencies","peerDependencies","external","Array","isArray","outputPaths","values","flatMap","_a","_b","_c","_d","Boolean","p","commonDistPath","configDistPath","dist","log","distPath","ctx","files","runtime","createConsoleSpy","onRestored","original","console","messages","_len","arguments","args","_key","_len2","_key2","_len3","_key3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