jiek 2.3.2 → 2.3.4

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.
Files changed (81) hide show
  1. package/dist/.internal/.chunks/{filterSupport.4rM7f6jB.cjs → getWD.Bdo2NGCR.cjs} +30 -30
  2. package/dist/.internal/.chunks/{filterSupport.BXWpLBpT.js → getWD.DGvwAHMY.js} +29 -29
  3. package/dist/.internal/.chunks/{loadConfig.OOKddvHF.cjs → loadConfig.8xhNFEJe.cjs} +30 -12
  4. package/dist/.internal/.chunks/{loadConfig.CFfzkm_p.js → loadConfig.BjzxLOdC.js} +26 -9
  5. package/dist/.internal/bin/common.cjs +92 -97
  6. package/dist/.internal/bin/common.d.cts +2 -0
  7. package/dist/.internal/bin/common.d.ts +2 -0
  8. package/dist/.internal/bin/common.js +93 -98
  9. package/dist/.internal/bin/parseArgv.cjs +2 -2
  10. package/dist/.internal/bin/parseArgv.js +2 -2
  11. package/dist/.internal/commands/utils/createAreaManagement.cjs +108 -0
  12. package/dist/.internal/commands/utils/createAreaManagement.d.cts +18 -0
  13. package/dist/.internal/commands/utils/createAreaManagement.d.ts +18 -0
  14. package/dist/.internal/commands/utils/createAreaManagement.js +106 -0
  15. package/dist/.internal/polyfill.cjs +13 -0
  16. package/dist/.internal/polyfill.d.cts +1 -0
  17. package/dist/.internal/polyfill.d.ts +1 -0
  18. package/dist/.internal/polyfill.js +11 -0
  19. package/dist/.internal/rollup/base.d.cts +27 -4
  20. package/dist/.internal/rollup/base.d.ts +27 -4
  21. package/dist/.internal/utils/filterSupport.cjs +1 -1
  22. package/dist/.internal/utils/filterSupport.js +2 -2
  23. package/dist/.internal/utils/loadConfig.cjs +3 -3
  24. package/dist/.internal/utils/loadConfig.d.cts +1 -0
  25. package/dist/.internal/utils/loadConfig.d.ts +1 -0
  26. package/dist/.internal/utils/loadConfig.js +4 -4
  27. package/dist/.internal/utils/pascalCase.cjs +5 -0
  28. package/dist/.internal/utils/pascalCase.d.cts +3 -0
  29. package/dist/.internal/utils/pascalCase.d.ts +3 -0
  30. package/dist/.internal/utils/pascalCase.js +3 -0
  31. package/dist/.internal/utils/reveal.cjs +9 -0
  32. package/dist/.internal/utils/reveal.d.cts +3 -0
  33. package/dist/.internal/utils/reveal.d.ts +3 -0
  34. package/dist/.internal/utils/reveal.js +7 -0
  35. package/dist/bin/index.cjs +101 -43
  36. package/dist/index.d.cts +7 -0
  37. package/dist/index.d.ts +7 -0
  38. package/dist/rollup/index.cjs +91 -31
  39. package/dist/rollup/index.js +90 -30
  40. package/package.json +6 -2
  41. package/src/bin/build.cts +0 -5
  42. package/src/bin/common.ts +0 -3
  43. package/src/bin/index.cts +0 -7
  44. package/src/bin/parseArgv.ts +0 -26
  45. package/src/bridge.ts +0 -46
  46. package/src/commands/base.ts +0 -18
  47. package/src/commands/build/analyzer.ts +0 -122
  48. package/src/commands/build/client/analyzer.tsx +0 -121
  49. package/src/commands/build/client/index.ts +0 -26
  50. package/src/commands/build.ts +0 -544
  51. package/src/commands/descriptions.ts +0 -17
  52. package/src/commands/meta.ts +0 -5
  53. package/src/commands/publish.ts +0 -628
  54. package/src/commands/utils/optionParser.ts +0 -4
  55. package/src/index.ts +0 -12
  56. package/src/inner.ts +0 -11
  57. package/src/rollup/base.ts +0 -151
  58. package/src/rollup/bundle-analyzer.ts +0 -62
  59. package/src/rollup/index.ts +0 -892
  60. package/src/rollup/plugins/create-require.ts +0 -23
  61. package/src/rollup/plugins/progress.ts +0 -26
  62. package/src/rollup/plugins/replace.ts +0 -96
  63. package/src/rollup/plugins/skip.ts +0 -21
  64. package/src/rollup/plugins/with-external.ts +0 -23
  65. package/src/rollup/utils/commonOptions.ts +0 -9
  66. package/src/rollup/utils/externalResolver.ts +0 -47
  67. package/src/rollup/utils/globalResolver.ts +0 -13
  68. package/src/rollup/utils/withMinify.ts +0 -18
  69. package/src/rollup-plugin-utils.ts +0 -32
  70. package/src/server.ts +0 -30
  71. package/src/utils/checkDependency.ts +0 -26
  72. package/src/utils/filterSupport.ts +0 -90
  73. package/src/utils/getInternalModuleName.ts +0 -5
  74. package/src/utils/getRoot.ts +0 -14
  75. package/src/utils/getWD.ts +0 -31
  76. package/src/utils/intersection.ts +0 -1
  77. package/src/utils/loadConfig.ts +0 -108
  78. package/src/utils/recursiveListFiles.ts +0 -13
  79. package/src/utils/resolveExports.ts +0 -165
  80. package/src/utils/ts.ts +0 -94
  81. package/src/utils/tsRegister.ts +0 -22
@@ -1,151 +0,0 @@
1
- import type { InputPluginOption, OutputOptions } from 'rollup'
2
- import { Replacements } from './plugins/replace'
3
-
4
- export type Mapping2ROO<K extends keyof OutputOptions> = OutputOptions[K] | {
5
- js?: OutputOptions[K]
6
- dts?: OutputOptions[K]
7
- }
8
-
9
- export interface ConfigGenerateContext {
10
- path: string
11
- name: string
12
- input: string
13
- output: string
14
- external: (string | RegExp)[]
15
- pkgIsModule: boolean
16
- conditionals: string[]
17
- }
18
-
19
- export type OutputControl = boolean | ((context: ConfigGenerateContext) => boolean)
20
-
21
- export const BUILDER_TYPES = ['esbuild', 'swc'] as const
22
-
23
- export const BUILDER_TYPE_PACKAGE_NAME_MAP = {
24
- esbuild: 'rollup-plugin-esbuild',
25
- swc: 'rollup-plugin-swc3'
26
- }
27
-
28
- export interface TemplateOptions {
29
- /**
30
- * When the user configures type: module, the generated output from entry points that don't
31
- * have cts as a suffix will automatically include the CJS version.
32
- * if it is not configured, and the generated output from entry points that do not have mts
33
- * as a suffix will automatically include the ESM version.
34
- *
35
- * @default true
36
- */
37
- crossModuleConvertor?: boolean
38
- /**
39
- * Auto-detect the builder from the installed dependencies.
40
- * If the builder is not installed, it will prompt the user to install it.
41
- * If exists multiple builders, it will fall back to the 'esbuild'.
42
- *
43
- * @default 'esbuild'
44
- */
45
- builder?:
46
- | typeof BUILDER_TYPES[number]
47
- | ({
48
- type: 'esbuild'
49
- } & import('rollup-plugin-esbuild').Options)
50
- | ({
51
- type: 'swc'
52
- } & import('rollup-plugin-swc3').PluginOptions)
53
- features?: {
54
- /**
55
- * When use esbuild type builder, it will inject `supported.import-attributes` option.
56
- * When use swc type builder, it will inject `jsc.experimental.keepImportAttributes` option.
57
- *
58
- * And it will auto set the rollup output `externalImportAttributes` and `importAttributesKey` options.
59
- *
60
- * @default false
61
- */
62
- keepImportAttributes?: boolean | 'assert'
63
- }
64
- output?: {
65
- /**
66
- * @default true
67
- *
68
- * When minify is set to true, the output will with minified files.
69
- * When minify is set to 'only-minify', the output will direct output minified files.
70
- */
71
- minify?: boolean | 'only-minify'
72
- minifyOptions?:
73
- | typeof BUILDER_TYPES[number]
74
- | 'terser'
75
- | (
76
- {
77
- type: 'terser'
78
- } & import('@rollup/plugin-terser').Options
79
- )
80
- | (
81
- {
82
- type: 'esbuild'
83
- } & Parameters<typeof import('rollup-plugin-esbuild').minify>[0]
84
- )
85
- | (
86
- {
87
- type: 'swc'
88
- } & Parameters<typeof import('rollup-plugin-swc3').minify>[0]
89
- )
90
- /**
91
- * @default 'dist'
92
- */
93
- dir?: Mapping2ROO<'dir'>
94
- sourcemap?: Mapping2ROO<'sourcemap'>
95
- strict?: Mapping2ROO<'strict'>
96
- js?: OutputControl
97
- dts?: OutputControl
98
- }
99
- /**
100
- * Set the external dependencies of the package.
101
- */
102
- external?: (string | RegExp)[]
103
- plugins?:
104
- | InputPluginOption
105
- | ((type: 'js' | 'dts', context: ConfigGenerateContext) => InputPluginOption)
106
- | {
107
- js: InputPluginOption
108
- dts?: InputPluginOption
109
- }
110
- | {
111
- js?: InputPluginOption
112
- dts: InputPluginOption
113
- }
114
- /**
115
- * https://www.npmjs.com/package/@rollup/plugin-inject#usage
116
- *
117
- * @example
118
- * ```js
119
- * {
120
- * // import { Promise } from 'es6-promise'
121
- * Promise: [ 'es6-promise', 'Promise' ],
122
- *
123
- * // import { Promise as P } from 'es6-promise'
124
- * P: [ 'es6-promise', 'Promise' ],
125
- *
126
- * // import $ from 'jquery'
127
- * $: 'jquery',
128
- *
129
- * // import * as fs from 'fs'
130
- * fs: [ 'fs', '*' ],
131
- *
132
- * // use a local module instead of a third-party one
133
- * 'Object.assign': path.resolve( 'src/helpers/object-assign.js' ),
134
- * }
135
- * ```
136
- */
137
- injects?: Record<string, string | [string, string]>
138
- /**
139
- * Replace the specified content in the code.
140
- *
141
- * @example
142
- * ```js
143
- * {
144
- * 'process.env.DEBUG': 'false',
145
- * 'process.env.NODE_ENV': JSON.stringify('production'),
146
- * 'process.env.BUILD_PATH': ctx => JSON.stringify(ctx.id)
147
- * }
148
- * ```
149
- */
150
- replacements?: Replacements
151
- }
@@ -1,62 +0,0 @@
1
- import process from 'node:process'
2
-
3
- import type { InputPluginOption, OutputPlugin, Plugin } from 'rollup'
4
- import type { AnalyzerPluginInternalAPI } from 'vite-bundle-analyzer'
5
-
6
- export type Module = ReturnType<AnalyzerPluginInternalAPI['processModule']>[number]
7
-
8
- const {
9
- JIEK_ANALYZER
10
- } = process.env
11
-
12
- const ANALYZER = (JIEK_ANALYZER != null) && JSON.parse(JIEK_ANALYZER) as {
13
- dir?: string
14
- mode?: string
15
- size?: string
16
- port?: number
17
- open?: boolean
18
- }
19
-
20
- export function bundleAnalyzer(modulesResolved: (modules: Module[]) => void) {
21
- // eslint-disable-next-line ts/strict-boolean-expressions
22
- if (!ANALYZER) {
23
- return []
24
- }
25
-
26
- const defaultSizes = ({
27
- parsed: 'parsed',
28
- stat: 'stat',
29
- gzip: 'gzip'
30
- } as const)[ANALYZER.size ?? 'stat'] ?? 'parsed'
31
-
32
- let module: typeof import('vite-bundle-analyzer') | undefined
33
- let ana: Plugin | undefined
34
- async function initAna() {
35
- const { adapter, analyzer } = module ?? await import('vite-bundle-analyzer')
36
- ana = ana ?? adapter(analyzer({
37
- defaultSizes,
38
- analyzerMode: modulesResolved
39
- }))
40
- }
41
-
42
- return [
43
- (async () => {
44
- await initAna()
45
- return {
46
- name: 'jiek:bundle-analyzer',
47
- async closeBundle(...args) {
48
- if (typeof ana!.closeBundle !== 'function') return
49
-
50
- return ana!.closeBundle?.call(this, ...args)
51
- }
52
- } satisfies InputPluginOption
53
- })(),
54
- (async () => {
55
- await initAna()
56
- return {
57
- ...ana,
58
- name: 'jiek:bundle-analyzer-output'
59
- } satisfies OutputPlugin
60
- })()
61
- ] as const
62
- }