@sanity/pkg-utils 1.8.2 → 1.9.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/{_build-be4da439.cjs → _build-526356ff.cjs} +11 -8
- package/dist/_build-526356ff.cjs.map +1 -0
- package/dist/{_buildAction-db8d7aa0.cjs → _buildAction-c4426eb4.cjs} +3 -5
- package/dist/{_buildAction-db8d7aa0.cjs.map → _buildAction-c4426eb4.cjs.map} +1 -1
- package/dist/{_check-11811a4d.cjs → _check-069b0db0.cjs} +51 -22
- package/dist/_check-069b0db0.cjs.map +1 -0
- package/dist/{_checkAction-386fe8d4.cjs → _checkAction-d3a8b220.cjs} +4 -4
- package/dist/{_checkAction-386fe8d4.cjs.map → _checkAction-d3a8b220.cjs.map} +1 -1
- package/dist/{_index-066890ec.cjs → _index-bc62cfaa.cjs} +31 -38
- package/dist/_index-bc62cfaa.cjs.map +1 -0
- package/dist/{_watch-feff6936.cjs → _watch-91ef3209.cjs} +11 -8
- package/dist/_watch-91ef3209.cjs.map +1 -0
- package/dist/{_watchAction-453b8884.cjs → _watchAction-10ee08fc.cjs} +3 -5
- package/dist/{_watchAction-453b8884.cjs.map → _watchAction-10ee08fc.cjs.map} +1 -1
- package/dist/cli.cjs +4 -4
- package/dist/index.cjs +6 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +91 -60
- package/dist/index.js.map +1 -1
- package/dist/types/src/node/index.d.ts +4 -0
- package/package.json +15 -13
- package/src/node/_core/config/types.ts +4 -0
- package/src/node/_printPackageTree.ts +31 -6
- package/src/node/_resolveBuildTasks.ts +22 -17
- package/src/node/_resolveWatchTasks.ts +22 -17
- package/src/node/_tasks/dts/_buildTypes.ts +1 -0
- package/src/node/_tasks/dts/_createApiExtractorConfig.ts +13 -5
- package/src/node/_tasks/dts/_doExtract.ts +24 -35
- package/src/node/_tasks/dts/_extractTypes.ts +4 -4
- package/src/node/check.ts +16 -15
- package/src/node/watch.ts +1 -1
- package/dist/_build-be4da439.cjs.map +0 -1
- package/dist/_check-11811a4d.cjs.map +0 -1
- package/dist/_index-066890ec.cjs.map +0 -1
- package/dist/_watch-feff6936.cjs.map +0 -1
|
@@ -207,6 +207,10 @@ export declare interface PkgConfigOptions {
|
|
|
207
207
|
* Defaults to `"react"`
|
|
208
208
|
*/
|
|
209
209
|
jsxImportSource?: string
|
|
210
|
+
/**
|
|
211
|
+
* Build package with support for legacy exports (writes root <export>.js files)
|
|
212
|
+
*/
|
|
213
|
+
legacyExports?: boolean
|
|
210
214
|
minify?: boolean
|
|
211
215
|
/**
|
|
212
216
|
* Default runtime of package exports
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@sanity/pkg-utils",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.9.0",
|
|
5
5
|
"author": "Sanity.io <hello@sanity.io>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "Simple utilities for modern npm packages.",
|
|
@@ -37,19 +37,18 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
|
-
"build": "
|
|
41
|
-
"
|
|
40
|
+
"build": "run-s clean build:pkg check:pkg",
|
|
41
|
+
"build:pkg": "node --experimental-loader ./scripts/_experimental-loader.js --no-warnings -r esbuild-register scripts/build",
|
|
42
|
+
"check:pkg": "node --experimental-loader ./scripts/_experimental-loader.js --no-warnings -r esbuild-register scripts/check",
|
|
43
|
+
"check:types": "tsc --build",
|
|
42
44
|
"clean": "rimraf dist test/env/__tmp__",
|
|
43
45
|
"commit": "cz",
|
|
44
46
|
"extract": "sanity-tsdoc etl --outDir etc/api/@sanity/pkg-utils --tsconfig tsconfig.dist.json",
|
|
45
47
|
"format": "prettier --write --cache --ignore-unknown .",
|
|
46
|
-
"lint": "eslint . --ext .cjs,.js,.ts",
|
|
47
|
-
"postbuild": "pnpm run check:package",
|
|
48
|
-
"prebuild": "pnpm run clean",
|
|
48
|
+
"lint": "eslint . --ext .cjs,.js,.ts,.tsx",
|
|
49
49
|
"prepublishOnly": "pnpm run build",
|
|
50
50
|
"release": "semantic-release",
|
|
51
51
|
"test": "vitest run",
|
|
52
|
-
"type-check": "tsc --build",
|
|
53
52
|
"watch": "node --experimental-loader ./scripts/_experimental-loader.js --no-warnings -r esbuild-register scripts/watch"
|
|
54
53
|
},
|
|
55
54
|
"dependencies": {
|
|
@@ -68,7 +67,6 @@
|
|
|
68
67
|
"cac": "^6.7.12",
|
|
69
68
|
"chalk": "^4.1.2",
|
|
70
69
|
"chokidar": "^3.5.3",
|
|
71
|
-
"cpx": "^1.5.0",
|
|
72
70
|
"esbuild": "^0.15.5",
|
|
73
71
|
"esbuild-register": "^3.3.3",
|
|
74
72
|
"find-config": "^1.0.0",
|
|
@@ -89,6 +87,7 @@
|
|
|
89
87
|
"devDependencies": {
|
|
90
88
|
"@commitlint/cli": "^17.0.3",
|
|
91
89
|
"@commitlint/config-conventional": "^17.0.3",
|
|
90
|
+
"@sanity/pkg-utils": "workspace:*",
|
|
92
91
|
"@sanity/semantic-release-preset": "^2.0.0",
|
|
93
92
|
"@types/babel__core": "^7.1.19",
|
|
94
93
|
"@types/cpx": "^1.5.2",
|
|
@@ -102,6 +101,7 @@
|
|
|
102
101
|
"@typescript-eslint/eslint-plugin": "^5.35.1",
|
|
103
102
|
"@typescript-eslint/parser": "^5.35.1",
|
|
104
103
|
"commitizen": "^4.2.5",
|
|
104
|
+
"cpx": "^1.5.0",
|
|
105
105
|
"cz-conventional-changelog": "^3.3.0",
|
|
106
106
|
"eslint": "^8.23.0",
|
|
107
107
|
"eslint-config-prettier": "^8.5.0",
|
|
@@ -109,6 +109,7 @@
|
|
|
109
109
|
"eslint-plugin-prettier": "^4.2.1",
|
|
110
110
|
"husky": "^8.0.1",
|
|
111
111
|
"lint-staged": "^12.5.0",
|
|
112
|
+
"npm-run-all": "^4.1.5",
|
|
112
113
|
"rimraf": "^3.0.2",
|
|
113
114
|
"semantic-release": "^19.0.5",
|
|
114
115
|
"ts-node": "^10.9.1",
|
|
@@ -118,11 +119,6 @@
|
|
|
118
119
|
"peerDependencies": {
|
|
119
120
|
"typescript": "^4.7"
|
|
120
121
|
},
|
|
121
|
-
"config": {
|
|
122
|
-
"commitizen": {
|
|
123
|
-
"path": "cz-conventional-changelog"
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
122
|
"engines": {
|
|
127
123
|
"node": ">=14.0.0"
|
|
128
124
|
},
|
|
@@ -141,5 +137,11 @@
|
|
|
141
137
|
"homepage": "https://github.com/sanity-io/pkg-utils#readme",
|
|
142
138
|
"publishConfig": {
|
|
143
139
|
"access": "public"
|
|
140
|
+
},
|
|
141
|
+
"packageManager": "pnpm@7.12.2",
|
|
142
|
+
"pnpm": {
|
|
143
|
+
"overrides": {
|
|
144
|
+
"@sanity/pkg-utils": "workspace:*"
|
|
145
|
+
}
|
|
144
146
|
}
|
|
145
147
|
}
|
|
@@ -78,6 +78,10 @@ export interface PkgConfigOptions {
|
|
|
78
78
|
* Defaults to `"react"`
|
|
79
79
|
*/
|
|
80
80
|
jsxImportSource?: string
|
|
81
|
+
/**
|
|
82
|
+
* Build package with support for legacy exports (writes root <export>.js files)
|
|
83
|
+
*/
|
|
84
|
+
legacyExports?: boolean
|
|
81
85
|
minify?: boolean
|
|
82
86
|
/**
|
|
83
87
|
* Default runtime of package exports
|
|
@@ -51,26 +51,51 @@ export function _printPackageTree(ctx: _BuildContext): void {
|
|
|
51
51
|
Object.entries(exports)
|
|
52
52
|
.filter(([, entry]) => entry._exported)
|
|
53
53
|
.map(([exportPath, entry]) => {
|
|
54
|
-
const exp: Omit<PkgExport, '_exported'> = {
|
|
54
|
+
const exp: Omit<PkgExport, '_exported'> = {
|
|
55
|
+
source: entry.source,
|
|
56
|
+
types: undefined,
|
|
57
|
+
browser: undefined,
|
|
58
|
+
node: undefined,
|
|
59
|
+
import: undefined,
|
|
60
|
+
require: undefined,
|
|
61
|
+
default: entry.default,
|
|
62
|
+
}
|
|
55
63
|
|
|
56
|
-
if (entry.types)
|
|
64
|
+
if (entry.types) {
|
|
65
|
+
exp.types = _fileInfo(entry.types)
|
|
66
|
+
} else {
|
|
67
|
+
delete exp.types
|
|
68
|
+
}
|
|
57
69
|
|
|
58
70
|
if (entry.browser) {
|
|
59
71
|
exp.browser = {source: entry.browser.source}
|
|
60
72
|
|
|
61
73
|
if (entry.browser.import) exp.browser.import = _fileInfo(entry.browser.import)
|
|
62
|
-
if (entry.browser.require) exp.browser.
|
|
74
|
+
if (entry.browser.require) exp.browser.require = _fileInfo(entry.browser.require)
|
|
75
|
+
} else {
|
|
76
|
+
delete exp.browser
|
|
63
77
|
}
|
|
64
78
|
|
|
65
79
|
if (entry.node) {
|
|
66
80
|
exp.node = {source: entry.node.source}
|
|
67
81
|
|
|
68
82
|
if (entry.node.import) exp.node.import = _fileInfo(entry.node.import)
|
|
69
|
-
if (entry.node.require) exp.node.
|
|
83
|
+
if (entry.node.require) exp.node.require = _fileInfo(entry.node.require)
|
|
84
|
+
} else {
|
|
85
|
+
delete exp.node
|
|
70
86
|
}
|
|
71
87
|
|
|
72
|
-
if (entry.import)
|
|
73
|
-
|
|
88
|
+
if (entry.import) {
|
|
89
|
+
exp.import = _fileInfo(entry.import)
|
|
90
|
+
} else {
|
|
91
|
+
delete exp.import
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (entry.require) {
|
|
95
|
+
exp.require = _fileInfo(entry.require)
|
|
96
|
+
} else {
|
|
97
|
+
delete exp.require
|
|
98
|
+
}
|
|
74
99
|
|
|
75
100
|
exp.default = _fileInfo(entry.default)
|
|
76
101
|
|
|
@@ -5,7 +5,7 @@ import {_BuildTask, _DtsTask, _RollupTask, _RollupTaskEntry} from './_tasks'
|
|
|
5
5
|
|
|
6
6
|
/** @internal */
|
|
7
7
|
export function _resolveBuildTasks(ctx: _BuildContext): _BuildTask[] {
|
|
8
|
-
const {cwd, pkg, target} = ctx
|
|
8
|
+
const {config, cwd, pkg, target} = ctx
|
|
9
9
|
|
|
10
10
|
const tasks: _BuildTask[] = []
|
|
11
11
|
|
|
@@ -109,23 +109,28 @@ export function _resolveBuildTasks(ctx: _BuildContext): _BuildTask[] {
|
|
|
109
109
|
|
|
110
110
|
tasks.push(...Object.values(rollupTasks))
|
|
111
111
|
|
|
112
|
-
//
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
fs.writeFileSync(
|
|
120
|
-
path.resolve(cwd, `${exp._path}.js`),
|
|
121
|
-
[
|
|
122
|
-
`// AUTO-GENERATED – DO NOT EDIT`,
|
|
123
|
-
``,
|
|
124
|
-
// `export {default} from '${relativeTargetPath}'`,
|
|
125
|
-
`export * from '${relativeTargetPath}${pkg.type === 'commonjs' ? ext : ''}'`,
|
|
126
|
-
``,
|
|
127
|
-
].join('\n')
|
|
112
|
+
// Write legacy exports files
|
|
113
|
+
if (config?.legacyExports) {
|
|
114
|
+
for (const exp of exports) {
|
|
115
|
+
if (exp._exported && exp._path !== '.') {
|
|
116
|
+
const relativeTargetPath = (exp.browser?.import || exp.import || '').replace(
|
|
117
|
+
/\.[^/.]+$/,
|
|
118
|
+
''
|
|
128
119
|
)
|
|
120
|
+
const ext = _MODULE_EXT[pkg.type].esm
|
|
121
|
+
|
|
122
|
+
if (relativeTargetPath) {
|
|
123
|
+
fs.writeFileSync(
|
|
124
|
+
path.resolve(cwd, `${exp._path}.js`),
|
|
125
|
+
[
|
|
126
|
+
`// AUTO-GENERATED – DO NOT EDIT`,
|
|
127
|
+
``,
|
|
128
|
+
// `export {default} from '${relativeTargetPath}'`,
|
|
129
|
+
`export * from '${relativeTargetPath}${pkg.type === 'commonjs' ? ext : ''}'`,
|
|
130
|
+
``,
|
|
131
|
+
].join('\n')
|
|
132
|
+
)
|
|
133
|
+
}
|
|
129
134
|
}
|
|
130
135
|
}
|
|
131
136
|
}
|
|
@@ -5,7 +5,7 @@ import {_WatchTask, _DtsWatchTask, _RollupWatchTask, _RollupTaskEntry} from './_
|
|
|
5
5
|
|
|
6
6
|
/** @internal */
|
|
7
7
|
export function _resolveWatchTasks(ctx: _BuildContext): _WatchTask[] {
|
|
8
|
-
const {cwd, pkg, target} = ctx
|
|
8
|
+
const {config, cwd, pkg, target} = ctx
|
|
9
9
|
const tasks: _WatchTask[] = []
|
|
10
10
|
|
|
11
11
|
const exports = Object.entries(ctx.exports || {}).map(
|
|
@@ -108,23 +108,28 @@ export function _resolveWatchTasks(ctx: _BuildContext): _WatchTask[] {
|
|
|
108
108
|
|
|
109
109
|
tasks.push(...Object.values(rollupTasks))
|
|
110
110
|
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
fs.writeFileSync(
|
|
119
|
-
path.resolve(cwd, `${exp._path}.js`),
|
|
120
|
-
[
|
|
121
|
-
`// AUTO-GENERATED – DO NOT EDIT`,
|
|
122
|
-
``,
|
|
123
|
-
// `export {default} from '${relativeTargetPath}'`,
|
|
124
|
-
`export * from '${relativeTargetPath}${pkg.type === 'commonjs' ? ext : ''}'`,
|
|
125
|
-
``,
|
|
126
|
-
].join('\n')
|
|
111
|
+
// Write legacy exports files
|
|
112
|
+
if (config?.legacyExports) {
|
|
113
|
+
for (const exp of exports) {
|
|
114
|
+
if (exp._exported && exp._path !== '.') {
|
|
115
|
+
const relativeTargetPath = (exp.browser?.import || exp.import || '').replace(
|
|
116
|
+
/\.[^/.]+$/,
|
|
117
|
+
''
|
|
127
118
|
)
|
|
119
|
+
const ext = _MODULE_EXT[pkg.type].esm
|
|
120
|
+
|
|
121
|
+
if (relativeTargetPath) {
|
|
122
|
+
fs.writeFileSync(
|
|
123
|
+
path.resolve(cwd, `${exp._path}.js`),
|
|
124
|
+
[
|
|
125
|
+
`// AUTO-GENERATED – DO NOT EDIT`,
|
|
126
|
+
``,
|
|
127
|
+
// `export {default} from '${relativeTargetPath}'`,
|
|
128
|
+
`export * from '${relativeTargetPath}${pkg.type === 'commonjs' ? ext : ''}'`,
|
|
129
|
+
``,
|
|
130
|
+
].join('\n')
|
|
131
|
+
)
|
|
132
|
+
}
|
|
128
133
|
}
|
|
129
134
|
}
|
|
130
135
|
}
|
|
@@ -31,6 +31,7 @@ export async function _buildTypes(options: {
|
|
|
31
31
|
|
|
32
32
|
const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics)
|
|
33
33
|
|
|
34
|
+
// TODO: improve logging
|
|
34
35
|
allDiagnostics.forEach((diagnostic) => {
|
|
35
36
|
if (diagnostic.file && diagnostic.start) {
|
|
36
37
|
const {line, character} = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start)
|
|
@@ -6,11 +6,19 @@ export function _createApiExtractorConfig(options: {
|
|
|
6
6
|
exportPath: string
|
|
7
7
|
filePath: string
|
|
8
8
|
messages: IExtractorMessagesConfig
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
projectFolder: string
|
|
10
|
+
mainEntryPointFilePath: string
|
|
11
11
|
tsconfigPath: string
|
|
12
12
|
}): IConfigFile {
|
|
13
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
distPath,
|
|
15
|
+
exportPath,
|
|
16
|
+
filePath,
|
|
17
|
+
messages,
|
|
18
|
+
projectFolder,
|
|
19
|
+
mainEntryPointFilePath,
|
|
20
|
+
tsconfigPath,
|
|
21
|
+
} = options
|
|
14
22
|
|
|
15
23
|
return {
|
|
16
24
|
apiReport: {
|
|
@@ -35,7 +43,7 @@ export function _createApiExtractorConfig(options: {
|
|
|
35
43
|
enabled: false,
|
|
36
44
|
},
|
|
37
45
|
messages,
|
|
38
|
-
mainEntryPointFilePath
|
|
39
|
-
projectFolder
|
|
46
|
+
mainEntryPointFilePath,
|
|
47
|
+
projectFolder,
|
|
40
48
|
}
|
|
41
49
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {rename} from 'fs/promises'
|
|
2
1
|
import path from 'path'
|
|
3
2
|
import {promisify} from 'util'
|
|
4
3
|
import {ExtractorMessage} from '@microsoft/api-extractor'
|
|
5
|
-
import cpx from 'cpx'
|
|
6
4
|
import rimrafCallback from 'rimraf'
|
|
7
5
|
import {_BuildContext} from '../../_core'
|
|
8
6
|
import {_buildTypes} from './_buildTypes'
|
|
@@ -12,25 +10,30 @@ import {_DtsResult, _DtsTask, _DtsWatchTask} from './_types'
|
|
|
12
10
|
|
|
13
11
|
const rimraf = promisify(rimrafCallback)
|
|
14
12
|
|
|
13
|
+
/**
|
|
14
|
+
* - Build type definitions to a temporary directory using TypeScript compiler.
|
|
15
|
+
* - Create a type definition bundle for each export entry.
|
|
16
|
+
* - When done, remove the temporary directory.
|
|
17
|
+
*/
|
|
15
18
|
export async function _doExtract(
|
|
16
19
|
ctx: _BuildContext,
|
|
17
20
|
task: _DtsTask | _DtsWatchTask
|
|
18
21
|
): Promise<_DtsResult> {
|
|
19
|
-
const {config, cwd,
|
|
22
|
+
const {config, cwd, files, ts} = ctx
|
|
20
23
|
|
|
21
24
|
if (!ts.config || !ts.configPath) {
|
|
22
25
|
return {type: 'dts', messages: [], results: []}
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
const
|
|
28
|
+
const {outDir, rootDir = cwd} = ts.config.options
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
if (!outDir) {
|
|
31
|
+
throw new Error('tsconfig.json is missing `compilerOptions.outDir`')
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const tmpPath = path.resolve(outDir, '__tmp__')
|
|
28
35
|
|
|
29
|
-
await _buildTypes({
|
|
30
|
-
cwd,
|
|
31
|
-
outDir: outDir,
|
|
32
|
-
tsconfig: ts.config,
|
|
33
|
-
})
|
|
36
|
+
await _buildTypes({cwd, outDir: tmpPath, tsconfig: ts.config})
|
|
34
37
|
|
|
35
38
|
const messages: ExtractorMessage[] = []
|
|
36
39
|
|
|
@@ -39,48 +42,34 @@ export async function _doExtract(
|
|
|
39
42
|
for (const entry of task.entries) {
|
|
40
43
|
const exportPath = entry.exportPath === '.' ? './index' : entry.exportPath
|
|
41
44
|
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
path.relative(cwd,
|
|
45
|
-
entry.sourcePath.replace(/\.ts$/, '.d.ts')
|
|
45
|
+
const sourceTypesPath = path.resolve(
|
|
46
|
+
tmpPath,
|
|
47
|
+
path.relative(rootDir, path.resolve(cwd, entry.sourcePath)).replace(/\.ts$/, '.d.ts')
|
|
46
48
|
)
|
|
47
49
|
|
|
48
|
-
const
|
|
50
|
+
const targetPath = path.resolve(cwd, entry.targetPath)
|
|
49
51
|
|
|
50
52
|
const result = await _extractTypes({
|
|
51
53
|
cwd,
|
|
52
54
|
exportPath,
|
|
53
55
|
files,
|
|
54
|
-
filePath,
|
|
56
|
+
filePath: path.relative(outDir, targetPath),
|
|
55
57
|
projectPath: cwd,
|
|
56
58
|
rules: config?.extract?.rules,
|
|
57
|
-
|
|
58
|
-
tsconfigPath: path.resolve(cwd, ts.configPath),
|
|
59
|
-
distPath,
|
|
59
|
+
sourceTypesPath: sourceTypesPath,
|
|
60
|
+
tsconfigPath: path.resolve(cwd, ts.configPath || 'tsconfig.json'),
|
|
61
|
+
distPath: outDir,
|
|
60
62
|
})
|
|
61
63
|
|
|
62
|
-
results.push({sourcePath, filePath})
|
|
63
|
-
|
|
64
64
|
messages.push(...result.messages)
|
|
65
65
|
|
|
66
66
|
if (result.messages.some((msg) => msg.logLevel === 'error')) {
|
|
67
|
+
await rimraf(tmpPath)
|
|
68
|
+
|
|
67
69
|
throw new _DtsError('encountered errors when extracting types', result.messages)
|
|
68
70
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const tmpPath = path.resolve(distPath, '__tmp__')
|
|
72
|
-
|
|
73
|
-
await rename(outDir, tmpPath)
|
|
74
|
-
|
|
75
|
-
for (const result of results) {
|
|
76
|
-
const fromPath = path.resolve(
|
|
77
|
-
tmpPath,
|
|
78
|
-
path.relative(outDir, path.resolve(distPath, result.filePath))
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
const toPath = path.resolve(distPath, result.filePath)
|
|
82
71
|
|
|
83
|
-
|
|
72
|
+
results.push({sourcePath: path.resolve(cwd, entry.sourcePath), filePath: targetPath})
|
|
84
73
|
}
|
|
85
74
|
|
|
86
75
|
await rimraf(tmpPath)
|
|
@@ -29,10 +29,10 @@ export async function _extractTypes(options: {
|
|
|
29
29
|
files: _BuildFile[]
|
|
30
30
|
projectPath: string
|
|
31
31
|
rules?: NonNullable<PkgConfigOptions['extract']>['rules']
|
|
32
|
-
|
|
32
|
+
sourceTypesPath: string
|
|
33
33
|
tsconfigPath: string
|
|
34
34
|
}): Promise<{extractorResult: ExtractorResult; messages: ExtractorMessage[]}> {
|
|
35
|
-
const {distPath, exportPath, files, filePath, projectPath, rules,
|
|
35
|
+
const {distPath, exportPath, files, filePath, projectPath, rules, sourceTypesPath, tsconfigPath} =
|
|
36
36
|
options
|
|
37
37
|
|
|
38
38
|
const tsdocConfigFile = await _createTSDocConfig({
|
|
@@ -116,8 +116,8 @@ export async function _extractTypes(options: {
|
|
|
116
116
|
exportPath,
|
|
117
117
|
filePath,
|
|
118
118
|
messages: messagesConfig,
|
|
119
|
-
projectPath,
|
|
120
|
-
|
|
119
|
+
projectFolder: projectPath,
|
|
120
|
+
mainEntryPointFilePath: sourceTypesPath,
|
|
121
121
|
tsconfigPath,
|
|
122
122
|
}),
|
|
123
123
|
configObjectFullPath: undefined,
|
package/src/node/check.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
|
|
3
1
|
import path from 'path'
|
|
4
|
-
import chalk from 'chalk'
|
|
5
2
|
import esbuild, {BuildFailure} from 'esbuild'
|
|
6
3
|
import {_loadConfig, _loadPkgWithReporting} from './_core'
|
|
7
4
|
import {_fileExists, _printPackageTree} from './_printPackageTree'
|
|
@@ -18,6 +15,7 @@ export async function check(options: {
|
|
|
18
15
|
const pkg = await _loadPkgWithReporting({cwd})
|
|
19
16
|
const config = await _loadConfig({cwd})
|
|
20
17
|
const ctx = await _resolveBuildContext({config, cwd, pkg, tsconfig})
|
|
18
|
+
const {logger} = ctx
|
|
21
19
|
|
|
22
20
|
_printPackageTree(ctx)
|
|
23
21
|
|
|
@@ -44,7 +42,8 @@ export async function check(options: {
|
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
if (missingFiles.length) {
|
|
47
|
-
|
|
45
|
+
logger.error('missing files')
|
|
46
|
+
process.exit(1)
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
// Check if the files are resolved
|
|
@@ -53,10 +52,10 @@ export async function check(options: {
|
|
|
53
52
|
import: [],
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
for (const
|
|
55
|
+
for (const exp of Object.values(ctx.exports || {})) {
|
|
57
56
|
if (!exp._exported) continue
|
|
58
|
-
if (exp.require) _paths.require.push(
|
|
59
|
-
if (exp.import) _paths.import.push(
|
|
57
|
+
if (exp.require) _paths.require.push(exp.require)
|
|
58
|
+
if (exp.import) _paths.import.push(exp.import)
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
const external = Object.keys(pkg.dependencies || {}).concat(
|
|
@@ -83,24 +82,24 @@ export async function check(options: {
|
|
|
83
82
|
})
|
|
84
83
|
|
|
85
84
|
if (esbuildResult.warnings.length > 0) {
|
|
86
|
-
|
|
85
|
+
logger.warn(...esbuildResult.warnings)
|
|
87
86
|
}
|
|
88
87
|
} catch (err) {
|
|
89
88
|
const {errors} = err as BuildFailure
|
|
90
89
|
|
|
91
90
|
for (const _err of errors) {
|
|
92
91
|
if (_err.location) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
logger.error(_err.detail || _err.text)
|
|
93
|
+
logger.error(`${_err.location.line} | ${_err.location.lineText}`)
|
|
94
|
+
logger.error(
|
|
96
95
|
'in',
|
|
97
96
|
`./${_err.location.file}:${_err.location.line}:${_err.location.column}`
|
|
98
97
|
)
|
|
99
98
|
} else {
|
|
100
|
-
|
|
99
|
+
logger.error(_err.detail || _err.text)
|
|
101
100
|
}
|
|
102
101
|
|
|
103
|
-
|
|
102
|
+
logger.log()
|
|
104
103
|
}
|
|
105
104
|
|
|
106
105
|
process.exit(1)
|
|
@@ -125,11 +124,13 @@ export async function check(options: {
|
|
|
125
124
|
})
|
|
126
125
|
|
|
127
126
|
if (esbuildResult.errors.length > 0) {
|
|
128
|
-
throw new Error(esbuildResult.errors.join(', '))
|
|
127
|
+
// throw new Error(esbuildResult.errors.join(', '))
|
|
128
|
+
logger.error(esbuildResult.errors.join(', '))
|
|
129
|
+
process.exit(1)
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
if (esbuildResult.warnings.length > 0) {
|
|
132
|
-
|
|
133
|
+
logger.warn(...esbuildResult.warnings)
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
}
|
package/src/node/watch.ts
CHANGED
|
@@ -33,7 +33,7 @@ export async function watch(options: {cwd: string; tsconfig?: string}): Promise<
|
|
|
33
33
|
const watchTasks = _resolveWatchTasks(ctx)
|
|
34
34
|
|
|
35
35
|
for (const task of watchTasks) {
|
|
36
|
-
const handler = _watchTaskHandlers[task.type] as _TaskHandler<_WatchTask,
|
|
36
|
+
const handler = _watchTaskHandlers[task.type] as _TaskHandler<_WatchTask, unknown>
|
|
37
37
|
const result$ = handler.exec(ctx, task)
|
|
38
38
|
|
|
39
39
|
result$.subscribe({
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_build-be4da439.cjs","sources":["../src/node/_resolveBuildTasks.ts","../src/node/_spinner.ts","../src/node/build.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport {PkgExport, PkgFormat, PkgRuntime, _BuildContext, _MODULE_EXT} from './_core'\nimport {_BuildTask, _DtsTask, _RollupTask, _RollupTaskEntry} from './_tasks'\n\n/** @internal */\nexport function _resolveBuildTasks(ctx: _BuildContext): _BuildTask[] {\n const {cwd, pkg, target} = ctx\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 // 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: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:* 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: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 if (dtsTask.entries.length) {\n tasks.push(dtsTask)\n }\n\n tasks.push(...Object.values(rollupTasks))\n\n // Parse rollup:esm:browser tasks\n for (const exp of exports) {\n if (exp._exported && exp._path !== '.') {\n const relativeTargetPath = (exp.browser?.import || exp.import || '').replace(/\\.[^/.]+$/, '')\n const ext = _MODULE_EXT[pkg.type].esm\n\n if (relativeTargetPath) {\n fs.writeFileSync(\n path.resolve(cwd, `${exp._path}.js`),\n [\n `// AUTO-GENERATED – DO NOT EDIT`,\n ``,\n // `export {default} from '${relativeTargetPath}'`,\n `export * from '${relativeTargetPath}${pkg.type === 'commonjs' ? ext : ''}'`,\n ``,\n ].join('\\n')\n )\n }\n }\n }\n\n return tasks\n}\n","/* eslint-disable no-console */\n\nimport chalk from 'chalk'\n\nexport function _spinner(msg: string): {complete: () => void; error: () => void} {\n const startTime = Date.now()\n\n console.log(`${chalk.yellow('run ')} ${msg}`)\n\n return {\n complete: () => {\n console.log(`${chalk.green('ok ')} ${chalk.gray(`${Date.now() - startTime}ms`)}`)\n },\n error: () => {\n console.log(`${chalk.red(`failed`)} ${chalk.gray(`${Date.now() - startTime}ms`)}`)\n },\n }\n}\n","import {_loadConfig, _loadPkgWithReporting} from './_core'\nimport {_resolveBuildContext} from './_resolveBuildContext'\nimport {_resolveBuildTasks} from './_resolveBuildTasks'\nimport {_spinner} from './_spinner'\nimport {_BuildTask, _TaskHandler, _buildTaskHandlers} from './_tasks'\n\n/** @public */\nexport async function build(options: {cwd: string; tsconfig?: string}): Promise<void> {\n const {cwd, tsconfig = 'tsconfig.json'} = options\n\n const pkg = await _loadPkgWithReporting({cwd})\n const config = await _loadConfig({cwd})\n\n const ctx = await _resolveBuildContext({config, cwd, pkg, tsconfig})\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 = _spinner(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","cwd","pkg","target","tasks","exports","Object","entries","map","_path","exp","dtsTask","type","rollupTasks","_addRollupTaskEntry","format","runtime","entry","buildId","push","importId","path","join","name","types","exportPath","sourcePath","source","targetPath","output","require","browser","import","length","values","_exported","relativeTargetPath","replace","ext","_MODULE_EXT","esm","fs","writeFileSync","resolve","_spinner","msg","startTime","Date","now","console","log","chalk","yellow","complete","green","gray","error","red","build","options","tsconfig","_loadPkgWithReporting","config","_loadConfig","_resolveBuildContext","buildTasks","task","handler","_buildTaskHandlers","taskName","spinner","result","exec","toPromise","logger","err","Error","RE_CWD","RegExp","message","process","exit"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,SAASA,kBAAT,CAA4BC,GAA5B,EAAiC;EACtC,IAAIC,EAAJ,EAAQC,EAAR,EAAYC,EAAZ,EAAgBC,EAAhB,EAAoBC,EAApB;;EACA,MAAM;IAAEC,GAAF;IAAOC,GAAP;IAAYC;EAAZ,IAAuBR,GAA7B;EACA,MAAMS,KAAK,GAAG,EAAd;EACA,MAAMC,OAAO,GAAGC,MAAM,CAACC,OAAP,CAAeZ,GAAG,CAACU,OAAJ,IAAe,EAA9B,EAAkCG,GAAlC,CACd;IAAA,IAAC,CAACC,KAAD,EAAQC,GAAR,CAAD;IAAA;MAAqBD;IAArB,GAA+BC,GAA/B;EAAA,CADc,CAAhB;EAGA,MAAMC,OAAO,GAAG;IACdC,IAAI,EAAE,WADQ;IAEdL,OAAO,EAAE;EAFK,CAAhB;EAIA,MAAMM,WAAW,GAAG,EAApB;;EACA,SAASC,mBAAT,CAA6BC,MAA7B,EAAqCC,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a7E,GAAb,EAAkBuE,IAAlB,EAAwBO,SAAxB,EAArB;MACAH,OAAO,CAACjB,QAAR;MACA1D,GAAG,CAAC+E,MAAJ,CAAWxB,GAAX;MACAiB,OAAO,CAACd,QAAR,CAAiB1D,GAAjB,EAAsBuE,IAAtB,EAA4BK,MAA5B;IACD,CALD,CAKE,OAAOI,GAAP,EAAY;MACZL,OAAO,CAACd,KAAR;;MACA,IAAImB,GAAG,YAAYC,KAAnB,EAA0B;QACxB,MAAMC,MAAM,GAAG,IAAIC,MAAJ,WAAc7E,GAAd,GAAqB,GAArB,CAAf;QACAN,GAAG,CAAC+E,MAAJ,CAAWlB,KAAX,CAAiBmB,GAAG,CAACI,OAAJ,CAAY1C,OAAZ,CAAoBwC,MAApB,EAA4B,GAA5B,CAAjB;QACAlF,GAAG,CAAC+E,MAAJ,CAAWxB,GAAX;MACD;;MACDiB,OAAO,CAACX,KAAR,CAAc7D,GAAd,EAAmBuE,IAAnB,EAAyBS,GAAzB;MACAK,OAAO,CAACC,IAAR,CAAa,CAAb;IACD;EACF;AACH;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_check-11811a4d.cjs","sources":["../src/node/_getFilesize.ts","../src/node/_printPackageTree.ts","../src/node/check.ts"],"sourcesContent":["import {statSync} from 'fs'\nimport prettyBytes from 'pretty-bytes'\n\nexport function _getFilesize(file: string): string {\n const stats = statSync(file)\n\n return prettyBytes(stats.size)\n}\n","import fs from 'fs'\nimport path from 'path'\nimport chalk from 'chalk'\nimport treeify from 'treeify'\nimport {PkgExport, _BuildContext} from './_core'\nimport {_getFilesize} from './_getFilesize'\n\nexport function _fileExists(file: string): boolean {\n try {\n fs.accessSync(file)\n\n return true\n } catch (_) {\n return false\n }\n}\n\nfunction _getFileInfo(cwd: string, filePath: string) {\n const p = path.resolve(cwd, filePath)\n const exists = _fileExists(p)\n const size = exists ? _getFilesize(p) : undefined\n\n return {exists, size}\n}\n\nexport function _printPackageTree(ctx: _BuildContext): void {\n const {cwd, exports, logger, pkg} = ctx\n\n if (!exports) return\n\n logger.log(`${chalk.blue(pkg.name)}@${chalk.green(pkg.version)}`)\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const tree: Record<string, any> = {}\n\n if (pkg.bin) {\n tree.bin = pkg.bin\n }\n\n function _fileInfo(file: string) {\n const info = _getFileInfo(cwd, file)\n\n if (!info.size) {\n return `${chalk.gray(file)} ${chalk.red('does not exist')}`\n }\n\n return `${file} ${chalk.gray(info.size)}`\n }\n\n tree.exports = Object.fromEntries(\n Object.entries(exports)\n .filter(([, entry]) => entry._exported)\n .map(([exportPath, entry]) => {\n const exp: Omit<PkgExport, '_exported'> = {source: entry.source, default: entry.default}\n\n if (entry.types) exp.types = _fileInfo(entry.types)\n\n if (entry.browser) {\n exp.browser = {source: entry.browser.source}\n\n if (entry.browser.import) exp.browser.import = _fileInfo(entry.browser.import)\n if (entry.browser.require) exp.browser.import = _fileInfo(entry.browser.require)\n }\n\n if (entry.node) {\n exp.node = {source: entry.node.source}\n\n if (entry.node.import) exp.node.import = _fileInfo(entry.node.import)\n if (entry.node.require) exp.node.import = _fileInfo(entry.node.require)\n }\n\n if (entry.import) exp.import = _fileInfo(entry.import)\n if (entry.require) exp.require = _fileInfo(entry.require)\n\n exp.default = _fileInfo(entry.default)\n\n return [chalk.green(path.join(pkg.name, exportPath)), exp]\n })\n )\n\n logger.log(treeify.asTree(tree, true, true))\n}\n","/* eslint-disable no-console */\n\nimport path from 'path'\nimport chalk from 'chalk'\nimport esbuild, {BuildFailure} from 'esbuild'\nimport {_loadConfig, _loadPkgWithReporting} from './_core'\nimport {_fileExists, _printPackageTree} from './_printPackageTree'\nimport {_resolveBuildContext} from './_resolveBuildContext'\n\n/** @public */\nexport async function check(options: {\n cwd: string\n strict?: boolean\n tsconfig?: string\n}): Promise<void> {\n const {cwd, strict, tsconfig = 'tsconfig.json'} = options\n\n const pkg = await _loadPkgWithReporting({cwd})\n const config = await _loadConfig({cwd})\n const ctx = await _resolveBuildContext({config, cwd, pkg, tsconfig})\n\n _printPackageTree(ctx)\n\n if (strict) {\n const missingFiles: string[] = []\n\n // Check if there are missing files\n for (const [, exp] of Object.entries(ctx.exports || {})) {\n if (exp.source && !_fileExists(path.resolve(cwd, exp.source))) {\n missingFiles.push(exp.source)\n }\n\n if (exp.require && !_fileExists(path.resolve(cwd, exp.require))) {\n missingFiles.push(exp.require)\n }\n\n if (exp.import && !_fileExists(path.resolve(cwd, exp.import))) {\n missingFiles.push(exp.import)\n }\n\n if (exp.types && !_fileExists(path.resolve(cwd, exp.types))) {\n missingFiles.push(exp.types)\n }\n }\n\n if (missingFiles.length) {\n throw new Error('missing files')\n }\n\n // Check if the files are resolved\n const _paths: {require: string[]; import: string[]} = {\n require: [],\n import: [],\n }\n\n for (const [exportPath, exp] of Object.entries(ctx.exports || {})) {\n if (!exp._exported) continue\n if (exp.require) _paths.require.push(exportPath)\n if (exp.import) _paths.import.push(exportPath)\n }\n\n const external = Object.keys(pkg.dependencies || {}).concat(\n Object.keys(pkg.devDependencies || {})\n )\n\n if (_paths.import.length) {\n const code = _paths.import.map((id) => `import('${id}')`).join('\\n')\n\n try {\n const esbuildResult = await esbuild.build({\n external,\n stdin: {\n contents: code,\n loader: 'js',\n resolveDir: cwd,\n },\n format: 'esm',\n bundle: true,\n logLevel: 'silent',\n // otherwise output maps to stdout as we're using stdin\n outfile: '/dev/null',\n platform: 'node',\n })\n\n if (esbuildResult.warnings.length > 0) {\n console.warn(...esbuildResult.warnings)\n }\n } catch (err) {\n const {errors} = err as BuildFailure\n\n for (const _err of errors) {\n if (_err.location) {\n console.log(chalk.red('error'), _err.detail || _err.text)\n console.log(`${_err.location.line} | ${_err.location.lineText}`)\n console.log(\n 'in',\n `./${_err.location.file}:${_err.location.line}:${_err.location.column}`\n )\n } else {\n console.log(_err.detail || _err.text)\n }\n\n console.log()\n }\n\n process.exit(1)\n }\n }\n\n if (_paths.require.length) {\n const code = _paths.require.map((id) => `require('${id}')`).join('\\n')\n\n const esbuildResult = await esbuild.build({\n external,\n stdin: {\n contents: code,\n loader: 'js',\n resolveDir: cwd,\n },\n format: 'cjs',\n bundle: true,\n // otherwise output maps to stdout as we're using stdin\n outfile: '/dev/null',\n platform: 'node',\n })\n\n if (esbuildResult.errors.length > 0) {\n throw new Error(esbuildResult.errors.join(', '))\n }\n\n if (esbuildResult.warnings.length > 0) {\n console.warn(...esbuildResult.warnings)\n }\n }\n }\n}\n"],"names":["_getFilesize","file","stats","statSync","prettyBytes","size","_fileExists","fs","accessSync","_","_getFileInfo","cwd","filePath","p","path","resolve","exists","_printPackageTree","ctx","exports","logger","pkg","log","chalk","blue","name","green","version","tree","bin","_fileInfo","info","gray","red","Object","fromEntries","entries","filter","entry","_exported","map","exportPath","exp","source","default","types","browser","import","require","node","join","treeify","asTree","check","options","strict","tsconfig","_loadPkgWithReporting","config","_loadConfig","_resolveBuildContext","missingFiles","push","length","Error","_paths","external","keys","dependencies","concat","devDependencies","code","id","esbuildResult","esbuild","build","stdin","contents","loader","resolveDir","format","bundle","logLevel","outfile","platform","warnings","console","warn","err","errors","_err","location","detail","text","line","lineText","column","process","exit"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,SAASA,YAAT,CAAsBC,IAAtB,EAA4B;EACjC,MAAMC,KAAK,GAAGC,WAAAA,CAASF,IAATE,CAAd;EACA,OAAOC,oBAAW,CAAA,SAAA,CAAXA,CAAYF,KAAK,CAACG,IAAlBD,CAAP;AACF;;ACAO,SAASE,WAAT,CAAqBL,IAArB,EAA2B;EAChC,IAAI;IACFM,sBAAAA,CAAGC,UAAHD,CAAcN,IAAdM;IACA,OAAO,IAAP;EACD,CAHD,CAGE,OAAOE,CAAP,EAAU;IACV,OAAO,KAAP;EACD;AACF;;AACD,SAASC,YAAT,CAAsBC,GAAtB,EAA2BC,QAA3B,EAAqC;EACnC,MAAMC,CAAC,GAAGC,aAAI,CAAA,SAAA,CAAJA,CAAK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