jiek 2.2.7 → 2.3.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/bin/build.cjs +2 -0
- package/bin/index.cjs +2 -0
- package/bin-helper/index.cjs +19 -31
- package/dist/.internal/.chunks/filterSupport.4rM7f6jB.cjs +114 -0
- package/dist/.internal/.chunks/filterSupport.BXWpLBpT.js +104 -0
- package/dist/{cli.js → .internal/.chunks/index.B6RQz1DZ.js} +1 -737
- package/dist/.internal/.chunks/index.BHuJRlvZ.js +9059 -0
- package/dist/.internal/.chunks/index.Daihq2aI.cjs +9071 -0
- package/dist/{cli.cjs → .internal/.chunks/index.DlHFuTjM.cjs} +1 -759
- package/dist/.internal/.chunks/loadConfig.CFfzkm_p.js +110 -0
- package/dist/.internal/.chunks/loadConfig.OOKddvHF.cjs +117 -0
- package/dist/{cli-only-build.cjs → .internal/bin/common.cjs} +225 -444
- package/dist/.internal/bin/common.d.cts +18 -0
- package/dist/.internal/bin/common.d.ts +18 -0
- package/dist/{cli-only-build.js → .internal/bin/common.js} +220 -438
- package/dist/.internal/bin/parseArgv.cjs +33 -0
- package/dist/.internal/bin/parseArgv.d.cts +5 -0
- package/dist/.internal/bin/parseArgv.d.ts +5 -0
- package/dist/.internal/bin/parseArgv.js +27 -0
- package/dist/.internal/bridge.cjs +30 -0
- package/dist/.internal/bridge.d.cts +39 -0
- package/dist/.internal/bridge.d.ts +39 -0
- package/dist/.internal/bridge.js +27 -0
- package/dist/.internal/rollup/base.cjs +10 -0
- package/dist/{cli-only-build.d.cts → .internal/rollup/base.d.cts} +8 -15
- package/dist/{cli-only-build.d.ts → .internal/rollup/base.d.ts} +8 -15
- package/dist/.internal/rollup/base.js +7 -0
- package/dist/.internal/rollup/bundle-analyzer.cjs +51 -0
- package/dist/.internal/rollup/bundle-analyzer.d.cts +92 -0
- package/dist/.internal/rollup/bundle-analyzer.d.ts +92 -0
- package/dist/.internal/rollup/bundle-analyzer.js +45 -0
- package/dist/.internal/utils/filterSupport.cjs +18 -0
- package/dist/.internal/utils/filterSupport.d.cts +15 -0
- package/dist/.internal/utils/filterSupport.d.ts +15 -0
- package/dist/.internal/utils/filterSupport.js +8 -0
- package/dist/.internal/utils/getInternalModuleName.cjs +5 -0
- package/dist/.internal/utils/getInternalModuleName.d.cts +3 -0
- package/dist/.internal/utils/getInternalModuleName.d.ts +3 -0
- package/dist/.internal/utils/getInternalModuleName.js +3 -0
- package/dist/.internal/utils/intersection.cjs +5 -0
- package/dist/.internal/utils/intersection.d.cts +3 -0
- package/dist/.internal/utils/intersection.d.ts +3 -0
- package/dist/.internal/utils/intersection.js +3 -0
- package/dist/.internal/utils/loadConfig.cjs +14 -0
- package/dist/.internal/utils/loadConfig.d.cts +10 -0
- package/dist/.internal/utils/loadConfig.d.ts +10 -0
- package/dist/.internal/utils/loadConfig.js +9 -0
- package/dist/.internal/utils/recursiveListFiles.cjs +19 -0
- package/dist/.internal/utils/recursiveListFiles.d.cts +3 -0
- package/dist/.internal/utils/recursiveListFiles.d.ts +3 -0
- package/dist/.internal/utils/recursiveListFiles.js +13 -0
- package/dist/.internal/utils/resolveExports.cjs +118 -0
- package/dist/.internal/utils/resolveExports.d.cts +26 -0
- package/dist/.internal/utils/resolveExports.d.ts +26 -0
- package/dist/.internal/utils/resolveExports.js +111 -0
- package/dist/.internal/utils/ts.cjs +68 -0
- package/dist/.internal/utils/ts.d.cts +3 -0
- package/dist/.internal/utils/ts.d.ts +3 -0
- package/dist/.internal/utils/ts.js +62 -0
- package/dist/bin/build.cjs +10 -0
- package/dist/bin/index.cjs +501 -0
- package/dist/index.d.cts +12 -114
- package/dist/index.d.ts +12 -114
- package/dist/rollup/index.cjs +280 -4573
- package/dist/rollup/index.d.cts +7 -1
- package/dist/rollup/index.d.ts +7 -1
- package/dist/rollup/index.js +268 -4558
- package/package.json +15 -23
- package/src/bin/build.cts +5 -0
- package/src/bin/common.ts +3 -0
- package/src/bin/index.cts +7 -0
- package/src/bridge.ts +1 -1
- package/src/commands/base.ts +3 -3
- package/src/commands/build/analyzer.ts +5 -5
- package/src/commands/build/client/analyzer.tsx +1 -1
- package/src/commands/build/client/index.ts +5 -7
- package/src/commands/build.ts +226 -211
- package/src/commands/meta.ts +1 -1
- package/src/commands/publish.ts +113 -32
- package/src/index.ts +6 -1
- package/src/rollup/base.ts +2 -2
- package/src/rollup/index.ts +321 -124
- package/src/rollup/plugins/with-external.ts +23 -0
- package/src/rollup/utils/externalResolver.ts +20 -8
- package/src/utils/checkDependency.ts +1 -1
- package/src/utils/filterSupport.ts +17 -16
- package/src/utils/getInternalModuleName.ts +5 -0
- package/src/utils/intersection.ts +1 -0
- package/src/utils/{recusiveListFiles.ts → recursiveListFiles.ts} +2 -2
- package/src/utils/{getExports.ts → resolveExports.ts} +16 -14
- package/bin/jiek-build.js +0 -16
- package/bin/jiek.js +0 -13
- package/cli/package.json +0 -1
- package/cli-only-build/package.json +0 -1
- package/dist/cli.d.cts +0 -14
- package/dist/cli.d.ts +0 -14
- package/src/cli-only-build.ts +0 -11
- package/src/cli.ts +0 -6
- /package/{src/bin/build.ts → .jiek-production-tag} +0 -0
- /package/src/{parseArgv.ts → bin/parseArgv.ts} +0 -0
@@ -1,5 +1,6 @@
|
|
1
1
|
import fs from 'node:fs'
|
2
2
|
import { builtinModules } from 'node:module'
|
3
|
+
import process from 'node:process'
|
3
4
|
|
4
5
|
const EXCLUDE_SUFFIX = [
|
5
6
|
'te?xt',
|
@@ -7,21 +8,32 @@ const EXCLUDE_SUFFIX = [
|
|
7
8
|
'(css|s[ac]ss|less|styl)'
|
8
9
|
]
|
9
10
|
|
10
|
-
export
|
11
|
+
export interface PackageJSON {
|
12
|
+
name: string
|
13
|
+
type?: string
|
14
|
+
bin?: string | Record<string, string>
|
15
|
+
exports?: Record<string, unknown> | string | string[]
|
16
|
+
imports?: Record<string, unknown>
|
17
|
+
dependencies?: Record<string, unknown>
|
18
|
+
peerDependencies?: Record<string, unknown>
|
19
|
+
optionalDependencies?: Record<string, unknown>
|
20
|
+
}
|
21
|
+
|
22
|
+
export default function(json: PackageJSON): (string | RegExp)[]
|
11
23
|
export default function(path?: string): (string | RegExp)[]
|
12
|
-
export default function(jsonOrPath: string |
|
13
|
-
const pkg = typeof jsonOrPath === 'string'
|
24
|
+
export default function(jsonOrPath: string | PackageJSON = process.cwd()): (string | RegExp)[] {
|
25
|
+
const pkg: PackageJSON = typeof jsonOrPath === 'string'
|
14
26
|
? fs.existsSync(`${jsonOrPath}/package.json`)
|
15
|
-
? JSON.parse(fs.readFileSync(`${jsonOrPath}/package.json`, 'utf-8'))
|
16
|
-
: {}
|
27
|
+
? JSON.parse(fs.readFileSync(`${jsonOrPath}/package.json`, 'utf-8')) as PackageJSON
|
28
|
+
: {} as PackageJSON
|
17
29
|
: jsonOrPath
|
18
30
|
const { name, dependencies = {}, peerDependencies = {}, optionalDependencies = {} } = pkg
|
19
|
-
if (
|
31
|
+
if (name == null) {
|
20
32
|
throw new Error('package.json must have a name field')
|
21
33
|
}
|
22
34
|
|
23
|
-
const external = <(string | RegExp)[]>
|
24
|
-
.keys(dependencies)
|
35
|
+
const external = (<(string | RegExp)[]> [])
|
36
|
+
.concat(Object.keys(dependencies))
|
25
37
|
.concat(Object.keys(peerDependencies))
|
26
38
|
.concat(Object.keys(optionalDependencies))
|
27
39
|
.concat(builtinModules)
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import fs from 'node:fs'
|
2
2
|
import path from 'node:path'
|
3
|
+
import process from 'node:process'
|
3
4
|
|
4
5
|
import { program } from 'commander'
|
5
6
|
import { load } from 'js-yaml'
|
6
7
|
|
7
|
-
import { getRoot } from '#~/utils/getRoot
|
8
|
-
import { getWD } from '#~/utils/getWD
|
8
|
+
import { getRoot } from '#~/utils/getRoot'
|
9
|
+
import { getWD } from '#~/utils/getWD'
|
9
10
|
|
10
11
|
export let type = ''
|
11
12
|
|
@@ -14,14 +15,16 @@ try {
|
|
14
15
|
type = 'pnpm'
|
15
16
|
} catch { /* empty */ }
|
16
17
|
|
18
|
+
export interface Manifest {
|
19
|
+
name?: string
|
20
|
+
type?: string
|
21
|
+
exports?: string | string[] | Record<string, unknown>
|
22
|
+
imports?: Record<string, unknown>
|
23
|
+
}
|
24
|
+
|
17
25
|
export interface ProjectsGraph {
|
18
|
-
wd: string
|
19
26
|
root?: string
|
20
|
-
value?: Record<string,
|
21
|
-
name?: string
|
22
|
-
type?: string
|
23
|
-
exports?: string | string[] | Record<string, unknown>
|
24
|
-
}>
|
27
|
+
value?: Record<string, Manifest>
|
25
28
|
}
|
26
29
|
|
27
30
|
export async function filterPackagesGraph(filters: string[]): Promise<ProjectsGraph[]> {
|
@@ -29,16 +32,15 @@ export async function filterPackagesGraph(filters: string[]): Promise<ProjectsGr
|
|
29
32
|
}
|
30
33
|
|
31
34
|
export async function getSelectedProjectsGraph(
|
32
|
-
filter = program.getOptionValue('filter')
|
35
|
+
filter = program.getOptionValue('filter') as string | undefined
|
33
36
|
): Promise<ProjectsGraph> {
|
34
37
|
const { wd, notWorkspace } = getWD()
|
35
38
|
let root = getRoot()
|
36
39
|
if (notWorkspace) {
|
37
40
|
return {
|
38
|
-
wd,
|
39
41
|
root,
|
40
42
|
value: {
|
41
|
-
[wd]: JSON.parse(fs.readFileSync(path.resolve(wd, 'package.json'), 'utf-8'))
|
43
|
+
[wd]: JSON.parse(fs.readFileSync(path.resolve(wd, 'package.json'), 'utf-8')) as Manifest
|
42
44
|
}
|
43
45
|
}
|
44
46
|
}
|
@@ -48,20 +50,20 @@ export async function getSelectedProjectsGraph(
|
|
48
50
|
const pnpmWorkspace = load(pnpmWorkspaceFileContent) as {
|
49
51
|
packages: string[]
|
50
52
|
}
|
51
|
-
if (root === wd &&
|
53
|
+
if (root === wd && (filter == null)) {
|
52
54
|
throw new Error('root path is workspace root, please provide a filter')
|
53
55
|
// TODO inquirer prompt support user select packages
|
54
56
|
}
|
55
57
|
if (root === undefined) {
|
56
58
|
root = process.cwd()
|
57
59
|
}
|
58
|
-
if (root !== wd &&
|
60
|
+
if (root !== wd && (filter == null)) {
|
59
61
|
const packageJSONIsExist = fs.existsSync(path.resolve(root, 'package.json'))
|
60
62
|
if (!packageJSONIsExist) {
|
61
63
|
throw new Error('root path is not workspace root, please provide a filter')
|
62
64
|
}
|
63
|
-
const packageJSON = JSON.parse(fs.readFileSync(path.resolve(root, 'package.json'), 'utf-8'))
|
64
|
-
if (
|
65
|
+
const packageJSON = JSON.parse(fs.readFileSync(path.resolve(root, 'package.json'), 'utf-8')) as Manifest
|
66
|
+
if (packageJSON.name == null) {
|
65
67
|
throw new Error('root path is not workspace root, please provide a filter')
|
66
68
|
}
|
67
69
|
filter = packageJSON.name
|
@@ -76,7 +78,6 @@ export async function getSelectedProjectsGraph(
|
|
76
78
|
patterns: pnpmWorkspace.packages
|
77
79
|
})
|
78
80
|
return {
|
79
|
-
wd,
|
80
81
|
root,
|
81
82
|
value: Object.entries(selectedProjectsGraph)
|
82
83
|
.reduce((acc, [key, value]) => {
|
@@ -0,0 +1 @@
|
|
1
|
+
export const intersection = <T>(a: Iterable<T>, b: Set<T>) => new Set([...a].filter(i => b.has(i)))
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import fs from 'node:fs'
|
2
2
|
import { resolve } from 'node:path'
|
3
3
|
|
4
|
-
export const
|
4
|
+
export const recursiveListFiles = (dir: string): string[] =>
|
5
5
|
fs.readdirSync(dir).reduce((acc, file) => {
|
6
6
|
const filePath = resolve(dir, file)
|
7
7
|
if (fs.statSync(filePath).isDirectory()) {
|
8
8
|
if (filePath.endsWith('/node_modules')) return acc
|
9
9
|
|
10
|
-
return [...acc, ...
|
10
|
+
return [...acc, ...recursiveListFiles(filePath)]
|
11
11
|
}
|
12
12
|
return [...acc, filePath]
|
13
13
|
}, [] as string[])
|
@@ -12,7 +12,7 @@ import {
|
|
12
12
|
import type { Config } from 'jiek'
|
13
13
|
import { isMatch } from 'micromatch'
|
14
14
|
|
15
|
-
|
15
|
+
import { intersection } from '#~/utils/intersection'
|
16
16
|
|
17
17
|
const {
|
18
18
|
JIEK_OUT_DIR,
|
@@ -58,7 +58,20 @@ export function getOutDirs({
|
|
58
58
|
}
|
59
59
|
}
|
60
60
|
|
61
|
-
export
|
61
|
+
export interface ResolveExportsOptions {
|
62
|
+
entrypoints: string | string[] | Record<string, unknown>
|
63
|
+
pkgName: string
|
64
|
+
pkgIsModule: boolean
|
65
|
+
entries?: string[]
|
66
|
+
config?: Config
|
67
|
+
dir?: string
|
68
|
+
outdir?: string
|
69
|
+
defaultOutdir?: string
|
70
|
+
noFilter?: boolean
|
71
|
+
isPublish?: boolean
|
72
|
+
}
|
73
|
+
|
74
|
+
export function resolveExports({
|
62
75
|
entrypoints,
|
63
76
|
pkgName,
|
64
77
|
pkgIsModule,
|
@@ -70,18 +83,7 @@ export function getExports({
|
|
70
83
|
outdir = getOutDirs({ pkgName, defaultOutdir, config, cwd: dir }).js,
|
71
84
|
noFilter,
|
72
85
|
isPublish
|
73
|
-
}: {
|
74
|
-
entrypoints: string | string[] | Record<string, unknown>
|
75
|
-
pkgName: string
|
76
|
-
pkgIsModule: boolean
|
77
|
-
entries?: string[]
|
78
|
-
config?: Config
|
79
|
-
dir?: string
|
80
|
-
outdir?: string
|
81
|
-
defaultOutdir?: string
|
82
|
-
noFilter?: boolean
|
83
|
-
isPublish?: boolean
|
84
|
-
}) {
|
86
|
+
}: ResolveExportsOptions) {
|
85
87
|
const {
|
86
88
|
build = {},
|
87
89
|
publish: {
|
package/bin/jiek-build.js
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
import { existsSync } from 'node:fs'
|
3
|
-
import { createRequire } from 'node:module'
|
4
|
-
import { dirname, resolve } from 'node:path'
|
5
|
-
import process from 'node:process'
|
6
|
-
|
7
|
-
process.env.JIEK_IS_ONLY_BUILD = 'true'
|
8
|
-
|
9
|
-
const __dirname = dirname(import.meta.url.replace('file://', ''))
|
10
|
-
if (existsSync(resolve(__dirname, '../.jiek-dev-tag'))) {
|
11
|
-
const require = createRequire(import.meta.url)
|
12
|
-
require('esbuild-register')
|
13
|
-
require('../src/cli-only-build.ts')
|
14
|
-
} else {
|
15
|
-
import('jiek/cli-only-build')
|
16
|
-
}
|
package/bin/jiek.js
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
import { existsSync } from 'node:fs'
|
3
|
-
import { createRequire } from 'node:module'
|
4
|
-
import { dirname, resolve } from 'node:path'
|
5
|
-
|
6
|
-
const __dirname = dirname(import.meta.url.replace('file://', ''))
|
7
|
-
if (existsSync(resolve(__dirname, '../.jiek-dev-tag'))) {
|
8
|
-
const require = createRequire(import.meta.url)
|
9
|
-
require('esbuild-register')
|
10
|
-
require('../src/cli.ts')
|
11
|
-
} else {
|
12
|
-
import('jiek/cli')
|
13
|
-
}
|
package/cli/package.json
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"type":"module","module":"../dist/cli.js","main":"../dist/cli.cjs"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"type":"module","module":"../dist/cli-only-build.js","main":"../dist/cli-only-build.cjs"}
|
package/dist/cli.d.cts
DELETED
package/dist/cli.d.ts
DELETED
package/src/cli-only-build.ts
DELETED
package/src/cli.ts
DELETED
File without changes
|
File without changes
|