@sanity/pkg-utils 6.9.4-canary.0 → 6.10.0
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.
- package/dist/_chunks-cjs/index.cjs +1 -8
- package/dist/_chunks-cjs/index.cjs.map +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/index.d.cts +78 -7
- package/dist/index.d.ts +78 -7
- package/dist/index.js +1 -8
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/node/core/config/types.ts +92 -7
- package/src/node/tasks/rollup/resolveRollupConfig.ts +1 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/pkg-utils",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.10.0",
|
|
4
4
|
"description": "Simple utilities for modern npm packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity-io",
|
|
@@ -125,8 +125,8 @@
|
|
|
125
125
|
"@types/semver": "^7.5.8",
|
|
126
126
|
"@types/treeify": "^1.0.3",
|
|
127
127
|
"@types/uuid": "^9.0.8",
|
|
128
|
-
"@typescript-eslint/eslint-plugin": "^7.13.
|
|
129
|
-
"@typescript-eslint/parser": "^7.13.
|
|
128
|
+
"@typescript-eslint/eslint-plugin": "^7.13.1",
|
|
129
|
+
"@typescript-eslint/parser": "^7.13.1",
|
|
130
130
|
"browserslist-to-esbuild": "2.1.1",
|
|
131
131
|
"commitizen": "^4.3.0",
|
|
132
132
|
"cpx": "^1.5.0",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"typescript": "5.4.5",
|
|
147
147
|
"vitest": "^1.6.0",
|
|
148
148
|
"vitest-github-actions-reporter": "^0.11.1",
|
|
149
|
-
"@sanity/pkg-utils": "6.
|
|
149
|
+
"@sanity/pkg-utils": "6.10.0"
|
|
150
150
|
},
|
|
151
151
|
"peerDependencies": {
|
|
152
152
|
"typescript": "5.4.x"
|
|
@@ -71,20 +71,105 @@ export interface TSDocCustomTag {
|
|
|
71
71
|
allowMultiple?: boolean
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Until these types are on npm: https://github.com/facebook/react/blob/2ba462b665bb4691067e67db3cfbffc56959b788/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Options.ts#L34-L120
|
|
76
|
+
* @alpha
|
|
77
|
+
*/
|
|
78
|
+
export interface ReactCompilerOptions {
|
|
79
|
+
logger?: ReactCompilerLogger | null
|
|
80
|
+
|
|
81
|
+
panicThreshold?: 'ALL_ERRORS' | 'CRITICAL_ERRORS' | 'NONE'
|
|
82
|
+
|
|
83
|
+
compilationMode?: 'infer' | 'syntax' | 'annotation' | 'all'
|
|
84
|
+
|
|
85
|
+
/*
|
|
86
|
+
* If enabled, Forget will import `useMemoCache` from the given module
|
|
87
|
+
* instead of `react/compiler-runtime`.
|
|
88
|
+
*
|
|
89
|
+
* ```
|
|
90
|
+
* // If set to "react-compiler-runtime"
|
|
91
|
+
* import {c as useMemoCache} from 'react-compiler-runtime';
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
runtimeModule?: string | null | undefined
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* By default React Compiler will skip compilation of code that suppresses the default
|
|
98
|
+
* React ESLint rules, since this is a strong indication that the code may be breaking React rules
|
|
99
|
+
* in some way.
|
|
100
|
+
*
|
|
101
|
+
* Use eslintSuppressionRules to pass a custom set of rule names: any code which suppresses the
|
|
102
|
+
* provided rules will skip compilation. To disable this feature (never bailout of compilation
|
|
103
|
+
* even if the default ESLint is suppressed), pass an empty array.
|
|
104
|
+
*/
|
|
105
|
+
eslintSuppressionRules?: Array<string> | null | undefined
|
|
106
|
+
|
|
107
|
+
sources?: Array<string> | ((filename: string) => boolean) | null
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @alpha
|
|
112
|
+
* Represents 'events' that may occur during compilation. Events are only
|
|
113
|
+
* recorded when a logger is set (through the config).
|
|
114
|
+
* These are the different types of events:
|
|
115
|
+
* CompileError:
|
|
116
|
+
* Forget skipped compilation of a function / file due to a known todo,
|
|
117
|
+
* invalid input, or compiler invariant being broken.
|
|
118
|
+
* CompileSuccess:
|
|
119
|
+
* Forget successfully compiled a function.
|
|
120
|
+
* PipelineError:
|
|
121
|
+
* Unexpected errors that occurred during compilation (e.g. failures in
|
|
122
|
+
* babel or other unhandled exceptions).
|
|
123
|
+
*/
|
|
124
|
+
export type ReactCompilerLoggerEvent =
|
|
125
|
+
| {
|
|
126
|
+
kind: 'CompileError'
|
|
127
|
+
fnLoc: unknown
|
|
128
|
+
detail: unknown
|
|
129
|
+
}
|
|
130
|
+
| {
|
|
131
|
+
kind: 'CompileDiagnostic'
|
|
132
|
+
fnLoc: unknown
|
|
133
|
+
detail: unknown
|
|
134
|
+
}
|
|
135
|
+
| {
|
|
136
|
+
kind: 'CompileSuccess'
|
|
137
|
+
fnLoc: unknown
|
|
138
|
+
fnName: string | null
|
|
139
|
+
memoSlots: number
|
|
140
|
+
memoBlocks: number
|
|
141
|
+
memoValues: number
|
|
142
|
+
prunedMemoBlocks: number
|
|
143
|
+
prunedMemoValues: number
|
|
144
|
+
}
|
|
145
|
+
| {
|
|
146
|
+
kind: 'PipelineError'
|
|
147
|
+
fnLoc: unknown
|
|
148
|
+
data: string
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @alpha
|
|
153
|
+
*/
|
|
154
|
+
export type ReactCompilerLogger = {
|
|
155
|
+
logEvent: (filename: string | null, event: ReactCompilerLoggerEvent) => void
|
|
156
|
+
}
|
|
157
|
+
|
|
74
158
|
/** @public */
|
|
75
159
|
export interface PkgConfigOptions {
|
|
76
160
|
/** @alpha */
|
|
77
161
|
babel?: {
|
|
78
162
|
plugins?: BabelPluginItem[] | null | undefined
|
|
79
163
|
/** @alpha */
|
|
80
|
-
reactCompiler?:
|
|
81
|
-
| boolean
|
|
82
|
-
| {
|
|
83
|
-
compilationMode: 'infer' | 'annotation' | 'all'
|
|
84
|
-
panicThreshold: 'all_errors' | 'critical_errors' | 'none'
|
|
85
|
-
sources?: Array<string> | ((filename: string) => boolean) | null
|
|
86
|
-
}
|
|
164
|
+
reactCompiler?: boolean
|
|
87
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Configure the React Compiler.
|
|
168
|
+
* To enable it, either:
|
|
169
|
+
* - set `babel.reactCompiler` to `true`
|
|
170
|
+
* - add a `react-compiler` export condition, before any `browser`, `require` or `import` conditions. After any `react-server` and `node` conditions
|
|
171
|
+
* @alpha */
|
|
172
|
+
reactCompilerOptions?: ReactCompilerOptions
|
|
88
173
|
bundles?: PkgBundle[]
|
|
89
174
|
/** @alpha */
|
|
90
175
|
define?: Record<string, string | number | boolean | undefined | null>
|
|
@@ -102,16 +102,7 @@ export function resolveRollupConfig(
|
|
|
102
102
|
presets: ['@babel/preset-typescript'],
|
|
103
103
|
babelHelpers: 'bundled',
|
|
104
104
|
extensions: ['.ts', '.tsx', '.js', '.jsx'],
|
|
105
|
-
plugins: [
|
|
106
|
-
[
|
|
107
|
-
'babel-plugin-react-compiler',
|
|
108
|
-
{
|
|
109
|
-
...(typeof config?.babel?.reactCompiler === 'object'
|
|
110
|
-
? config?.babel?.reactCompiler
|
|
111
|
-
: {}),
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
],
|
|
105
|
+
plugins: [['babel-plugin-react-compiler', config?.reactCompilerOptions || {}]],
|
|
115
106
|
}),
|
|
116
107
|
esbuild({
|
|
117
108
|
jsx: config?.jsx ?? 'automatic',
|