jiek 0.4.7-alpha.13 → 0.4.7-alpha.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/bin/jiek.js +4 -7
  2. package/dist/cli.d.mts.map +1 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +95 -4277
  5. package/dist/cli.js.map +1 -0
  6. package/dist/cli.min.js +1 -19
  7. package/dist/cli.min.js.map +1 -0
  8. package/dist/cli.min.mjs +1 -0
  9. package/dist/cli.min.mjs.map +1 -0
  10. package/dist/cli.mjs +803 -0
  11. package/dist/cli.mjs.map +1 -0
  12. package/dist/index.d.mts.map +1 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +3 -1
  15. package/dist/index.js.map +1 -0
  16. package/dist/index.min.js +1 -1
  17. package/dist/index.min.js.map +1 -0
  18. package/dist/index.min.mjs +1 -0
  19. package/dist/index.min.mjs.map +1 -0
  20. package/dist/index.mjs +3 -0
  21. package/dist/index.mjs.map +1 -0
  22. package/dist/rollup/index.d.mts.map +1 -0
  23. package/dist/rollup/index.d.ts.map +1 -0
  24. package/dist/rollup/index.js +68 -4183
  25. package/dist/rollup/index.js.map +1 -0
  26. package/dist/rollup/index.min.js +1 -19
  27. package/dist/rollup/index.min.js.map +1 -0
  28. package/dist/rollup/index.min.mjs +1 -0
  29. package/dist/rollup/index.min.mjs.map +1 -0
  30. package/dist/rollup/index.mjs +551 -0
  31. package/dist/rollup/index.mjs.map +1 -0
  32. package/package.json +11 -13
  33. package/src/commands/base.ts +2 -1
  34. package/src/commands/build.ts +2 -4
  35. package/src/pkg.ts +1 -0
  36. package/src/rollup/index.ts +3 -5
  37. package/src/utils/filterSupport.ts +0 -2
  38. package/src/utils/tsRegister.ts +0 -4
  39. package/dist/cli.cjs +0 -5037
  40. package/dist/cli.min.cjs +0 -19
  41. package/dist/index.cjs +0 -5
  42. package/dist/index.min.cjs +0 -1
  43. package/dist/rollup/index.cjs +0 -4683
  44. package/dist/rollup/index.min.cjs +0 -19
  45. /package/dist/{cli.d.cts → cli.d.mts} +0 -0
  46. /package/dist/{index.d.cts → index.d.mts} +0 -0
  47. /package/dist/rollup/{index.d.cts → index.d.mts} +0 -0
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "jiek",
3
- "type": "module",
4
- "version": "0.4.7-alpha.13",
3
+ "version": "0.4.7-alpha.3",
5
4
  "description": "YiJie's personal kits.",
6
5
  "bin": {
7
6
  "jiek": "bin/jiek.js",
@@ -27,27 +26,27 @@
27
26
  "./package.json": "./package.json",
28
27
  ".": {
29
28
  "source": "./src/index.ts",
30
- "require": "./dist/index.cjs",
29
+ "import": "./dist/index.mjs",
31
30
  "default": "./dist/index.js"
32
31
  },
33
32
  "./cli": {
34
33
  "source": "./src/cli.ts",
35
- "require": "./dist/cli.cjs",
34
+ "import": "./dist/cli.mjs",
36
35
  "default": "./dist/cli.js"
37
36
  },
38
37
  "./rollup": {
39
38
  "source": "./src/rollup/index.ts",
40
- "require": "./dist/rollup/index.cjs",
39
+ "import": "./dist/rollup/index.mjs",
41
40
  "default": "./dist/rollup/index.js"
42
41
  },
43
42
  "./cli.js": {
44
43
  "source": "./src/cli.ts",
45
- "require": "./dist/cli.cjs",
44
+ "import": "./dist/cli.mjs",
46
45
  "default": "./dist/cli.js"
47
46
  },
48
47
  "./rollup.js": {
49
48
  "source": "./src/rollup/index.ts",
50
- "require": "./dist/rollup/index.cjs",
49
+ "import": "./dist/rollup/index.mjs",
51
50
  "default": "./dist/rollup/index.js"
52
51
  }
53
52
  },
@@ -56,7 +55,6 @@
56
55
  },
57
56
  "dependencies": {
58
57
  "@jiek/rollup-plugin-dts": "^6.1.1",
59
- "@rollup/plugin-commonjs": "^28.0.0",
60
58
  "@rollup/plugin-json": "^6.0.1",
61
59
  "@rollup/plugin-node-resolve": "^15.3.0",
62
60
  "@rollup/plugin-terser": "^0.4.4",
@@ -68,12 +66,13 @@
68
66
  "inquirer": "^8.2.6",
69
67
  "js-yaml": "^4.1.0",
70
68
  "jsonc-parser": "^3.2.1",
69
+ "micromatch": "^4.0.5",
71
70
  "rollup": "^4.1.5",
72
71
  "rollup-plugin-copy": "^3.5.0",
73
72
  "rollup-plugin-esbuild": "^6.1.0",
74
73
  "typescript": "^5.0.0",
75
- "@jiek/pkger": "^0.2.0",
76
- "@jiek/utils": "^0.2.1"
74
+ "@jiek/pkger": "^0.1.11",
75
+ "@jiek/utils": "^0.2.0"
77
76
  },
78
77
  "optionalDependencies": {
79
78
  "@pnpm/filter-workspace-packages": "^7.2.13",
@@ -90,11 +89,10 @@
90
89
  "@types/js-yaml": "^4.0.9",
91
90
  "@types/micromatch": "^4.0.6",
92
91
  "esbuild-register": "^3.5.0",
93
- "micromatch": "^4.0.5",
94
92
  "node-sass": "^9.0.0",
95
93
  "postcss": "^8.4.47",
96
94
  "rollup-plugin-postcss": "^4.0.2"
97
95
  },
