@sanity/pkg-utils 7.2.7 → 7.2.8-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 (70) hide show
  1. package/dist/_chunks-cjs/build.cjs +2 -2
  2. package/dist/_chunks-cjs/build.cjs.map +1 -1
  3. package/dist/_chunks-cjs/check.cjs.map +1 -1
  4. package/dist/_chunks-cjs/consoleSpy.cjs +73 -9
  5. package/dist/_chunks-cjs/consoleSpy.cjs.map +1 -1
  6. package/dist/_chunks-cjs/handleError.cjs.map +1 -1
  7. package/dist/_chunks-cjs/index.cjs +36 -21
  8. package/dist/_chunks-cjs/index.cjs.map +1 -1
  9. package/dist/_chunks-cjs/init.cjs +12 -12
  10. package/dist/_chunks-cjs/init.cjs.map +1 -1
  11. package/dist/_chunks-cjs/logger.cjs +1 -71
  12. package/dist/_chunks-cjs/logger.cjs.map +1 -1
  13. package/dist/_chunks-cjs/watch.cjs +17 -2
  14. package/dist/_chunks-cjs/watch.cjs.map +1 -1
  15. package/dist/cli.cjs +2 -6
  16. package/dist/cli.cjs.map +1 -1
  17. package/dist/index.d.cts +5 -8
  18. package/dist/index.d.ts +5 -8
  19. package/dist/index.js +39 -40
  20. package/dist/index.js.map +1 -1
  21. package/package.json +11 -14
  22. package/src/cli/handleError.ts +0 -2
  23. package/src/cli/index.ts +1 -2
  24. package/src/global.ts +0 -1
  25. package/src/node/build.ts +3 -4
  26. package/src/node/check.ts +0 -3
  27. package/src/node/consoleSpy.ts +0 -2
  28. package/src/node/core/config/findConfigFile.ts +0 -2
  29. package/src/node/core/config/index.ts +3 -3
  30. package/src/node/core/config/loadConfig.ts +0 -3
  31. package/src/node/core/config/types.ts +0 -4
  32. package/src/node/core/contexts/buildContext.ts +2 -3
  33. package/src/node/core/pkg/loadPkg.ts +0 -2
  34. package/src/node/core/pkg/loadPkgWithReporting.ts +0 -1
  35. package/src/node/core/pkg/parseExports.ts +1 -2
  36. package/src/node/core/pkg/validateExports.ts +1 -1
  37. package/src/node/core/pkg/validatePkg.ts +0 -1
  38. package/src/node/core/template/createFromTemplate.ts +0 -2
  39. package/src/node/core/template/types.ts +0 -3
  40. package/src/node/getFilesize.ts +0 -1
  41. package/src/node/globFiles.ts +0 -1
  42. package/src/node/index.ts +64 -8
  43. package/src/node/init.ts +1 -3
  44. package/src/node/logger.ts +1 -2
  45. package/src/node/printExtractMessages.ts +1 -3
  46. package/src/node/printPackageTree.ts +2 -5
  47. package/src/node/resolveBuildContext.ts +12 -23
  48. package/src/node/resolveBuildTasks.ts +4 -3
  49. package/src/node/resolveWatchTasks.ts +4 -3
  50. package/src/node/spinner.ts +1 -2
  51. package/src/node/strict.test-d.ts +0 -1
  52. package/src/node/tasks/dts/buildTypes.ts +0 -1
  53. package/src/node/tasks/dts/createApiExtractorConfig.ts +0 -1
  54. package/src/node/tasks/dts/createTSDocConfig.ts +0 -1
  55. package/src/node/tasks/dts/doExtract.ts +2 -4
  56. package/src/node/tasks/dts/dtsTask.ts +0 -1
  57. package/src/node/tasks/dts/dtsWatchTask.ts +1 -3
  58. package/src/node/tasks/dts/extractTypes.ts +3 -4
  59. package/src/node/tasks/dts/getExtractMessagesConfig.ts +1 -2
  60. package/src/node/tasks/dts/getTargetPaths.ts +2 -2
  61. package/src/node/tasks/dts/printDiagnostic.ts +0 -2
  62. package/src/node/tasks/index.ts +4 -2
  63. package/src/node/tasks/rollup/resolveRollupConfig.ts +10 -11
  64. package/src/node/tasks/rollup/rollupTask.ts +1 -4
  65. package/src/node/tasks/rollup/rollupWatchTask.ts +1 -3
  66. package/src/node/tasks/types.ts +3 -3
  67. package/src/node/templates/default/template.ts +20 -23
  68. package/src/node/watch.ts +2 -3
  69. package/src/node/watchConfigFiles.ts +0 -2
  70. package/src/node/watchFiles.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/pkg-utils",
