jiek 2.2.6 → 2.2.7-alpha.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.
- package/bin/build.cjs +2 -0
- package/bin/index.cjs +2 -0
- package/bin-helper/index.cjs +31 -0
- package/bin-helper/index.d.cts +1 -0
- package/bin-helper/index.d.ts +1 -0
- package/bin-helper/package.json +5 -1
- 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 +12 -0
- package/dist/.internal/+/bridge.d.cts +39 -0
- package/dist/.internal/+/bridge.d.ts +39 -0
- package/dist/.internal/+/bridge.js +9 -0
- package/dist/.internal/+/commands/build/analyzer.cjs +201 -0
- package/dist/.internal/+/commands/build/analyzer.d.cts +30 -0
- package/dist/.internal/+/commands/build/analyzer.d.ts +30 -0
- package/dist/.internal/+/commands/build/analyzer.js +195 -0
- package/dist/.internal/+/commands/descriptions.cjs +21 -0
- package/dist/.internal/+/commands/descriptions.d.cts +5 -0
- package/dist/.internal/+/commands/descriptions.d.ts +5 -0
- package/dist/.internal/+/commands/descriptions.js +17 -0
- package/dist/.internal/+/commands/meta.cjs +16 -0
- package/dist/.internal/+/commands/meta.d.cts +3 -0
- package/dist/.internal/+/commands/meta.d.ts +3 -0
- package/dist/.internal/+/commands/meta.js +15 -0
- package/dist/.internal/+/commands/utils/optionParser.cjs +8 -0
- package/dist/.internal/+/commands/utils/optionParser.d.cts +3 -0
- package/dist/.internal/+/commands/utils/optionParser.d.ts +3 -0
- package/dist/.internal/+/commands/utils/optionParser.js +6 -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/+/server.cjs +33 -0
- package/dist/.internal/+/server.d.cts +8 -0
- package/dist/.internal/+/server.d.ts +8 -0
- package/dist/.internal/+/server.js +27 -0
- package/dist/.internal/+/utils/checkDependency.cjs +39 -0
- package/dist/.internal/+/utils/checkDependency.d.cts +3 -0
- package/dist/.internal/+/utils/checkDependency.d.ts +3 -0
- package/dist/.internal/+/utils/checkDependency.js +34 -0
- package/dist/.internal/+/utils/filterSupport.cjs +20 -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 +10 -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/getRoot.cjs +17 -0
- package/dist/.internal/+/utils/getRoot.d.cts +3 -0
- package/dist/.internal/+/utils/getRoot.d.ts +3 -0
- package/dist/.internal/+/utils/getRoot.js +11 -0
- package/dist/.internal/+/utils/getWD.cjs +15 -0
- package/dist/.internal/+/utils/getWD.d.cts +6 -0
- package/dist/.internal/+/utils/getWD.d.ts +6 -0
- package/dist/.internal/+/utils/getWD.js +10 -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 +100 -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 +94 -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/.internal/+/utils/tsRegister.cjs +25 -0
- package/dist/.internal/+/utils/tsRegister.d.cts +3 -0
- package/dist/.internal/+/utils/tsRegister.d.ts +3 -0
- package/dist/.internal/+/utils/tsRegister.js +26 -0
- package/dist/.internal/getWD-BRJ3PK1S.js +105 -0
- package/dist/.internal/getWD-Cmxzjf-f.js +95 -0
- package/dist/{cli.js → .internal/index-B6RQz1DZ.js} +1 -735
- package/dist/{cli.cjs → .internal/index-DlHFuTjM.js} +1 -757
- package/dist/.internal/jiek_create-require-CWFWNQHj.js +5 -0
- package/dist/.internal/jiek_create-require-CxSGbkTB.js +5 -0
- package/dist/.internal/package.json +10 -0
- package/dist/bin/build.cjs +505 -0
- package/dist/bin/index.cjs +488 -0
- package/dist/index.d.cts +1 -113
- package/dist/index.d.ts +1 -113
- package/dist/rollup/index.cjs +282 -4569
- package/dist/rollup/index.d.cts +7 -1
- package/dist/rollup/index.d.ts +7 -1
- package/dist/rollup/index.js +270 -4554
- package/package.json +25 -28
- package/src/bin/build.cts +11 -0
- package/src/bin/index.cts +6 -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 +218 -209
- package/src/commands/meta.ts +1 -1
- package/src/commands/publish.ts +87 -25
- package/src/rollup/base.ts +2 -2
- package/src/rollup/index.ts +309 -115
- 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/bin-helper.cjs +0 -43
- package/cli/package.json +0 -1
- package/cli-only-build/package.json +0 -1
- package/dist/cli-only-build.cjs +0 -977
- package/dist/cli-only-build.js +0 -969
- package/dist/cli.d.cts +0 -14
- package/dist/cli.d.ts +0 -14
- package/src/bin/build.ts +0 -0
- package/src/cli-only-build.ts +0 -11
- package/src/cli.ts +0 -6
- /package/{bin-helper.js → bin-helper/index.js} +0 -0
- /package/src/{parseArgv.ts → bin/parseArgv.ts} +0 -0
@@ -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/bin-helper.cjs
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
const process = require('node:process')
|
2
|
-
|
3
|
-
/**
|
4
|
-
* @type {string | undefined}
|
5
|
-
*/
|
6
|
-
let binFilePath
|
7
|
-
|
8
|
-
try {
|
9
|
-
// eslint-disable-next-line unicorn/error-message
|
10
|
-
throw new Error()
|
11
|
-
} catch (e) {
|
12
|
-
const { stack } = e
|
13
|
-
const lines = stack.split('\n')
|
14
|
-
for (const line of lines) {
|
15
|
-
if (
|
16
|
-
line === 'Error' || line.includes(' (node:') || line.includes(` (${__filename}`)
|
17
|
-
) {
|
18
|
-
continue
|
19
|
-
}
|
20
|
-
const match = line.match(/\(([^)]+)\)$/)
|
21
|
-
if (match) {
|
22
|
-
binFilePath = match[1].replace(/:\d+:\d+$/, '')
|
23
|
-
}
|
24
|
-
break
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
binFilePath = binFilePath ?? process.env.JIEK_BIN__FILEPATH
|
29
|
-
|
30
|
-
const {
|
31
|
-
basename,
|
32
|
-
dirname
|
33
|
-
} = require('node:path')
|
34
|
-
|
35
|
-
const packageDir = dirname(dirname(binFilePath))
|
36
|
-
const binFilename = basename(binFilePath).replace(/(\.[cm]?)js$/, '$1ts')
|
37
|
-
|
38
|
-
process.env.JIEK_PACKAGE_DIR = packageDir
|
39
|
-
process.env.JIEK_BIN__FILENAME = binFilename
|
40
|
-
process.env.JIEK_BIN__FILEPATH = binFilePath
|
41
|
-
|
42
|
-
require('esbuild-register')
|
43
|
-
require(`${packageDir}/src/bin/${binFilename}`)
|
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"}
|