98
- "main": "./dist/index.cjs",
99
- "module": "./dist/index.js"
96
+ "main": "./dist/index.js",
97
+ "module": "./dist/index.mjs"
100
98
  }
@@ -1,5 +1,6 @@
1
1
  import { program } from 'commander'
2
- import pkg from 'jiek/package.json'
2
+
3
+ import pkg from '../pkg'
3
4
 
4
5
  program
5
6
  .version(pkg.version)
@@ -1,7 +1,6 @@
1
1
  import '../rollup/base'
2
2
 
3
3
  import fs from 'node:fs'
4
- import { createRequire } from 'node:module'
5
4
  import path from 'node:path'
6
5
 
7
6
  import { MultiBar, Presets } from 'cli-progress'
@@ -15,11 +14,10 @@ import { loadConfig } from '../utils/loadConfig'
15
14
  import { tsRegisterName } from '../utils/tsRegister'
16
15
 
17
16
  const FILE_TEMPLATE = (manifest: unknown) => (`
18
- module.exports = require('jiek/rollup').template(${JSON.stringify(manifest, null, 2)})
17
+ const manifest = ${JSON.stringify(manifest, null, 2)}
18
+ module.exports = require('jiek/rollup').template(manifest)
19
19
  `.trimStart())
20
20
 
21
- const require = createRequire(import.meta.url)
22
-
23
21
  program
24
22
  .command('build')
25
23
  .option('-s, --silent', "Don't display logs.")
package/src/pkg.ts ADDED
@@ -0,0 +1 @@
1
+ export default require('../package.json')
@@ -7,7 +7,6 @@ import type { RecursiveRecord } from '@jiek/pkger/entrypoints'
7
7
  import { getAllLeafs } from '@jiek/pkger/entrypoints'
8
8
  import { dts } from '@jiek/rollup-plugin-dts'
9
9
  import { getWorkspaceDir } from '@jiek/utils/getWorkspaceDir'
10
- import commonjs from '@rollup/plugin-commonjs'
11
10
  import json from '@rollup/plugin-json'
12
11
  import { nodeResolve } from '@rollup/plugin-node-resolve'
13
12
  import terser from '@rollup/plugin-terser'
@@ -64,6 +63,8 @@ const debug = (...args: unknown[]) => sendMessage({ type: 'debug', data: args }
64
63
 
65
64
  const resolveWorkspacePath = (p: string) => resolve(WORKSPACE_ROOT, p)
66
65
 
66
+ const intersection = <T>(a: Set<T>, b: Set<T>) => new Set([...a].filter(i => b.has(i)))
67
+
67
68
  const pascalCase = (str: string) =>
68
69
  str
69
70
  .replace(/[@|/-](\w)/g, (_, $1) => $1.toUpperCase())
@@ -133,7 +134,6 @@ const getExtendTSConfig = (tsconfigPath: string): TSConfig => {
133
134
  if (extendsPaths.length === 0) return tsconfig
134
135
  return extendsPaths
135
136
  .map(getExtendTSConfig)
136
- .concat(tsconfig)
137
137
  // https://www.typescriptlang.org/tsconfig/#files:~:text=Currently%2C%20the%20only%20top%2Dlevel%20property%20that%20is%20excluded%20from%20inheritance%20is%20references.
138
138
  // Currently, the only top-level property that is excluded from inheritance is references.
139
139
  .reduce((acc, { compilerOptions = {}, references: _, ...curr }) => ({
@@ -143,7 +143,7 @@ const getExtendTSConfig = (tsconfigPath: string): TSConfig => {
143
143
  ...acc.compilerOptions,
144
144
  ...compilerOptions
145
145
  }
146
- }), {})
146
+ }), tsconfig)
147
147
  }
148
148
 
149
149
  const getCompilerOptionsByFilePath = (tsconfigPath: string, filePath: string): Record<string, unknown> | undefined => {
@@ -249,7 +249,6 @@ const generateConfigs = ({
249
249
  ...withMinify({
250
250
  file: output,
251
251
  name,
252
- interop: 'auto',
253
252
  sourcemap: typeof options?.output?.sourcemap === 'object'
254
253
  ? options.output.sourcemap.js
255
254
  : options?.output?.sourcemap,
@@ -276,7 +275,6 @@ const generateConfigs = ({
276
275
  )
277
276
  .catch(() => void 0),
278
277
  esbuild(),
279
- commonjs(),
280
278
  progress({
281
279
  onEvent: (event, message) =>
282
280
  sendMessage(
@@ -1,5 +1,4 @@
1
1
  import fs from 'node:fs'
2
- import { createRequire } from 'node:module'
3
2
  import path from 'node:path'
4
3
 
5
4
  import { filterPackagesFromDir } from '@pnpm/filter-workspace-packages'
@@ -12,7 +11,6 @@ import { getWD } from './getWD'
12
11
  export let type = ''
13
12
 
14
13
  try {
15
- const require = createRequire(import.meta.url)
16
14
  require.resolve('@pnpm/filter-workspace-packages')
17
15
  type = 'pnpm'
18
16
  } catch { /* empty */ }
@@ -1,7 +1,3 @@
1
- import { createRequire } from 'node:module'
2
-
3
- const require = createRequire(import.meta.url)
4
-
5
1
  function packageIsExist(name: string) {
6
2
  try {
7
3
  require.resolve(name)