3
- "version": "7.2.7",
3
+ "version": "7.2.8-canary.1",
4
4
  "description": "Simple utilities for modern npm packages.",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -59,13 +59,15 @@
59
59
  ]
60
60
  },
61
61
  "lint-staged": {
62
+ "*.{js,jsx,ts,tsx,mjs,cjs}": [
63
+ "prettier --cache --write",
64
+ "oxlint --fix --quiet"
65
+ ],
62
66
  "*": [
63
- "prettier --write --cache --ignore-unknown",
64
- "eslint --ext .cjs,.js,.ts,.tsx --fix"
67
+ "prettier --write --cache --ignore-unknown"
65
68
  ]
66
69
  },
67
70
  "browserslist": "extends @sanity/browserslist-config",
68
- "prettier": "@sanity/prettier-config",
69
71
  "dependencies": {
70
72
  "@babel/core": "^7.27.4",
71
73
  "@babel/preset-typescript": "^7.27.1",
@@ -111,6 +113,7 @@
111
113
  "devDependencies": {
112
114
  "@commitlint/cli": "^19.8.1",
113
115
  "@commitlint/config-conventional": "^19.8.1",
116
+ "@ianvs/prettier-plugin-sort-imports": "^4.4.2",
114
117
  "@sanity/prettier-config": "^1.0.4",
115
118
  "@types/babel__core": "^7.20.5",
116
119
  "@types/cpx": "^1.5.5",
@@ -122,27 +125,21 @@
122
125
  "@types/semver": "^7.5.8",
123
126
  "@types/treeify": "^1.0.3",
124
127
  "@types/uuid": "^10.0.0",
125
- "@typescript-eslint/eslint-plugin": "^8.34.1",
126
- "@typescript-eslint/parser": "^8.34.1",
127
128
  "browserslist-to-esbuild": "2.1.1",
128
129
  "commitizen": "^4.3.1",
129
130
  "cpx": "^1.5.0",
130
131
  "cz-conventional-changelog": "^3.3.0",
131
- "eslint": "^8.57.1",
132
- "eslint-config-prettier": "^10.1.5",
133
- "eslint-plugin-import": "^2.31.0",
134
- "eslint-plugin-prettier": "^5.5.0",
135
- "eslint-plugin-simple-import-sort": "^12.1.1",
136
132
  "husky": "^8.0.3",
137
133
  "lint-staged": "^15.0.2",
138
134
  "npm-run-all2": "^8.0.4",
139
135
  "outdent": "^0.8.0",
136
+ "oxlint": "^1.1.0",
140
137
  "rollup-plugin-visualizer": "^6.0.3",
141
138
  "semver": "^7.6.0",
142
139
  "ts-node": "^10.9.2",
143
140
  "typescript": "5.8.3",
144
141
  "vitest": "^3.2.4",
145
- "@sanity/pkg-utils": "7.2.7"
142
+ "@sanity/pkg-utils": "7.2.8-canary.1"
146
143
  },
147
144
  "peerDependencies": {
148
145
  "babel-plugin-react-compiler": "*",
@@ -167,8 +164,8 @@
167
164
  "clean": "rimraf dist test/env/__tmp__",
168
165
  "commit": "cz",
169
166
  "extract": "sanity-tsdoc etl --outDir etc/api/@sanity/pkg-utils --tsconfig tsconfig.dist.json",
170
- "format": "prettier --write --cache --ignore-unknown . && eslint . --ext .cjs,.js,.ts,.tsx --fix --quiet",
171
- "lint": "eslint . --ext .cjs,.js,.ts,.tsx",
167
+ "format": "prettier --write --cache --ignore-unknown . && oxlint --fix --quiet",
168
+ "lint": "oxlint",
172
169
  "playground:build": "pnpm --filter './playground/**' build",
173
170
  "playground:clean": "pnpm --filter './playground/**' --silent clean",
174
171
  "pretest": "run-s playground:clean",
@@ -1,5 +1,3 @@
1
- /* eslint-disable no-console */
2
-
3
1
  import chalk from 'chalk'
4
2
 
5
3
  export function handleError(err: unknown): void {
package/src/cli/index.ts CHANGED
@@ -1,5 +1,4 @@
1
- import cac from 'cac'
2
-
1
+ import {cac} from 'cac'
3
2
  import {version} from '../../package.json'
4
3
 
5
4
  const cli = cac()
package/src/global.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  declare global {
2
- // eslint-disable-next-line no-var
3
2
  var __DEV__: boolean
4
3
  }
5
4
 
package/src/node/build.ts CHANGED
@@ -1,13 +1,12 @@
1
1
  import path from 'node:path'
2
-
3
- import rimraf from 'rimraf'
4
-
2
+ import {rimraf} from 'rimraf'
5
3
  import {loadConfig, loadPkgWithReporting} from './core'
6
4
  import {createLogger} from './logger'
7
5
  import {resolveBuildContext} from './resolveBuildContext'
8
6
  import {resolveBuildTasks} from './resolveBuildTasks'
9
7
  import {createSpinner} from './spinner'
10
- import {type BuildTask, buildTaskHandlers, type TaskHandler} from './tasks'
8
+ import {buildTaskHandlers} from './tasks'
9
+ import {type BuildTask, type TaskHandler} from './tasks/types'
11
10
 
12
11
  /**
13
12
  * Build the distribution files of a npm package.
package/src/node/check.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  import path from 'node:path'
2
-
3
2
  import esbuild, {type BuildFailure, type Message} from 'esbuild'
4
-
5
3
  import {createConsoleSpy} from './consoleSpy'
6
4
  import {loadConfig, loadPkgWithReporting} from './core'
7
5
  import {fileExists} from './fileExists'
@@ -120,7 +118,6 @@ async function checkExports(
120
118
  }
121
119
 
122
120
  const esbuildWarnings = esbuildResult.warnings.filter((msg) => {
123
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions
124
121
  !(msg.detail || msg.text).includes(`does not affect esbuild's own target setting`)
125
122
  })
126
123
 
@@ -1,5 +1,3 @@
1
- /* eslint-disable no-console */
2
-
3
1
  export interface ConsoleSpyMsg {
4
2
  type: 'log' | 'warn' | 'error'
5
3
  code?: string
@@ -1,7 +1,5 @@
1
1
  import path from 'node:path'
2
-
3
2
  import findConfig from 'find-config'
4
-
5
3
  import {fileExists} from '../../fileExists'
6
4
 
7
5
  const CONFIG_FILE_NAMES = [
@@ -1,4 +1,4 @@
1
- export * from './defineConfig'
2
- export * from './loadConfig'
3
- export * from './resolveConfigProperty'
1
+ export {defineConfig} from './defineConfig'
2
+ export {loadConfig} from './loadConfig'
3
+ export {resolveConfigProperty} from './resolveConfigProperty'
4
4
  export * from './types'
@@ -1,8 +1,6 @@
1
1
  import path from 'node:path'
2
-
3
2
  import {register} from 'esbuild-register/dist/node'
4
3
  import pkgUp from 'pkg-up'
5
-
6
4
  import {findConfigFile} from './findConfigFile'
7
5
  import type {PkgConfigOptions} from './types'
8
6
 
@@ -31,7 +29,6 @@ export async function loadConfig(options: {cwd: string}): Promise<PkgConfigOptio
31
29
 
32
30
  const {unregister} = globalThis.__DEV__ ? {unregister: () => undefined} : register(esbuildOptions)
33
31
 
34
- // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
35
32
  const mod = require(configFile)
36
33
 
37
34
  unregister()
@@ -1,12 +1,8 @@
1
1
  import type {PluginItem as BabelPluginItem} from '@babel/core'
2
2
  import type {OptimizeLodashOptions} from '@optimize-lodash/rollup-plugin'
3
3
  import type {NormalizedOutputOptions, Plugin as RollupPlugin, TreeshakingOptions} from 'rollup'
4
-
5
4
  import type {StrictOptions} from '../../strict'
6
5
 
7
- // re-export
8
- export type {RollupPlugin, StrictOptions}
9
-
10
6
  /** @public */
11
7
  export type PkgFormat = 'commonjs' | 'esm'
12
8
 
@@ -1,8 +1,7 @@
1
1
  import type ts from 'typescript'
2
-
3
2
  import type {Logger} from '../../logger'
4
- import type {PkgConfigOptions, PkgExports, PkgRuntime} from '../config'
5
- import type {PackageJSON} from '../pkg'
3
+ import type {PkgConfigOptions, PkgExports, PkgRuntime} from '../config/types'
4
+ import type {PackageJSON} from '../pkg/types'
6
5
 
7
6
  /** @internal */
8
7
  export interface BuildFile {
@@ -1,7 +1,5 @@
1
1
  import fs from 'node:fs/promises'
2
-
3
2
  import pkgUp from 'pkg-up'
4
-
5
3
  import type {PackageJSON} from './types'
6
4
  import {validatePkg} from './validatePkg'
7
5
 
@@ -1,6 +1,5 @@
1
1
  import chalk from 'chalk'
2
2
  import {ZodError} from 'zod'
3
-
4
3
  import type {Logger} from '../../logger'
5
4
  import {assertLast, assertOrder} from './helpers'
6
5
  import {loadPkg} from './loadPkg'
@@ -1,10 +1,9 @@
1
1
  import {existsSync} from 'node:fs'
2
2
  import {resolve as resolvePath} from 'node:path'
3
-
4
3
  import type {Logger} from '../../logger'
5
4
  import type {InferredStrictOptions} from '../../strict'
6
5
  import {defaultEnding, fileEnding} from '../../tasks/dts/getTargetPaths'
7
- import type {PkgExport} from '../config'
6
+ import type {PkgExport} from '../config/types'
8
7
  import {isRecord} from '../isRecord'
9
8
  import {pkgExtMap} from './pkgExt'
10
9
  import type {PackageJSON} from './types'
@@ -1,4 +1,4 @@
1
- import type {PkgExport} from '../config'
1
+ import type {PkgExport} from '../config/types'
2
2
  import {pkgExtMap as extMap} from './pkgExt'
3
3
  import type {PackageJSON} from './types'
4
4
 
@@ -1,5 +1,4 @@
1
1
  import {z} from 'zod'
2
-
3
2
  import type {PackageJSON} from './types'
4
3
 
5
4
  const pkgSchema = z.object({
@@ -1,9 +1,7 @@
1
1
  import {writeFile} from 'node:fs/promises'
2
2
  import {dirname, relative, resolve} from 'node:path'
3
-
4
3
  import {mkdirp} from 'mkdirp'
5
4
  import prompts from 'prompts'
6
-
7
5
  import type {Logger} from '../../logger'
8
6
  import type {PkgTemplate} from './types'
9
7
 
@@ -11,7 +11,6 @@ export interface PkgTemplateStringOption<T = string> {
11
11
  name: string
12
12
  type: 'string'
13
13
  description: string
14
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
14
  initial?: T | ((options: Record<string, any>) => T)
16
15
  parse?: (v: string) => T | null
17
16
  validate?: (v: string) => string | true
@@ -22,7 +21,6 @@ export type PkgTemplateOption<T = string> = PkgTemplateStringOption<T>
22
21
 
23
22
  /** @public */
24
23
  export interface PkgTemplateDefinition {
25
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
24
  options: PkgTemplateStringOption<any>[]
27
25
  features: {
28
26
  name: string
@@ -30,7 +28,6 @@ export interface PkgTemplateDefinition {
30
28
  initial: boolean
31
29
  }[]
32
30
  getFiles: (
33
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
31
  options: Record<string, any>,
35
32
  features: Record<string, boolean>,
36
33
  ) => Promise<PkgTemplateFile[]>
@@ -1,5 +1,4 @@
1
1
  import {statSync} from 'node:fs'
2
-
3
2
  import prettyBytes from 'pretty-bytes'
4
3
 
5
4
  export function getFilesize(file: string): string {
@@ -1,5 +1,4 @@
1
1
  import path from 'node:path'
2
-
3
2
  import globby from 'globby'
4
3
 
5
4
  export function globFiles(patterns: string[]): Promise<string[]> {
package/src/node/index.ts CHANGED
@@ -1,15 +1,71 @@
1
- export * from './build'
2
- export * from './check'
3
- export * from './core'
4
- export * from './init'
5
- export * from './logger'
6
- export * from './resolveBuildTasks'
1
+ export {build} from './build'
2
+ export {check} from './check'
3
+ export {defineConfig} from './core/config/defineConfig'
4
+ export {loadConfig} from './core/config/loadConfig'
5
+ export {resolveConfigProperty} from './core/config/resolveConfigProperty'
6
+ export type {
7
+ PkgFormat,
8
+ PkgRuntime,
9
+ PkgExport,
10
+ PkgConfigPropertyResolver,
11
+ PkgConfigProperty,
12
+ PkgBundle,
13
+ PkgExports,
14
+ PkgRuleLevel,
15
+ TSDocCustomTag,
16
+ ReactCompilerOptions,
17
+ ReactCompilerLoggerEvent,
18
+ ReactCompilerLogger,
19
+ PkgConfigOptions,
20
+ } from './core/config/types'
21
+ export type {BuildFile, BuildContext} from './core/contexts/buildContext'
22
+ export {DEFAULT_BROWSERSLIST_QUERY} from './core/defaults'
23
+ export * from './core/isRecord'
24
+ export {loadPkg} from './core/pkg/loadPkg'
25
+ export {loadPkgWithReporting} from './core/pkg/loadPkgWithReporting'
26
+ export {parseExports} from './core/pkg/parseExports'
27
+ export {type PkgExtMap, pkgExtMap} from './core/pkg/pkgExt'
28
+ export * from './core/pkg/types'
29
+ export {createFromTemplate} from './core/template/createFromTemplate'
30
+ export {defineTemplateOption} from './core/template/define'
7
31
  export {
32
+ type PkgTemplateFile,
33
+ type PkgTemplateStringOption,
34
+ type PkgTemplateOption,
35
+ type PkgTemplateDefinition,
36
+ type PkgTemplateResolver,
37
+ type PkgTemplate,
38
+ } from './core/template/types'
39
+ export {loadTSConfig} from './core/ts/loadTSConfig'
40
+
41
+ export {init} from './init'
42
+ export {type Logger, createLogger} from './logger'
43
+ export {resolveBuildTasks} from './resolveBuildTasks'
44
+ export {
45
+ type StrictOptions,
8
46
  type InferredStrictOptions,
9
47
  parseStrictOptions,
10
48
  strictOptions,
11
49
  toggle,
12
50
  type ToggleType,
13
51
  } from './strict'
14
- export * from './tasks'
15
- export * from './watch'
52
+ export {buildTaskHandlers, watchTaskHandlers} from './tasks'
53
+ export {dtsTask} from './tasks/dts/dtsTask'
54
+ export {dtsWatchTask} from './tasks/dts/dtsWatchTask'
55
+ export {getExtractMessagesConfig} from './tasks/dts/getExtractMessagesConfig'
56
+ export type {DtsWatchTask, DtsTask, DtsResult} from './tasks/dts/types'
57
+ export {rollupTask} from './tasks/rollup/rollupTask'
58
+ export {rollupWatchTask} from './tasks/rollup/rollupWatchTask'
59
+ export type {
60
+ RollupTaskEntry,
61
+ RollupTask,
62
+ RollupWatchTask,
63
+ BuildTask,
64
+ WatchTask,
65
+ TaskHandler,
66
+ BuildTaskHandlers,
67
+ WatchTaskHandlers,
68
+ } from './tasks/types'
69
+ export {watch} from './watch'
70
+
71
+ export type {Plugin as RollupPlugin} from 'rollup'
package/src/node/init.ts CHANGED
@@ -1,13 +1,11 @@
1
1
  import {lstat} from 'node:fs/promises'
2
2
  import {resolve} from 'node:path'
3
-
4
3
  import {mkdirp} from 'mkdirp'
5
-
6
4
  import {createFromTemplate} from './core/template'
7
5
  import {fileExists} from './fileExists'
8
6
  import {isEmptyDirectory} from './isEmptyDirectory'
9
7
  import {createLogger} from './logger'
10
- import {defaultTemplate} from './templates'
8
+ import {defaultTemplate} from './templates/default/template'
11
9
 
12
10
  /** @public */
13
11
  export async function init(options: {cwd: string; path: string}): Promise<void> {
@@ -1,3 +1,4 @@
1
+ // oxlint-disable no-console
1
2
  import chalk from 'chalk'
2
3
 
3
4
  /** @internal */
@@ -12,7 +13,6 @@ export interface Logger {
12
13
  /** @internal */
13
14
  export function createLogger(): Logger {
14
15
  return {
15
- /* eslint-disable no-console */
16
16
  log: (...args) => {
17
17
  console.log(...args)
18
18
  },
@@ -28,6 +28,5 @@ export function createLogger(): Logger {
28
28
  success: (...args) => {
29
29
  console.log(chalk.green('[success]'), ...args)
30
30
  },
31
- /* eslint-enable no-console */
32
31
  }
33
32
  }
@@ -1,9 +1,7 @@
1
1
  import path from 'node:path'
2
-
3
2
  import type {ExtractorMessage} from '@microsoft/api-extractor'
4
3
  import chalk from 'chalk'
5
-
6
- import type {BuildContext} from './core'
4
+ import type {BuildContext} from './core/contexts/buildContext'
7
5
 
8
6
  export function printExtractMessages(ctx: BuildContext, messages: ExtractorMessage[]): void {
9
7
  const {cwd, logger} = ctx
@@ -1,9 +1,8 @@
1
1
  import path from 'node:path'
2
-
3
2
  import chalk from 'chalk'
4
3
  import treeify from 'treeify'
5
-
6
- import type {BuildContext, PkgExport} from './core'
4
+ import type {PkgExport} from './core/config/types'
5
+ import type {BuildContext} from './core/contexts/buildContext'
7
6
  import {fileExists} from './fileExists'
8
7
  import {getFilesize} from './getFilesize'
9
8
 
@@ -22,7 +21,6 @@ export function printPackageTree(ctx: BuildContext): void {
22
21
 
23
22
  logger.log(`${chalk.blue(pkg.name)}@${chalk.green(pkg.version)}`)
24
23
 
25
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
24
  const tree: Record<string, unknown> = {}
27
25
 
28
26
  if (pkg.type) {
@@ -93,6 +91,5 @@ export function printPackageTree(ctx: BuildContext): void {
93
91
  }),
94
92
  )
95
93
 
96
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
97
94
  logger.log(treeify.asTree(tree as Record<string, any>, true, true))
98
95
  }
@@ -1,19 +1,13 @@
1
1
  import path from 'node:path'
2
-
3
2
  import browserslistToEsbuild from 'browserslist-to-esbuild'
4
-
5
- import {
6
- type BuildContext,
7
- DEFAULT_BROWSERSLIST_QUERY,
8
- loadTSConfig,
9
- type PackageJSON,
10
- parseExports,
11
- type PkgConfigOptions,
12
- type PkgExports,
13
- type PkgRuntime,
14
- resolveConfigProperty,
15
- } from './core'
3
+ import {loadTSConfig} from './core'
4
+ import {resolveConfigProperty} from './core/config/resolveConfigProperty'
5
+ import {type PkgConfigOptions, type PkgExports, type PkgRuntime} from './core/config/types'
6
+ import type {BuildContext} from './core/contexts/buildContext'
7
+ import {DEFAULT_BROWSERSLIST_QUERY} from './core/defaults'
16
8
  import {findCommonDirPath, pathContains} from './core/findCommonPath'
9
+ import {parseExports} from './core/pkg/parseExports'
10
+ import type {PackageJSON} from './core/pkg/types'
17
11
  import type {Logger} from './logger'
18
12
  import {resolveBrowserTarget} from './resolveBrowserTarget'
19
13
  import {resolveNodeTarget} from './resolveNodeTarget'
@@ -40,7 +34,6 @@ export async function resolveBuildContext(options: {
40
34
  const tsconfig = await loadTSConfig({cwd, tsconfigPath})
41
35
  const strictOptions = parseStrictOptions(config?.strictOptions ?? {})
42
36
 
43
- /* eslint-disable padding-line-between-statements */
44
37
  let browserslist = pkg.browserslist
45
38
  if (!browserslist) {
46
39
  if (strict && strictOptions.noImplicitBrowsersList !== 'off') {
@@ -58,7 +51,6 @@ export async function resolveBuildContext(options: {
58
51
  browserslist = DEFAULT_BROWSERSLIST_QUERY
59
52
  }
60
53
  const targetVersions = browserslistToEsbuild(browserslist)
61
- /* eslint-enable padding-line-between-statements */
62
54
 
63
55
  if (
64
56
  strict &&
@@ -98,11 +90,10 @@ export async function resolveBuildContext(options: {
98
90
  strict,
99
91
  strictOptions,
100
92
  logger,
101
- }).reduce<PkgExports>((acc, x) => {
102
- const {_path: exportPath, ...exportEntry} = x
103
-
104
- return {...acc, [exportPath]: exportEntry}
105
- }, {})
93
+ }).reduce<PkgExports>(
94
+ (acc, {_path: exportPath, ...exportEntry}) => Object.assign(acc, {[exportPath]: exportEntry}),
95
+ {},
96
+ )
106
97
 
107
98
  const exports = resolveConfigProperty(config?.exports, parsedExports)
108
99
 
@@ -118,9 +109,7 @@ export async function resolveBuildContext(options: {
118
109
  : resolveConfigProperty(config?.external, parsedExternal)
119
110
  // Merge bundledPackages with dev deps, replace if it's a function
120
111
  const externalWithTypes = new Set([pkg.name, ...external, ...external.map(transformPackageName)])
121
- const bundledDependencies = [
122
- ...(pkg.devDependencies ? Object.keys(pkg.devDependencies) : []),
123
- ].filter(
112
+ const bundledDependencies = (pkg.devDependencies ? Object.keys(pkg.devDependencies) : []).filter(
124
113
  // Do not bundle anything that is marked as external
125
114
  (_) => !externalWithTypes.has(_),
126
115
  )
@@ -1,8 +1,9 @@
1
1
  import path from 'node:path'
2
-
3
- import type {BuildContext, PkgExport, PkgFormat, PkgRuntime} from './core'
4
- import type {BuildTask, DtsTask, RollupTask, RollupTaskEntry} from './tasks'
2
+ import type {PkgExport, PkgFormat, PkgRuntime} from './core/config/types'
3
+ import type {BuildContext} from './core/contexts/buildContext'
5
4
  import {getTargetPaths} from './tasks/dts/getTargetPaths'
5
+ import type {DtsTask} from './tasks/dts/types'
6
+ import type {BuildTask, RollupTask, RollupTaskEntry} from './tasks/types'
6
7
 
7
8
  /** @internal */
8
9
  export function resolveBuildTasks(ctx: BuildContext): BuildTask[] {
@@ -1,8 +1,9 @@
1
1
  import path from 'node:path'
2
-
3
- import type {BuildContext, PkgExport, PkgFormat, PkgRuntime} from './core'
4
- import type {DtsWatchTask, RollupTaskEntry, RollupWatchTask, WatchTask} from './tasks'
2
+ import type {PkgExport, PkgFormat, PkgRuntime} from './core/config/types'
3
+ import type {BuildContext} from './core/contexts/buildContext'
5
4
  import {getTargetPaths} from './tasks/dts/getTargetPaths'
5
+ import type {DtsWatchTask} from './tasks/dts/types'
6
+ import type {RollupTaskEntry, RollupWatchTask, WatchTask} from './tasks/types'
6
7
 
7
8
  /** @internal */
8
9
  export function resolveWatchTasks(ctx: BuildContext): WatchTask[] {
@@ -1,5 +1,4 @@
1
- /* eslint-disable no-console */
2
-
1
+ // oxlint-disable no-console
3
2
  import chalk from 'chalk'
4
3
 
5
4
  export function createSpinner(msg: string): {complete: () => void; error: () => void} {
@@ -1,5 +1,4 @@
1
1
  import {expectTypeOf, test} from 'vitest'
2
-
3
2
  import type {InferredStrictOptions, StrictOptions} from './strict'
4
3
 
5
4
  test('the zod schema types matches the manual types', () => {
@@ -1,5 +1,4 @@
1
1
  import ts from 'typescript'
2
-
3
2
  import type {Logger} from '../../logger'
4
3
  import {printDiagnostic} from './printDiagnostic'
5
4
 
@@ -1,5 +1,4 @@
1
1
  import path from 'node:path'
2
-
3
2
  import type {IConfigFile, IExtractorMessagesConfig} from '@microsoft/api-extractor'
4
3
  import ts from 'typescript'
5
4
 
@@ -1,5 +1,4 @@
1
1
  import {readFile} from 'node:fs/promises'
2
-
3
2
  import {TSDocConfigFile} from '@microsoft/tsdoc-config'
4
3
  import {parse} from 'jsonc-parser'
5
4
 
@@ -1,9 +1,7 @@
1
1
  import path from 'node:path'
2
-
3
2
  import type {ExtractorMessage} from '@microsoft/api-extractor'
4
- import rimraf from 'rimraf'
5
-
6
- import type {BuildContext} from '../../core'
3
+ import {rimraf} from 'rimraf'
4
+ import type {BuildContext} from '../../core/contexts/buildContext'
7
5
  import {buildTypes} from './buildTypes'
8
6
  import {DtsError} from './DtsError'
9
7
  import {extractTypes} from './extractTypes'
@@ -1,6 +1,5 @@
1
1
  import chalk from 'chalk'
2
2
  import {Observable} from 'rxjs'
3
-
4
3
  import {printExtractMessages} from '../../printExtractMessages'
5
4
  import type {TaskHandler} from '../types'
6
5
  import {doExtract} from './doExtract'
@@ -1,11 +1,9 @@
1
1
  import path from 'node:path'
2
-
3
2
  import type {ExtractorMessage} from '@microsoft/api-extractor'
4
3
  import chalk from 'chalk'
5
- import rimraf from 'rimraf'
4
+ import * as rimraf from 'rimraf'
6
5
  import {Observable} from 'rxjs'
7
6
  import ts from 'typescript'
8
-
9
7
  import {printExtractMessages} from '../../printExtractMessages'
10
8
  import type {TaskHandler} from '../types'
11
9
  import {buildTypes} from './buildTypes'
@@ -1,6 +1,5 @@
1
1
  import fs from 'node:fs/promises'
2
2
  import path from 'node:path'
3
-
4
3
  import {
5
4
  Extractor,
6
5
  ExtractorConfig,
@@ -8,10 +7,10 @@ import {
8
7
  type ExtractorResult,
9
8
  } from '@microsoft/api-extractor'
10
9
  import {mkdirp} from 'mkdirp'
11
- import prettier from 'prettier'
10
+ import * as prettier from 'prettier'
12
11
  import type ts from 'typescript'
13
-
14
- import type {BuildFile, PkgConfigOptions} from '../../core'
12
+ import type {PkgConfigOptions} from '../../core/config/types'
13
+ import type {BuildFile} from '../../core/contexts/buildContext'
15
14
  import {createApiExtractorConfig} from './createApiExtractorConfig'
16
15
  import {createTSDocConfig} from './createTSDocConfig'
17
16
  import {extractModuleBlocksFromTypes} from './extractModuleBlocks'
@@ -1,6 +1,5 @@
1
1
  import type {ExtractorLogLevel, IExtractorMessagesConfig} from '@microsoft/api-extractor'
2
-
3
- import type {PkgConfigOptions, PkgRuleLevel} from '../../core'
2
+ import type {PkgConfigOptions, PkgRuleLevel} from '../../core/config/types'
4
3
 
5
4
  const LOG_LEVELS: Record<PkgRuleLevel, ExtractorLogLevel> = {
6
5
  error: 'error' as ExtractorLogLevel.Error,