@sanity/pkg-utils 7.2.8-canary.0 → 7.2.8-canary.2

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 (66) hide show
  1. package/bin/pkg-utils.cjs +0 -1
  2. package/dist/_chunks-cjs/build.cjs +4 -4
  3. package/dist/_chunks-cjs/build.cjs.map +1 -1
  4. package/dist/_chunks-cjs/check.cjs +14 -14
  5. package/dist/_chunks-cjs/check.cjs.map +1 -1
  6. package/dist/_chunks-cjs/consoleSpy.cjs +153 -83
  7. package/dist/_chunks-cjs/consoleSpy.cjs.map +1 -1
  8. package/dist/_chunks-cjs/index.cjs +0 -1
  9. package/dist/_chunks-cjs/index.cjs.map +1 -1
  10. package/dist/_chunks-cjs/init.cjs +11 -11
  11. package/dist/_chunks-cjs/init.cjs.map +1 -1
  12. package/dist/_chunks-cjs/isRecord.cjs +39 -0
  13. package/dist/_chunks-cjs/isRecord.cjs.map +1 -0
  14. package/dist/_chunks-cjs/watch.cjs +8 -8
  15. package/dist/_chunks-cjs/watch.cjs.map +1 -1
  16. package/dist/cli.cjs +1 -1
  17. package/dist/index.cjs +3 -3
  18. package/dist/index.d.cts +2 -2
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.js +130 -127
  21. package/dist/index.js.map +1 -1
  22. package/package.json +2 -2
  23. package/src/node/build.ts +4 -2
  24. package/src/node/check.ts +2 -3
  25. package/src/node/core/config/findConfigFile.ts +0 -2
  26. package/src/node/core/config/loadConfig.ts +0 -2
  27. package/src/node/core/config/types.ts +0 -4
  28. package/src/node/core/contexts/buildContext.ts +2 -3
  29. package/src/node/core/pkg/loadPkg.ts +0 -2
  30. package/src/node/core/pkg/loadPkgWithReporting.ts +0 -1
  31. package/src/node/core/pkg/parseExports.ts +1 -2
  32. package/src/node/core/pkg/validateExports.ts +1 -1
  33. package/src/node/core/pkg/validatePkg.ts +0 -1
  34. package/src/node/core/template/createFromTemplate.ts +0 -2
  35. package/src/node/getFilesize.ts +0 -1
  36. package/src/node/globFiles.ts +0 -1
  37. package/src/node/index.ts +64 -8
  38. package/src/node/init.ts +2 -4
  39. package/src/node/printExtractMessages.ts +1 -3
  40. package/src/node/printPackageTree.ts +2 -3
  41. package/src/node/resolveBuildContext.ts +11 -14
  42. package/src/node/resolveBuildTasks.ts +4 -3
  43. package/src/node/resolveWatchTasks.ts +4 -3
  44. package/src/node/strict.test-d.ts +0 -1
  45. package/src/node/tasks/dts/buildTypes.ts +0 -1
  46. package/src/node/tasks/dts/createApiExtractorConfig.ts +0 -1
  47. package/src/node/tasks/dts/createTSDocConfig.ts +0 -1
  48. package/src/node/tasks/dts/doExtract.ts +1 -1
  49. package/src/node/tasks/dts/dtsTask.ts +0 -1
  50. package/src/node/tasks/dts/extractTypes.ts +2 -1
  51. package/src/node/tasks/dts/getExtractMessagesConfig.ts +1 -2
  52. package/src/node/tasks/dts/getTargetPaths.ts +2 -1
  53. package/src/node/tasks/dts/printDiagnostic.ts +0 -2
  54. package/src/node/tasks/index.ts +4 -6
  55. package/src/node/tasks/rollup/resolveRollupConfig.ts +3 -1
  56. package/src/node/tasks/rollup/rollupTask.ts +1 -3
  57. package/src/node/tasks/rollup/rollupWatchTask.ts +1 -3
  58. package/src/node/tasks/types.ts +4 -4
  59. package/src/node/templates/default/template.ts +4 -7
  60. package/src/node/watch.ts +4 -4
  61. package/src/node/watchConfigFiles.ts +0 -2
  62. package/dist/_chunks-cjs/logger.cjs +0 -107
  63. package/dist/_chunks-cjs/logger.cjs.map +0 -1
  64. package/src/node/core/index.ts +0 -7
  65. package/src/node/tasks/dts/index.ts +0 -4
  66. package/src/node/tasks/rollup/index.ts +0 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/pkg-utils",
