jiek 2.2.7-alpha.1 → 2.2.7-alpha.3

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 (99) hide show
  1. package/bin-helper/index.cjs +1 -1
  2. package/dist/.internal/{getWD-Cmxzjf-f.js → .chunks/getWD.D6wq8Qc2.js} +2 -2
  3. package/dist/.internal/{getWD-BRJ3PK1S.js → .chunks/getWD.ZF0avqDB.cjs} +2 -2
  4. package/dist/.internal/{+/commands → commands}/build/analyzer.cjs +2 -2
  5. package/dist/.internal/{+/commands → commands}/build/analyzer.js +2 -2
  6. package/dist/.internal/{+/commands → commands}/meta.cjs +2 -2
  7. package/dist/.internal/{+/commands → commands}/meta.js +2 -2
  8. package/dist/.internal/{+/utils → utils}/checkDependency.cjs +2 -2
  9. package/dist/.internal/{+/utils → utils}/checkDependency.js +2 -2
  10. package/dist/.internal/{+/utils → utils}/filterSupport.cjs +2 -2
  11. package/dist/.internal/{+/utils → utils}/filterSupport.js +2 -2
  12. package/dist/.internal/{+/utils → utils}/getWD.cjs +2 -2
  13. package/dist/.internal/{+/utils → utils}/getWD.js +2 -2
  14. package/dist/.internal/{+/utils → utils}/loadConfig.cjs +2 -2
  15. package/dist/.internal/{+/utils → utils}/loadConfig.js +2 -2
  16. package/dist/.internal/{+/utils → utils}/resolveExports.cjs +1 -1
  17. package/dist/.internal/{+/utils → utils}/resolveExports.js +1 -1
  18. package/dist/.internal/{+/utils → utils}/ts.cjs +1 -1
  19. package/dist/.internal/{+/utils → utils}/ts.js +1 -1
  20. package/dist/.internal/{+/utils → utils}/tsRegister.cjs +1 -1
  21. package/dist/.internal/{+/utils → utils}/tsRegister.js +1 -1
  22. package/dist/bin/build.cjs +27 -17
  23. package/dist/bin/index.cjs +51 -42
  24. package/dist/index.d.cts +12 -2
  25. package/dist/index.d.ts +12 -2
  26. package/dist/rollup/index.cjs +25 -31
  27. package/dist/rollup/index.js +25 -31
  28. package/package.json +12 -15
  29. package/src/commands/build.ts +9 -3
  30. package/src/commands/publish.ts +57 -39
  31. package/src/index.ts +6 -1
  32. package/src/rollup/index.ts +36 -33
  33. package/dist/.internal/package.json +0 -10
  34. /package/dist/.internal/{index-B6RQz1DZ.js → .chunks/index.B6RQz1DZ.js} +0 -0
  35. /package/dist/.internal/{index-DlHFuTjM.js → .chunks/index.DlHFuTjM.cjs} +0 -0
  36. /package/dist/.internal/{jiek_create-require-CWFWNQHj.js → .chunks/jiek_create-require.CWFWNQHj.cjs} +0 -0
  37. /package/dist/.internal/{jiek_create-require-CxSGbkTB.js → .chunks/jiek_create-require.CxSGbkTB.js} +0 -0
  38. /package/dist/.internal/{+/bin → bin}/parseArgv.cjs +0 -0
  39. /package/dist/.internal/{+/bin → bin}/parseArgv.d.cts +0 -0
  40. /package/dist/.internal/{+/bin → bin}/parseArgv.d.ts +0 -0
  41. /package/dist/.internal/{+/bin → bin}/parseArgv.js +0 -0
  42. /package/dist/.internal/{+/bridge.cjs → bridge.cjs} +0 -0
  43. /package/dist/.internal/{+/bridge.d.cts → bridge.d.cts} +0 -0
  44. /package/dist/.internal/{+/bridge.d.ts → bridge.d.ts} +0 -0
  45. /package/dist/.internal/{+/bridge.js → bridge.js} +0 -0
  46. /package/dist/.internal/{+/commands → commands}/build/analyzer.d.cts +0 -0
  47. /package/dist/.internal/{+/commands → commands}/build/analyzer.d.ts +0 -0
  48. /package/dist/.internal/{+/commands → commands}/descriptions.cjs +0 -0
  49. /package/dist/.internal/{+/commands → commands}/descriptions.d.cts +0 -0
  50. /package/dist/.internal/{+/commands → commands}/descriptions.d.ts +0 -0
  51. /package/dist/.internal/{+/commands → commands}/descriptions.js +0 -0
  52. /package/dist/.internal/{+/commands → commands}/meta.d.cts +0 -0
  53. /package/dist/.internal/{+/commands → commands}/meta.d.ts +0 -0
  54. /package/dist/.internal/{+/commands → commands}/utils/optionParser.cjs +0 -0
  55. /package/dist/.internal/{+/commands → commands}/utils/optionParser.d.cts +0 -0
  56. /package/dist/.internal/{+/commands → commands}/utils/optionParser.d.ts +0 -0
  57. /package/dist/.internal/{+/commands → commands}/utils/optionParser.js +0 -0
  58. /package/dist/.internal/{+/rollup → rollup}/base.cjs +0 -0
  59. /package/dist/.internal/{+/rollup → rollup}/base.d.cts +0 -0
  60. /package/dist/.internal/{+/rollup → rollup}/base.d.ts +0 -0
  61. /package/dist/.internal/{+/rollup → rollup}/base.js +0 -0
  62. /package/dist/.internal/{+/rollup → rollup}/bundle-analyzer.cjs +0 -0
  63. /package/dist/.internal/{+/rollup → rollup}/bundle-analyzer.d.cts +0 -0
  64. /package/dist/.internal/{+/rollup → rollup}/bundle-analyzer.d.ts +0 -0
  65. /package/dist/.internal/{+/rollup → rollup}/bundle-analyzer.js +0 -0
  66. /package/dist/.internal/{+/server.cjs → server.cjs} +0 -0
  67. /package/dist/.internal/{+/server.d.cts → server.d.cts} +0 -0
  68. /package/dist/.internal/{+/server.d.ts → server.d.ts} +0 -0
  69. /package/dist/.internal/{+/server.js → server.js} +0 -0
  70. /package/dist/.internal/{+/utils → utils}/checkDependency.d.cts +0 -0
  71. /package/dist/.internal/{+/utils → utils}/checkDependency.d.ts +0 -0
  72. /package/dist/.internal/{+/utils → utils}/filterSupport.d.cts +0 -0
  73. /package/dist/.internal/{+/utils → utils}/filterSupport.d.ts +0 -0
  74. /package/dist/.internal/{+/utils → utils}/getInternalModuleName.cjs +0 -0
  75. /package/dist/.internal/{+/utils → utils}/getInternalModuleName.d.cts +0 -0
  76. /package/dist/.internal/{+/utils → utils}/getInternalModuleName.d.ts +0 -0
  77. /package/dist/.internal/{+/utils → utils}/getInternalModuleName.js +0 -0
  78. /package/dist/.internal/{+/utils → utils}/getRoot.cjs +0 -0
  79. /package/dist/.internal/{+/utils → utils}/getRoot.d.cts +0 -0
  80. /package/dist/.internal/{+/utils → utils}/getRoot.d.ts +0 -0
  81. /package/dist/.internal/{+/utils → utils}/getRoot.js +0 -0
  82. /package/dist/.internal/{+/utils → utils}/getWD.d.cts +0 -0
  83. /package/dist/.internal/{+/utils → utils}/getWD.d.ts +0 -0
  84. /package/dist/.internal/{+/utils → utils}/intersection.cjs +0 -0
  85. /package/dist/.internal/{+/utils → utils}/intersection.d.cts +0 -0
  86. /package/dist/.internal/{+/utils → utils}/intersection.d.ts +0 -0
  87. /package/dist/.internal/{+/utils → utils}/intersection.js +0 -0
  88. /package/dist/.internal/{+/utils → utils}/loadConfig.d.cts +0 -0
  89. /package/dist/.internal/{+/utils → utils}/loadConfig.d.ts +0 -0
  90. /package/dist/.internal/{+/utils → utils}/recursiveListFiles.cjs +0 -0
  91. /package/dist/.internal/{+/utils → utils}/recursiveListFiles.d.cts +0 -0
  92. /package/dist/.internal/{+/utils → utils}/recursiveListFiles.d.ts +0 -0
  93. /package/dist/.internal/{+/utils → utils}/recursiveListFiles.js +0 -0
  94. /package/dist/.internal/{+/utils → utils}/resolveExports.d.cts +0 -0
  95. /package/dist/.internal/{+/utils → utils}/resolveExports.d.ts +0 -0
  96. /package/dist/.internal/{+/utils → utils}/ts.d.cts +0 -0
  97. /package/dist/.internal/{+/utils → utils}/ts.d.ts +0 -0
  98. /package/dist/.internal/{+/utils → utils}/tsRegister.d.cts +0 -0
  99. /package/dist/.internal/{+/utils → utils}/tsRegister.d.ts +0 -0