3
- "version": "7.2.8-canary.0",
3
+ "version": "7.2.8-canary.2",
4
4
  "description": "Simple utilities for modern npm packages.",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -139,7 +139,7 @@
139
139
  "ts-node": "^10.9.2",
140
140
  "typescript": "5.8.3",
141
141
  "vitest": "^3.2.4",
142
- "@sanity/pkg-utils": "7.2.8-canary.0"
142
+ "@sanity/pkg-utils": "7.2.8-canary.2"
143
143
  },
144
144
  "peerDependencies": {
145
145
  "babel-plugin-react-compiler": "*",
package/src/node/build.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import path from 'node:path'
2
2
  import {rimraf} from 'rimraf'
3
- import {loadConfig, loadPkgWithReporting} from './core'
3
+ import {loadConfig} from './core/config/loadConfig'
4
+ import {loadPkgWithReporting} from './core/pkg/loadPkgWithReporting'
4
5
  import {createLogger} from './logger'
5
6
  import {resolveBuildContext} from './resolveBuildContext'
6
7
  import {resolveBuildTasks} from './resolveBuildTasks'
7
8
  import {createSpinner} from './spinner'
8
- import {buildTaskHandlers, type BuildTask, type TaskHandler} from './tasks'
9
+ import {buildTaskHandlers} from './tasks'
10
+ import {type BuildTask, type TaskHandler} from './tasks/types'
9
11
 
10
12
  /**
11
13
  * Build the distribution files of a npm package.
package/src/node/check.ts CHANGED
@@ -1,9 +1,8 @@
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
- import {loadConfig, loadPkgWithReporting} from './core'
4
+ import {loadConfig} from './core/config/loadConfig'
5
+ import {loadPkgWithReporting} from './core/pkg/loadPkgWithReporting'
7
6
  import {fileExists} from './fileExists'
8
7
  import {createLogger, type Logger} from './logger'
9
8
  import {printPackageTree} from './printPackageTree'
@@ -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,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
 
@@ -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
 
@@ -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
- import {createFromTemplate} from './core/template'
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,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
 
@@ -1,17 +1,13 @@
1
1
  import path from 'node:path'
2
2
  import browserslistToEsbuild from 'browserslist-to-esbuild'
3
- import {
4
- DEFAULT_BROWSERSLIST_QUERY,
5
- loadTSConfig,
6
- parseExports,
7
- resolveConfigProperty,
8
- type BuildContext,
9
- type PackageJSON,
10
- type PkgConfigOptions,
11
- type PkgExports,
12
- type PkgRuntime,
13
- } from './core'
3
+ import {resolveConfigProperty} from './core/config/resolveConfigProperty'
4
+ import {type PkgConfigOptions, type PkgExports, type PkgRuntime} from './core/config/types'
5
+ import type {BuildContext} from './core/contexts/buildContext'
6
+ import {DEFAULT_BROWSERSLIST_QUERY} from './core/defaults'
14
7
  import {findCommonDirPath, pathContains} from './core/findCommonPath'
8
+ import {parseExports} from './core/pkg/parseExports'
9
+ import type {PackageJSON} from './core/pkg/types'
10
+ import {loadTSConfig} from './core/ts/loadTSConfig'
15
11
  import type {Logger} from './logger'
16
12
  import {resolveBrowserTarget} from './resolveBrowserTarget'
17
13
  import {resolveNodeTarget} from './resolveNodeTarget'
@@ -94,9 +90,10 @@ export async function resolveBuildContext(options: {
94
90
  strict,
95
91
  strictOptions,
96
92
  logger,
97
- }).reduce<PkgExports>((acc, {_path: exportPath, ...exportEntry}) => {
98
- return Object.assign(acc, {[exportPath]: exportEntry})
99
- }, {})
93
+ }).reduce<PkgExports>(
94
+ (acc, {_path: exportPath, ...exportEntry}) => Object.assign(acc, {[exportPath]: exportEntry}),
95
+ {},
96
+ )
100
97
 
101
98
  const exports = resolveConfigProperty(config?.exports, parsedExports)
102
99
 
@@ -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
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,7 +1,7 @@
1
1
  import path from 'node:path'
2
2
  import type {ExtractorMessage} from '@microsoft/api-extractor'
3
3
  import {rimraf} from 'rimraf'
4
- import type {BuildContext} from '../../core'
4
+ import type {BuildContext} from '../../core/contexts/buildContext'
5
5
  import {buildTypes} from './buildTypes'
6
6
  import {DtsError} from './DtsError'
7
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'
@@ -9,7 +9,8 @@ import {
9
9
  import {mkdirp} from 'mkdirp'
10
10
  import * as prettier from 'prettier'
11
11
  import type ts from 'typescript'
12
- import type {BuildFile, PkgConfigOptions} from '../../core'
12
+ import type {PkgConfigOptions} from '../../core/config/types'
13
+ import type {BuildFile} from '../../core/contexts/buildContext'
13
14
  import {createApiExtractorConfig} from './createApiExtractorConfig'
14
15
  import {createTSDocConfig} from './createTSDocConfig'
15
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,
@@ -1,4 +1,5 @@
1
- import type {PackageJSON, PkgBundle, PkgExport} from '../../core'
1
+ import type {PkgBundle, PkgExport} from '../../core/config/types'
2
+ import type {PackageJSON} from '../../core/pkg/types'
2
3
 
3
4
  /** @internal */
4
5
  export const fileEnding = /\.[mc]?js$/
@@ -1,8 +1,6 @@
1
1
  import path from 'node:path'
2
-
3
2
  import chalk from 'chalk'
4
3
  import ts from 'typescript'
5
-
6
4
  import type {Logger} from '../../logger'
7
5
 
8
6
  export function printDiagnostic(options: {
@@ -1,11 +1,9 @@
1
- import {dtsTask, dtsWatchTask} from './dts'
2
- import {rollupTask, rollupWatchTask} from './rollup'
1
+ import {dtsTask} from './dts/dtsTask'
2
+ import {dtsWatchTask} from './dts/dtsWatchTask'
3
+ import {rollupTask} from './rollup/rollupTask'
4
+ import {rollupWatchTask} from './rollup/rollupWatchTask'
3
5
  import type {BuildTaskHandlers, WatchTaskHandlers} from './types'
4
6
 
5
- export * from './dts'
6
- export * from './rollup'
7
- export * from './types'
8
-
9
7
  /** @internal */
10
8
  export const buildTaskHandlers: BuildTaskHandlers = {
11
9
  'build:dts': dtsTask,
@@ -11,7 +11,9 @@ import terser from '@rollup/plugin-terser'
11
11
  import type {InputOptions, OutputOptions, Plugin} from 'rollup'
12
12
  import esbuild from 'rollup-plugin-esbuild'
13
13
  import {pkgExtMap as extMap} from '../../../node/core/pkg/pkgExt'
14
- import {resolveConfigProperty, type BuildContext, type PackageJSON} from '../../core'
14
+ import {resolveConfigProperty} from '../../core/config/resolveConfigProperty'
15
+ import type {BuildContext} from '../../core/contexts/buildContext'
16
+ import type {PackageJSON} from '../../core/pkg/types'
15
17
  import type {RollupTask, RollupWatchTask} from '../types'
16
18
 
17
19
  export interface RollupConfig {
@@ -1,11 +1,9 @@
1
1
  import path from 'node:path'
2
-
3
2
  import chalk from 'chalk'
4
3
  import {rollup} from 'rollup'
5
4
  import {Observable} from 'rxjs'
6
-
7
5
  import {createConsoleSpy} from '../../consoleSpy'
8
- import type {BuildContext} from '../../core'
6
+ import type {BuildContext} from '../../core/contexts/buildContext'
9
7
  import type {RollupTask, TaskHandler} from '../types'
10
8
  import {resolveRollupConfig} from './resolveRollupConfig'
11
9
 
@@ -1,9 +1,7 @@
1
1
  import path from 'node:path'
2
-
3
2
  import chalk from 'chalk'
4
- import {type RollupWatcherEvent, type RollupWatchOptions, watch as rollupWatch} from 'rollup'
3
+ import {watch as rollupWatch, type RollupWatcherEvent, type RollupWatchOptions} from 'rollup'
5
4
  import {Observable} from 'rxjs'
6
-
7
5
  import type {RollupWatchTask, TaskHandler} from '../types'
8
6
  import {resolveRollupConfig} from './resolveRollupConfig'
9
7
 
@@ -1,8 +1,8 @@
1
- import type {RollupWatcherEvent} from 'rollup'
1
+ import type { RollupWatcherEvent } from 'rollup'
2
2
  import type {Observable} from 'rxjs'
3
-
4
- import type {BuildContext, PkgRuntime} from '../core'
5
- import type {DtsResult, DtsTask, DtsWatchTask} from './dts'
3
+ import type {PkgRuntime} from '../core/config/types'
4
+ import type {BuildContext} from '../core/contexts/buildContext'
5
+ import type {DtsResult, DtsTask, DtsWatchTask} from './dts/types'
6
6
 
7
7
  /** @internal */
8
8
  export interface RollupTaskEntry {
@@ -5,13 +5,10 @@ import getLatestVersion from 'get-latest-version'
5
5
  import gitUrlParse from 'git-url-parse'
6
6
  import {outdent} from 'outdent'
7
7
  import {format, type Config as PrettierConfig} from 'prettier'
8
- import {
9
- defineTemplateOption,
10
- isRecord,
11
- type PackageJSON,
12
- type PkgTemplate,
13
- type PkgTemplateFile,
14
- } from '../../core'
8
+ import {isRecord} from '../../core/isRecord'
9
+ import type {PackageJSON} from '../../core/pkg/types'
10
+ import {defineTemplateOption} from '../../core/template/define'
11
+ import {type PkgTemplate, type PkgTemplateFile} from '../../core/template/types'
15
12
 
16
13
  const RE_NAME = /^(?:@(?:[a-z0-9-*~][a-z0-9-*._~]*)\/)?[a-z0-9-~][a-z0-9-._~]*$/i
17
14
 
package/src/node/watch.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import path from 'node:path'
2
-
3
2
  import {switchMap} from 'rxjs'
4
-
5
- import {loadConfig, loadPkgWithReporting} from './core'
3
+ import {loadConfig} from './core/config/loadConfig'
4
+ import {loadPkgWithReporting} from './core/pkg/loadPkgWithReporting'
6
5
  import {createLogger} from './logger'
7
6
  import {resolveBuildContext} from './resolveBuildContext'
8
7
  import {resolveWatchTasks} from './resolveWatchTasks'
9
- import {type TaskHandler, type WatchTask, watchTaskHandlers} from './tasks'
8
+ import {watchTaskHandlers} from './tasks'
9
+ import {type TaskHandler, type WatchTask} from './tasks/types'
10
10
  import {watchConfigFiles} from './watchConfigFiles'
11
11
 
12
12
  /** @public */
@@ -1,8 +1,6 @@
1
1
  import path from 'node:path'
2
-
3
2
  import type {Observable} from 'rxjs'
4
3
  import {distinctUntilChanged, scan, startWith} from 'rxjs/operators'
5
-
6
4
  import {globFiles} from './globFiles'
7
5
  import type {Logger} from './logger'
8
6
  import {watchFiles} from './watchFiles'