@@ -105,7 +105,7 @@ const MINIFY_OPTIONS = {
105
105
  const config = loadConfig({
106
106
  root: WORKSPACE_ROOT
107
107
  }) ?? {}
108
- const { build = {} } = config
108
+ const { experimental, build = {} } = config
109
109
  const { js: jsOutdir, dts: dtsOutdir } = getOutDirs({
110
110
  config,
111
111
  pkgName: JIEK_NAME
@@ -120,7 +120,7 @@ const STYLE_REGEXP = /\.(css|s[ac]ss|less|styl)$/
120
120
 
121
121
  const CWD_FILES = recursiveListFiles(process.cwd())
122
122
  .filter(p => /(?<!\.d)\.[cm]?tsx?$/.test(p))
123
- .map(p => relative(process.cwd(), p))
123
+ .map(p => `./${relative(process.cwd(), p)}`)
124
124
 
125
125
  const resolveBuildPlugins = (context: ConfigGenerateContext, plugins: TemplateOptions['plugins']): {
126
126
  js: InputPluginOption
@@ -253,6 +253,12 @@ const withMinify = (
253
253
  : (() => {
254
254
  throw new Error('entryFileNames must be a function')
255
255
  })(),
256
+ chunkFileNames: chunkInfo =>
257
+ typeof output.chunkFileNames === 'function'
258
+ ? output.chunkFileNames(chunkInfo).replace(/(\.[cm]?js)$/, '.min$1')
259
+ : (() => {
260
+ throw new Error('chunkFileNames must be a function')
261
+ })(),
256
262
  file: output.file?.replace(/(\.[cm]?js)$/, '.min$1'),
257
263
  plugins: [
258
264
  ...notOnlyOncePlugins,
@@ -380,7 +386,7 @@ const generateConfigs = (
380
386
  'input should not include "**", please read the [documentation](https://nodejs.org/api/packages.html#subpath-patterns).'
381
387
  )
382
388
  }
383
- const reg = new RegExp(`^${
389
+ const reg = new RegExp(`^\./${
384
390
  input
385
391
  .slice(2)
386
392
  .replace(/\./g, '\\.')
@@ -390,14 +396,14 @@ const generateConfigs = (
390
396
  ? input
391
397
  : CWD_FILES.filter(p => reg.test(p))
392
398
  const globCommonDir = input.includes('*')
393
- ? input.split('*')[0].replace('./', '')
399
+ ? input.split('*')[0]
394
400
  : ''
395
- const pathCommonDir = path.includes('*')
396
- ? path.split('*')[0].replace('./', '')
401
+ const outputCommonDir = output.includes('*')
402
+ ? output.split('*')[0]
397
403
  : ''
398
404
  if (
399
- (globCommonDir.length > 0 && pathCommonDir.length === 0)
400
- || (globCommonDir.length === 0 && pathCommonDir.length > 0)
405
+ (globCommonDir.length > 0 && outputCommonDir.length === 0)
406
+ || (globCommonDir.length === 0 && outputCommonDir.length > 0)
401
407
  ) {
402
408
  throw new Error('input and path should both include "*" or not include "*"')
403
409
  }
@@ -429,11 +435,13 @@ const generateConfigs = (
429
435
  if (!resolved || !('id' in resolved)) {
430
436
  throw new Error('nodeResolvePluginInstance.resolveId.handler did not return a resolved object')
431
437
  }
432
- internalModuleCollect?.(relative(process.cwd(), resolved.id))
438
+ internalModuleCollect?.(`./${relative(process.cwd(), resolved.id)}`)
433
439
  return {
434
- id: source
435
- .replaceAll('#', `${INTERNAL_MODULE_NAME}/`)
436
- .replaceAll('~', '+'),
440
+ id: experimental?.importsDowngrade
441
+ ? source
442
+ .replaceAll('#', `${INTERNAL_MODULE_NAME}/`)
443
+ .replaceAll('~', '+')
444
+ : source,
437
445
  external: true
438
446
  }
439
447
  }
@@ -526,10 +534,15 @@ const generateConfigs = (
526
534
  entryFileNames: (chunkInfo) => {
527
535
  return Array.isArray(inputObj)
528
536
  ? chunkInfo.facadeModuleId!
529
- .replace(`${process.cwd()}/`, '')
530
- .replace(globCommonDir, pathCommonDir)
537
+ .replace(`${process.cwd()}/`, './')
538
+ .replace(globCommonDir, outputCommonDir)
531
539
  .replace(/(\.[cm]?)ts$/, jsOutputSuffix)
532
- : output.replace(`${jsOutdir}/`, '')
540
+ .replace(`${jsOutdir}/`, '')
541
+ : output
542
+ .replace(`${jsOutdir}/`, '')
543
+ },
544
+ chunkFileNames: (chunkInfo) => {
545
+ return `.internal/.chunks/${chunkInfo.name}.[hash]${jsOutputSuffix}`
533
546
  },
534
547
  sourcemap,
535
548
  format,
@@ -589,12 +602,14 @@ const generateConfigs = (
589
602
  sourcemap,
590
603
  entryFileNames: (chunkInfo) => (
591
604
  Array.isArray(inputObj)
592
- ? chunkInfo.facadeModuleId!.replace(`${process.cwd()}/`, '')
593
- .replace(globCommonDir, pathCommonDir)
605
+ ? chunkInfo.facadeModuleId!
606
+ .replace(`${process.cwd()}/`, './')
607
+ .replace(globCommonDir, outputCommonDir)
594
608
  .replace(/(\.[cm]?)ts$/, tsOutputSuffix)
595
- : output
596
609
  .replace(`${jsOutdir}/`, '')
610
+ : output
597
611
  .replace(/(\.[cm]?)js$/, tsOutputSuffix)
612
+ .replace(`${jsOutdir}/`, '')
598
613
  ),
599
614
  strict: typeof buildOptions?.output?.strict === 'object'
600
615
  ? buildOptions.output.strict.dts
@@ -772,24 +787,12 @@ export function template(packageJSON: PackageJSON): RollupOptions[] {
772
787
  async options(inputOptions) {
773
788
  await collected.promise
774
789
  inputOptions.input = [...intersection(
775
- inputOptions.input as string[],
790
+ Array.isArray(inputOptions.input)
791
+ ? inputOptions.input
792
+ : [inputOptions.input as string],
776
793
  internalModules
777
794
  )]
778
795
  return inputOptions
779
- },
780
- outputOptions(outputOptions) {
781
- outputOptions.dir = `${outputOptions.dir}/.internal`
782
- const oldEntryFileNames = outputOptions.entryFileNames
783
- outputOptions.entryFileNames = (chunkInfo) => {
784
- if (typeof oldEntryFileNames !== 'function') {
785
- throw new TypeError('entryFileNames must be a function')
786
- }
787
- const oldFileName = oldEntryFileNames(chunkInfo)
788
- return oldFileName
789
- .replaceAll('#', '')
790
- .replaceAll('~', '+')
791
- }
792
- return outputOptions
793
796
  }
794
797
  }
795
798
  ],
@@ -1,10 +0,0 @@
1
- {
2
- "name": "@jiek/__internal__",
3
- "exports": {
4
- "./+/*": {
5
- "jiek/__source__": "./src/*.ts",
6
- "require": "./+/*.cjs",
7
- "default": "./+/*.js"
8
- }
9
- }
10
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes