@wyw-in-js/transform 1.1.0 → 2.0.0-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/esm/cache.js +433 -289
- package/esm/cache.js.map +1 -1
- package/esm/debug/fileReporter.js +171 -134
- package/esm/debug/fileReporter.js.map +1 -1
- package/esm/eval/broker.js +2275 -0
- package/esm/eval/broker.js.map +1 -0
- package/esm/eval/lru.js +36 -0
- package/esm/eval/lru.js.map +1 -0
- package/esm/eval/prepareModuleOnDemand.js +21 -0
- package/esm/eval/prepareModuleOnDemand.js.map +1 -0
- package/esm/eval/protocol.js +2 -0
- package/esm/eval/protocol.js.map +1 -0
- package/esm/eval/runner.js +1878 -0
- package/esm/eval/runner.js.map +1 -0
- package/esm/eval/serialize.js +333 -0
- package/esm/eval/serialize.js.map +1 -0
- package/esm/eval/writeQueue.js +81 -0
- package/esm/eval/writeQueue.js.map +1 -0
- package/esm/evaluators/index.js +11 -12
- package/esm/evaluators/index.js.map +1 -1
- package/esm/index.js +25 -29
- package/esm/index.js.map +1 -1
- package/esm/module.js +923 -520
- package/esm/module.js.map +1 -1
- package/esm/shaker.js +14 -80
- package/esm/shaker.js.map +1 -1
- package/esm/transform/BaseEntrypoint.js +162 -164
- package/esm/transform/BaseEntrypoint.js.map +1 -1
- package/esm/transform/Entrypoint.helpers.js +96 -253
- package/esm/transform/Entrypoint.helpers.js.map +1 -1
- package/esm/transform/Entrypoint.js +336 -270
- package/esm/transform/Entrypoint.js.map +1 -1
- package/esm/transform/Entrypoint.types.js +1 -1
- package/esm/transform/Entrypoint.types.js.map +1 -1
- package/esm/transform/EvaluatedEntrypoint.js +10 -4
- package/esm/transform/EvaluatedEntrypoint.js.map +1 -1
- package/esm/transform/actions/AbortError.js +6 -6
- package/esm/transform/actions/AbortError.js.map +1 -1
- package/esm/transform/actions/BaseAction.js +140 -136
- package/esm/transform/actions/BaseAction.js.map +1 -1
- package/esm/transform/actions/UnprocessedEntrypointError.js +6 -6
- package/esm/transform/actions/UnprocessedEntrypointError.js.map +1 -1
- package/esm/transform/actions/actionRunner.js +63 -66
- package/esm/transform/actions/actionRunner.js.map +1 -1
- package/esm/transform/actions/types.js +1 -1
- package/esm/transform/actions/types.js.map +1 -1
- package/esm/transform/barrelManifest.types.js +2 -0
- package/esm/transform/barrelManifest.types.js.map +1 -0
- package/esm/transform/generators/baseProcessingHandlers.js +15 -17
- package/esm/transform/generators/baseProcessingHandlers.js.map +1 -1
- package/esm/transform/generators/collect.js +27 -55
- package/esm/transform/generators/collect.js.map +1 -1
- package/esm/transform/generators/createStylisPreprocessor.js +353 -321
- package/esm/transform/generators/createStylisPreprocessor.js.map +1 -1
- package/esm/transform/generators/evalFile.js +48 -47
- package/esm/transform/generators/evalFile.js.map +1 -1
- package/esm/transform/generators/extract.js +78 -90
- package/esm/transform/generators/extract.js.map +1 -1
- package/esm/transform/generators/getExports.js +57 -74
- package/esm/transform/generators/getExports.js.map +1 -1
- package/esm/transform/generators/index.js +11 -11
- package/esm/transform/generators/index.js.map +1 -1
- package/esm/transform/generators/processEntrypoint.js +93 -67
- package/esm/transform/generators/processEntrypoint.js.map +1 -1
- package/esm/transform/generators/processImports.js +102 -67
- package/esm/transform/generators/processImports.js.map +1 -1
- package/esm/transform/generators/resolveImports.js +212 -197
- package/esm/transform/generators/resolveImports.js.map +1 -1
- package/esm/transform/generators/resolveStaticOxcValues/cache.js +182 -0
- package/esm/transform/generators/resolveStaticOxcValues/cache.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/candidateResolver.js +146 -0
- package/esm/transform/generators/resolveStaticOxcValues/candidateResolver.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/dependencies.js +33 -0
- package/esm/transform/generators/resolveStaticOxcValues/dependencies.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/environment.js +29 -0
- package/esm/transform/generators/resolveStaticOxcValues/environment.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/exportResolver.js +351 -0
- package/esm/transform/generators/resolveStaticOxcValues/exportResolver.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/exportTargets.js +253 -0
- package/esm/transform/generators/resolveStaticOxcValues/exportTargets.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/objectAssign.js +310 -0
- package/esm/transform/generators/resolveStaticOxcValues/objectAssign.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/objectAssignStaticExport.js +74 -0
- package/esm/transform/generators/resolveStaticOxcValues/objectAssignStaticExport.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/opaqueRuntime.js +229 -0
- package/esm/transform/generators/resolveStaticOxcValues/opaqueRuntime.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/processorStaticExport.js +172 -0
- package/esm/transform/generators/resolveStaticOxcValues/processorStaticExport.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/processorStaticModel.js +476 -0
- package/esm/transform/generators/resolveStaticOxcValues/processorStaticModel.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/processorTarget.js +55 -0
- package/esm/transform/generators/resolveStaticOxcValues/processorTarget.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/programAnalysis.js +123 -0
- package/esm/transform/generators/resolveStaticOxcValues/programAnalysis.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/prune.js +186 -0
- package/esm/transform/generators/resolveStaticOxcValues/prune.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/resolveStaticOxcPreevalValues.js +183 -0
- package/esm/transform/generators/resolveStaticOxcValues/resolveStaticOxcPreevalValues.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/staticExpression.js +298 -0
- package/esm/transform/generators/resolveStaticOxcValues/staticExpression.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/staticExpressionDependencies.js +298 -0
- package/esm/transform/generators/resolveStaticOxcValues/staticExpressionDependencies.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/types.js +3 -0
- package/esm/transform/generators/resolveStaticOxcValues/types.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/zeroArgFunctionStaticExport.js +59 -0
- package/esm/transform/generators/resolveStaticOxcValues/zeroArgFunctionStaticExport.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues.js +2 -0
- package/esm/transform/generators/resolveStaticOxcValues.js.map +1 -0
- package/esm/transform/generators/rewriteOxcBarrelImports.js +822 -0
- package/esm/transform/generators/rewriteOxcBarrelImports.js.map +1 -0
- package/esm/transform/generators/transform.js +251 -248
- package/esm/transform/generators/transform.js.map +1 -1
- package/esm/transform/generators/workflow.js +87 -90
- package/esm/transform/generators/workflow.js.map +1 -1
- package/esm/transform/helpers/loadWywOptions.js +183 -74
- package/esm/transform/helpers/loadWywOptions.js.map +1 -1
- package/esm/transform/helpers/withDefaultServices.js +13 -22
- package/esm/transform/helpers/withDefaultServices.js.map +1 -1
- package/esm/transform/isStaticallyEvaluatableModule.js +140 -152
- package/esm/transform/isStaticallyEvaluatableModule.js.map +1 -1
- package/esm/transform/oxcBarrelManifest.js +349 -0
- package/esm/transform/oxcBarrelManifest.js.map +1 -0
- package/esm/transform/rootLog.js +3 -3
- package/esm/transform/rootLog.js.map +1 -1
- package/esm/transform/syntax.js +2 -0
- package/esm/transform/syntax.js.map +1 -0
- package/esm/transform/types.js +2 -2
- package/esm/transform/types.js.map +1 -1
- package/esm/transform.js +125 -147
- package/esm/transform.js.map +1 -1
- package/esm/types.js +4 -1
- package/esm/types.js.map +1 -1
- package/esm/utils/EventEmitter.js +79 -48
- package/esm/utils/EventEmitter.js.map +1 -1
- package/esm/utils/ShakerMetadata.js +2 -2
- package/esm/utils/ShakerMetadata.js.map +1 -1
- package/esm/utils/TransformDiagnostics.js +9 -9
- package/esm/utils/TransformDiagnostics.js.map +1 -1
- package/esm/utils/TransformMetadata.js +24 -26
- package/esm/utils/TransformMetadata.js.map +1 -1
- package/esm/utils/applyOxcProcessors/applyOxcProcessors.js +160 -0
- package/esm/utils/applyOxcProcessors/applyOxcProcessors.js.map +1 -0
- package/esm/utils/applyOxcProcessors/cleanupBindings.js +157 -0
- package/esm/utils/applyOxcProcessors/cleanupBindings.js.map +1 -0
- package/esm/utils/applyOxcProcessors/cleanupRemovals.js +431 -0
- package/esm/utils/applyOxcProcessors/cleanupRemovals.js.map +1 -0
- package/esm/utils/applyOxcProcessors/displayName.js +93 -0
- package/esm/utils/applyOxcProcessors/displayName.js.map +1 -0
- package/esm/utils/applyOxcProcessors/expressionValues.js +152 -0
- package/esm/utils/applyOxcProcessors/expressionValues.js.map +1 -0
- package/esm/utils/applyOxcProcessors/processorFactory.js +62 -0
- package/esm/utils/applyOxcProcessors/processorFactory.js.map +1 -0
- package/esm/utils/applyOxcProcessors/processorUsages.js +143 -0
- package/esm/utils/applyOxcProcessors/processorUsages.js.map +1 -0
- package/esm/utils/applyOxcProcessors/sameFileStaticValues.js +207 -0
- package/esm/utils/applyOxcProcessors/sameFileStaticValues.js.map +1 -0
- package/esm/utils/applyOxcProcessors/shared.js +29 -0
- package/esm/utils/applyOxcProcessors/shared.js.map +1 -0
- package/esm/utils/applyOxcProcessors/types.js +2 -0
- package/esm/utils/applyOxcProcessors/types.js.map +1 -0
- package/esm/utils/applyOxcProcessors.js +2 -0
- package/esm/utils/applyOxcProcessors.js.map +1 -0
- package/esm/utils/collectOxcExportsAndImports.js +934 -0
- package/esm/utils/collectOxcExportsAndImports.js.map +1 -0
- package/esm/utils/collectOxcRuntime/normalizeRuntimeCode.js +157 -0
- package/esm/utils/collectOxcRuntime/normalizeRuntimeCode.js.map +1 -0
- package/esm/utils/collectOxcRuntime/sourceMap.js +36 -0
- package/esm/utils/collectOxcRuntime/sourceMap.js.map +1 -0
- package/esm/utils/collectOxcRuntime/types.js +2 -0
- package/esm/utils/collectOxcRuntime/types.js.map +1 -0
- package/esm/utils/collectOxcRuntime.js +32 -0
- package/esm/utils/collectOxcRuntime.js.map +1 -0
- package/esm/utils/collectOxcTemplateDependencies/expressionExtraction.js +496 -0
- package/esm/utils/collectOxcTemplateDependencies/expressionExtraction.js.map +1 -0
- package/esm/utils/collectOxcTemplateDependencies/expressionReplacements.js +113 -0
- package/esm/utils/collectOxcTemplateDependencies/expressionReplacements.js.map +1 -0
- package/esm/utils/collectOxcTemplateDependencies/scopeAnalysis.js +387 -0
- package/esm/utils/collectOxcTemplateDependencies/scopeAnalysis.js.map +1 -0
- package/esm/utils/collectOxcTemplateDependencies/staticBindings.js +17 -0
- package/esm/utils/collectOxcTemplateDependencies/staticBindings.js.map +1 -0
- package/esm/utils/collectOxcTemplateDependencies/staticEvaluator.js +540 -0
- package/esm/utils/collectOxcTemplateDependencies/staticEvaluator.js.map +1 -0
- package/esm/utils/collectOxcTemplateDependencies/types.js +2 -0
- package/esm/utils/collectOxcTemplateDependencies/types.js.map +1 -0
- package/esm/utils/collectOxcTemplateDependencies.js +4 -0
- package/esm/utils/collectOxcTemplateDependencies.js.map +1 -0
- package/esm/utils/dispose-polyfill.js +3 -4
- package/esm/utils/dispose-polyfill.js.map +1 -1
- package/esm/utils/getFileIdx.js +6 -6
- package/esm/utils/getFileIdx.js.map +1 -1
- package/esm/utils/getPluginKey.js +12 -12
- package/esm/utils/getPluginKey.js.map +1 -1
- package/esm/utils/getVisitorKeys.js +9 -3
- package/esm/utils/getVisitorKeys.js.map +1 -1
- package/esm/utils/hasCachedWywPrevalExport.js +23 -0
- package/esm/utils/hasCachedWywPrevalExport.js.map +1 -0
- package/esm/utils/hasWywPreval.js +5 -5
- package/esm/utils/hasWywPreval.js.map +1 -1
- package/esm/utils/importOverrides.js +75 -90
- package/esm/utils/importOverrides.js.map +1 -1
- package/esm/utils/isNode.js +2 -2
- package/esm/utils/isNode.js.map +1 -1
- package/esm/utils/isNotNull.js +2 -2
- package/esm/utils/isNotNull.js.map +1 -1
- package/esm/utils/isSerializable.js +11 -11
- package/esm/utils/isSerializable.js.map +1 -1
- package/esm/utils/nativeResolver.js +93 -0
- package/esm/utils/nativeResolver.js.map +1 -0
- package/esm/utils/oxc/ast.js +28 -0
- package/esm/utils/oxc/ast.js.map +1 -0
- package/esm/utils/oxc/parse.js +3 -0
- package/esm/utils/oxc/parse.js.map +1 -0
- package/esm/utils/oxc/replacements.js +14 -0
- package/esm/utils/oxc/replacements.js.map +1 -0
- package/esm/utils/oxc/sourceLocations.js +59 -0
- package/esm/utils/oxc/sourceLocations.js.map +1 -0
- package/esm/utils/oxcAstService.js +121 -0
- package/esm/utils/oxcAstService.js.map +1 -0
- package/esm/utils/oxcEmit.js +447 -0
- package/esm/utils/oxcEmit.js.map +1 -0
- package/esm/utils/oxcPreevalStage/evalStrategy.js +3 -0
- package/esm/utils/oxcPreevalStage/evalStrategy.js.map +1 -0
- package/esm/utils/oxcPreevalStage/prepareCode.js +21 -0
- package/esm/utils/oxcPreevalStage/prepareCode.js.map +1 -0
- package/esm/utils/oxcPreevalStage/prevalExport.js +23 -0
- package/esm/utils/oxcPreevalStage/prevalExport.js.map +1 -0
- package/esm/utils/oxcPreevalStage/processors.js +17 -0
- package/esm/utils/oxcPreevalStage/processors.js.map +1 -0
- package/esm/utils/oxcPreevalStage/staticOverlay.js +18 -0
- package/esm/utils/oxcPreevalStage/staticOverlay.js.map +1 -0
- package/esm/utils/oxcPreevalStage/types.js +2 -0
- package/esm/utils/oxcPreevalStage/types.js.map +1 -0
- package/esm/utils/oxcPreevalStage.js +41 -0
- package/esm/utils/oxcPreevalStage.js.map +1 -0
- package/esm/utils/oxcPreevalTransforms.js +1065 -0
- package/esm/utils/oxcPreevalTransforms.js.map +1 -0
- package/esm/utils/oxcShaker.js +662 -0
- package/esm/utils/oxcShaker.js.map +1 -0
- package/esm/utils/parseOxc.js +37 -0
- package/esm/utils/parseOxc.js.map +1 -0
- package/esm/utils/parseRequest.js +27 -27
- package/esm/utils/parseRequest.js.map +1 -1
- package/esm/utils/peek.js +1 -1
- package/esm/utils/peek.js.map +1 -1
- package/esm/utils/processorLookup.js +125 -0
- package/esm/utils/processorLookup.js.map +1 -0
- package/esm/utils/processorStaticSemantics.js +157 -0
- package/esm/utils/processorStaticSemantics.js.map +1 -0
- package/esm/utils/resolveWithConditions.js +99 -0
- package/esm/utils/resolveWithConditions.js.map +1 -0
- package/esm/vm/createVmContext.js +140 -141
- package/esm/vm/createVmContext.js.map +1 -1
- package/esm/vm/process.js +11 -13
- package/esm/vm/process.js.map +1 -1
- package/package.json +19 -26
- package/types/cache.d.ts +17 -8
- package/types/cache.js +245 -95
- package/types/debug/fileReporter.js +68 -23
- package/types/eval/broker.d.ts +92 -0
- package/types/eval/broker.js +2411 -0
- package/types/eval/lru.d.ts +10 -0
- package/types/eval/lru.js +36 -0
- package/types/eval/prepareModuleOnDemand.d.ts +7 -0
- package/types/eval/prepareModuleOnDemand.js +24 -0
- package/types/eval/protocol.d.ts +111 -0
- package/types/eval/protocol.js +1 -0
- package/types/eval/serialize.d.ts +78 -0
- package/types/eval/serialize.js +357 -0
- package/types/eval/writeQueue.d.ts +13 -0
- package/types/eval/writeQueue.js +80 -0
- package/types/evaluators/index.d.ts +2 -2
- package/types/evaluators/index.js +6 -9
- package/types/index.d.ts +3 -6
- package/types/index.js +24 -82
- package/types/module.d.ts +38 -7
- package/types/module.js +613 -192
- package/types/shaker.d.ts +2 -10
- package/types/shaker.js +10 -100
- package/types/transform/BaseEntrypoint.js +6 -11
- package/types/transform/Entrypoint.d.ts +15 -15
- package/types/transform/Entrypoint.helpers.d.ts +2 -5
- package/types/transform/Entrypoint.helpers.js +43 -203
- package/types/transform/Entrypoint.js +130 -53
- package/types/transform/Entrypoint.types.d.ts +31 -6
- package/types/transform/Entrypoint.types.js +1 -2
- package/types/transform/EvaluatedEntrypoint.d.ts +13 -2
- package/types/transform/EvaluatedEntrypoint.js +7 -6
- package/types/transform/actions/AbortError.js +2 -7
- package/types/transform/actions/BaseAction.js +4 -8
- package/types/transform/actions/UnprocessedEntrypointError.js +2 -7
- package/types/transform/actions/actionRunner.js +8 -12
- package/types/transform/actions/types.d.ts +2 -2
- package/types/transform/actions/types.js +1 -2
- package/types/transform/{barrelManifest.d.ts → barrelManifest.types.d.ts} +0 -2
- package/types/transform/barrelManifest.types.js +1 -0
- package/types/transform/generators/baseProcessingHandlers.d.ts +4 -5
- package/types/transform/generators/baseProcessingHandlers.js +10 -14
- package/types/transform/generators/collect.js +13 -39
- package/types/transform/generators/createStylisPreprocessor.js +19 -60
- package/types/transform/generators/evalFile.d.ts +2 -2
- package/types/transform/generators/evalFile.js +26 -28
- package/types/transform/generators/extract.js +5 -8
- package/types/transform/generators/getExports.js +23 -30
- package/types/transform/generators/index.d.ts +2 -2
- package/types/transform/generators/index.js +11 -14
- package/types/transform/generators/processEntrypoint.d.ts +2 -2
- package/types/transform/generators/processEntrypoint.js +60 -26
- package/types/transform/generators/processImports.d.ts +0 -3
- package/types/transform/generators/processImports.js +60 -20
- package/types/transform/generators/resolveImports.d.ts +3 -1
- package/types/transform/generators/resolveImports.js +66 -23
- package/types/transform/generators/resolveStaticOxcValues/cache.d.ts +25 -0
- package/types/transform/generators/resolveStaticOxcValues/cache.js +182 -0
- package/types/transform/generators/resolveStaticOxcValues/candidateResolver.d.ts +5 -0
- package/types/transform/generators/resolveStaticOxcValues/candidateResolver.js +149 -0
- package/types/transform/generators/resolveStaticOxcValues/dependencies.d.ts +6 -0
- package/types/transform/generators/resolveStaticOxcValues/dependencies.js +37 -0
- package/types/transform/generators/resolveStaticOxcValues/environment.d.ts +12 -0
- package/types/transform/generators/resolveStaticOxcValues/environment.js +32 -0
- package/types/transform/generators/resolveStaticOxcValues/exportResolver.d.ts +4 -0
- package/types/transform/generators/resolveStaticOxcValues/exportResolver.js +358 -0
- package/types/transform/generators/resolveStaticOxcValues/exportTargets.d.ts +20 -0
- package/types/transform/generators/resolveStaticOxcValues/exportTargets.js +285 -0
- package/types/transform/generators/resolveStaticOxcValues/objectAssign.d.ts +41 -0
- package/types/transform/generators/resolveStaticOxcValues/objectAssign.js +352 -0
- package/types/transform/generators/resolveStaticOxcValues/objectAssignStaticExport.d.ts +6 -0
- package/types/transform/generators/resolveStaticOxcValues/objectAssignStaticExport.js +88 -0
- package/types/transform/generators/resolveStaticOxcValues/opaqueRuntime.d.ts +13 -0
- package/types/transform/generators/resolveStaticOxcValues/opaqueRuntime.js +263 -0
- package/types/transform/generators/resolveStaticOxcValues/processorStaticExport.d.ts +4 -0
- package/types/transform/generators/resolveStaticOxcValues/processorStaticExport.js +191 -0
- package/types/transform/generators/resolveStaticOxcValues/processorStaticModel.d.ts +40 -0
- package/types/transform/generators/resolveStaticOxcValues/processorStaticModel.js +516 -0
- package/types/transform/generators/resolveStaticOxcValues/processorTarget.d.ts +5 -0
- package/types/transform/generators/resolveStaticOxcValues/processorTarget.js +62 -0
- package/types/transform/generators/resolveStaticOxcValues/programAnalysis.d.ts +11 -0
- package/types/transform/generators/resolveStaticOxcValues/programAnalysis.js +133 -0
- package/types/transform/generators/resolveStaticOxcValues/prune.d.ts +15 -0
- package/types/transform/generators/resolveStaticOxcValues/prune.js +220 -0
- package/types/transform/generators/resolveStaticOxcValues/resolveStaticOxcPreevalValues.d.ts +2 -0
- package/types/transform/generators/resolveStaticOxcValues/resolveStaticOxcPreevalValues.js +197 -0
- package/types/transform/generators/resolveStaticOxcValues/staticExpression.d.ts +25 -0
- package/types/transform/generators/resolveStaticOxcValues/staticExpression.js +391 -0
- package/types/transform/generators/resolveStaticOxcValues/staticExpressionDependencies.d.ts +14 -0
- package/types/transform/generators/resolveStaticOxcValues/staticExpressionDependencies.js +304 -0
- package/types/transform/generators/resolveStaticOxcValues/types.d.ts +99 -0
- package/types/transform/generators/resolveStaticOxcValues/types.js +2 -0
- package/types/transform/generators/resolveStaticOxcValues/zeroArgFunctionStaticExport.d.ts +7 -0
- package/types/transform/generators/resolveStaticOxcValues/zeroArgFunctionStaticExport.js +64 -0
- package/types/transform/generators/resolveStaticOxcValues.d.ts +1 -0
- package/types/transform/generators/resolveStaticOxcValues.js +1 -0
- package/types/transform/generators/{rewriteBarrelImports.d.ts → rewriteOxcBarrelImports.d.ts} +2 -3
- package/types/transform/generators/{rewriteBarrelImports.js → rewriteOxcBarrelImports.js} +282 -225
- package/types/transform/generators/transform.d.ts +3 -7
- package/types/transform/generators/transform.js +217 -199
- package/types/transform/generators/workflow.js +62 -45
- package/types/transform/helpers/loadWywOptions.js +115 -21
- package/types/transform/helpers/withDefaultServices.d.ts +1 -1
- package/types/transform/helpers/withDefaultServices.js +6 -44
- package/types/transform/isStaticallyEvaluatableModule.d.ts +1 -2
- package/types/transform/isStaticallyEvaluatableModule.js +125 -126
- package/types/transform/oxcBarrelManifest.d.ts +2 -0
- package/types/transform/{barrelManifest.js → oxcBarrelManifest.js} +156 -97
- package/types/transform/rootLog.js +2 -5
- package/types/transform/syntax.d.ts +38 -0
- package/types/transform/syntax.js +1 -0
- package/types/transform/types.d.ts +9 -6
- package/types/transform/types.js +1 -4
- package/types/transform.d.ts +2 -2
- package/types/transform.js +90 -101
- package/types/types.d.ts +0 -23
- package/types/types.js +1 -2
- package/types/utils/EventEmitter.d.ts +16 -1
- package/types/utils/EventEmitter.js +47 -18
- package/types/utils/ShakerMetadata.js +1 -5
- package/types/utils/TransformDiagnostics.js +3 -7
- package/types/utils/TransformMetadata.js +8 -16
- package/types/utils/applyOxcProcessors/applyOxcProcessors.d.ts +8 -0
- package/types/utils/applyOxcProcessors/applyOxcProcessors.js +167 -0
- package/types/utils/applyOxcProcessors/cleanupBindings.d.ts +12 -0
- package/types/utils/applyOxcProcessors/cleanupBindings.js +189 -0
- package/types/utils/applyOxcProcessors/cleanupRemovals.d.ts +16 -0
- package/types/utils/applyOxcProcessors/cleanupRemovals.js +482 -0
- package/types/utils/applyOxcProcessors/displayName.d.ts +9 -0
- package/types/utils/applyOxcProcessors/displayName.js +113 -0
- package/types/utils/applyOxcProcessors/expressionValues.d.ts +11 -0
- package/types/utils/applyOxcProcessors/expressionValues.js +170 -0
- package/types/utils/applyOxcProcessors/processorFactory.d.ts +7 -0
- package/types/utils/applyOxcProcessors/processorFactory.js +70 -0
- package/types/utils/applyOxcProcessors/processorUsages.d.ts +16 -0
- package/types/utils/applyOxcProcessors/processorUsages.js +163 -0
- package/types/utils/applyOxcProcessors/sameFileStaticValues.d.ts +23 -0
- package/types/utils/applyOxcProcessors/sameFileStaticValues.js +211 -0
- package/types/utils/applyOxcProcessors/shared.d.ts +10 -0
- package/types/utils/applyOxcProcessors/shared.js +37 -0
- package/types/utils/applyOxcProcessors/types.d.ts +88 -0
- package/types/utils/applyOxcProcessors/types.js +1 -0
- package/types/utils/applyOxcProcessors.d.ts +1 -0
- package/types/utils/applyOxcProcessors.js +1 -0
- package/types/utils/collectOxcExportsAndImports.d.ts +35 -0
- package/types/utils/collectOxcExportsAndImports.js +957 -0
- package/types/utils/collectOxcRuntime/normalizeRuntimeCode.d.ts +1 -0
- package/types/utils/collectOxcRuntime/normalizeRuntimeCode.js +185 -0
- package/types/utils/collectOxcRuntime/sourceMap.d.ts +2 -0
- package/types/utils/collectOxcRuntime/sourceMap.js +37 -0
- package/types/utils/collectOxcRuntime/types.d.ts +16 -0
- package/types/utils/collectOxcRuntime/types.js +1 -0
- package/types/utils/collectOxcRuntime.d.ts +4 -0
- package/types/utils/collectOxcRuntime.js +31 -0
- package/types/utils/collectOxcTemplateDependencies/expressionExtraction.d.ts +6 -0
- package/types/utils/collectOxcTemplateDependencies/expressionExtraction.js +550 -0
- package/types/utils/collectOxcTemplateDependencies/expressionReplacements.d.ts +11 -0
- package/types/utils/collectOxcTemplateDependencies/expressionReplacements.js +131 -0
- package/types/utils/collectOxcTemplateDependencies/scopeAnalysis.d.ts +20 -0
- package/types/utils/collectOxcTemplateDependencies/scopeAnalysis.js +434 -0
- package/types/utils/collectOxcTemplateDependencies/staticBindings.d.ts +7 -0
- package/types/utils/collectOxcTemplateDependencies/staticBindings.js +13 -0
- package/types/utils/collectOxcTemplateDependencies/staticEvaluator.d.ts +13 -0
- package/types/utils/collectOxcTemplateDependencies/staticEvaluator.js +626 -0
- package/types/utils/collectOxcTemplateDependencies/types.d.ts +116 -0
- package/types/utils/collectOxcTemplateDependencies/types.js +1 -0
- package/types/utils/collectOxcTemplateDependencies.d.ts +4 -0
- package/types/utils/collectOxcTemplateDependencies.js +3 -0
- package/types/utils/getFileIdx.js +1 -4
- package/types/utils/getPluginKey.d.ts +5 -2
- package/types/utils/getPluginKey.js +2 -6
- package/types/utils/getVisitorKeys.d.ts +4 -4
- package/types/utils/getVisitorKeys.js +9 -6
- package/types/utils/hasCachedWywPrevalExport.d.ts +14 -0
- package/types/utils/hasCachedWywPrevalExport.js +30 -0
- package/types/utils/hasWywPreval.js +1 -4
- package/types/utils/importOverrides.js +17 -27
- package/types/utils/isNode.d.ts +2 -2
- package/types/utils/isNode.js +2 -6
- package/types/utils/isNotNull.js +1 -4
- package/types/utils/isSerializable.js +3 -6
- package/types/utils/nativeResolver.d.ts +13 -0
- package/types/utils/nativeResolver.js +91 -0
- package/types/utils/oxc/ast.d.ts +4 -0
- package/types/utils/oxc/ast.js +37 -0
- package/types/utils/oxc/parse.d.ts +3 -0
- package/types/utils/oxc/parse.js +2 -0
- package/types/utils/oxc/replacements.d.ts +12 -0
- package/types/utils/oxc/replacements.js +18 -0
- package/types/utils/oxc/sourceLocations.d.ts +5 -0
- package/types/utils/oxc/sourceLocations.js +63 -0
- package/types/utils/oxcAstService.d.ts +11 -0
- package/types/utils/oxcAstService.js +79 -0
- package/types/utils/oxcEmit.d.ts +19 -0
- package/types/utils/oxcEmit.js +506 -0
- package/types/utils/oxcPreevalStage/evalStrategy.d.ts +3 -0
- package/types/utils/oxcPreevalStage/evalStrategy.js +2 -0
- package/types/utils/oxcPreevalStage/prepareCode.d.ts +3 -0
- package/types/utils/oxcPreevalStage/prepareCode.js +20 -0
- package/types/utils/oxcPreevalStage/prevalExport.d.ts +1 -0
- package/types/utils/oxcPreevalStage/prevalExport.js +22 -0
- package/types/utils/oxcPreevalStage/processors.d.ts +10 -0
- package/types/utils/oxcPreevalStage/processors.js +16 -0
- package/types/utils/oxcPreevalStage/staticOverlay.d.ts +3 -0
- package/types/utils/oxcPreevalStage/staticOverlay.js +23 -0
- package/types/utils/oxcPreevalStage/types.d.ts +22 -0
- package/types/utils/oxcPreevalStage/types.js +1 -0
- package/types/utils/oxcPreevalStage.d.ts +4 -0
- package/types/utils/oxcPreevalStage.js +40 -0
- package/types/utils/oxcPreevalTransforms.d.ts +13 -0
- package/types/utils/oxcPreevalTransforms.js +1192 -0
- package/types/utils/oxcShaker.d.ts +13 -0
- package/types/utils/oxcShaker.js +751 -0
- package/types/utils/parseOxc.d.ts +11 -0
- package/types/utils/parseOxc.js +38 -0
- package/types/utils/parseRequest.js +2 -7
- package/types/utils/peek.js +1 -5
- package/types/utils/processorLookup.d.ts +8 -0
- package/types/utils/processorLookup.js +135 -0
- package/types/utils/processorStaticSemantics.d.ts +13 -0
- package/types/utils/processorStaticSemantics.js +191 -0
- package/types/utils/resolveWithConditions.d.ts +12 -0
- package/types/utils/resolveWithConditions.js +103 -0
- package/types/vm/createVmContext.d.ts +2 -2
- package/types/vm/createVmContext.js +25 -62
- package/types/vm/process.js +20 -26
- package/esm/babel.js +0 -2
- package/esm/babel.js.map +0 -1
- package/esm/options/buildOptions.js +0 -168
- package/esm/options/buildOptions.js.map +0 -1
- package/esm/options/buildOptions.test.js +0 -138
- package/esm/options/buildOptions.test.js.map +0 -1
- package/esm/options/loadBabelOptions.js +0 -24
- package/esm/options/loadBabelOptions.js.map +0 -1
- package/esm/plugins/babel-transform.js +0 -53
- package/esm/plugins/babel-transform.js.map +0 -1
- package/esm/plugins/collector.js +0 -60
- package/esm/plugins/collector.js.map +0 -1
- package/esm/plugins/dynamic-import.js +0 -56
- package/esm/plugins/dynamic-import.js.map +0 -1
- package/esm/plugins/preeval.js +0 -73
- package/esm/plugins/preeval.js.map +0 -1
- package/esm/plugins/shaker.js +0 -680
- package/esm/plugins/shaker.js.map +0 -1
- package/esm/transform/barrelManifest.js +0 -291
- package/esm/transform/barrelManifest.js.map +0 -1
- package/esm/transform/generators/explodeReexports.js +0 -64
- package/esm/transform/generators/explodeReexports.js.map +0 -1
- package/esm/transform/generators/rewriteBarrelImports.js +0 -733
- package/esm/transform/generators/rewriteBarrelImports.js.map +0 -1
- package/esm/utils/addIdentifierToWywPreval.js +0 -68
- package/esm/utils/addIdentifierToWywPreval.js.map +0 -1
- package/esm/utils/collectExportsAndImports.js +0 -1157
- package/esm/utils/collectExportsAndImports.js.map +0 -1
- package/esm/utils/collectTemplateDependencies.js +0 -228
- package/esm/utils/collectTemplateDependencies.js.map +0 -1
- package/esm/utils/createId.js +0 -6
- package/esm/utils/createId.js.map +0 -1
- package/esm/utils/findIdentifiers.js +0 -62
- package/esm/utils/findIdentifiers.js.map +0 -1
- package/esm/utils/getConstantStringValue.js +0 -58
- package/esm/utils/getConstantStringValue.js.map +0 -1
- package/esm/utils/getMemberExpressionPropertyName.js +0 -11
- package/esm/utils/getMemberExpressionPropertyName.js.map +0 -1
- package/esm/utils/getScope.js +0 -6
- package/esm/utils/getScope.js.map +0 -1
- package/esm/utils/getSource.js +0 -15
- package/esm/utils/getSource.js.map +0 -1
- package/esm/utils/getTagProcessor.js +0 -404
- package/esm/utils/getTagProcessor.js.map +0 -1
- package/esm/utils/isExports.js +0 -22
- package/esm/utils/isExports.js.map +0 -1
- package/esm/utils/isGlobal.js +0 -6
- package/esm/utils/isGlobal.js.map +0 -1
- package/esm/utils/isNodePath.js +0 -4
- package/esm/utils/isNodePath.js.map +0 -1
- package/esm/utils/isRemoved.js +0 -46
- package/esm/utils/isRemoved.js.map +0 -1
- package/esm/utils/isRequire.js +0 -13
- package/esm/utils/isRequire.js.map +0 -1
- package/esm/utils/isTypedNode.js +0 -6
- package/esm/utils/isTypedNode.js.map +0 -1
- package/esm/utils/isUnnecessaryReactCall.js +0 -72
- package/esm/utils/isUnnecessaryReactCall.js.map +0 -1
- package/esm/utils/removeDangerousCode.js +0 -276
- package/esm/utils/removeDangerousCode.js.map +0 -1
- package/esm/utils/replaceImportMetaEnv.js +0 -44
- package/esm/utils/replaceImportMetaEnv.js.map +0 -1
- package/esm/utils/scopeHelpers.js +0 -527
- package/esm/utils/scopeHelpers.js.map +0 -1
- package/esm/utils/traversalCache.js +0 -23
- package/esm/utils/traversalCache.js.map +0 -1
- package/esm/utils/unwrapExpression.js +0 -18
- package/esm/utils/unwrapExpression.js.map +0 -1
- package/esm/utils/unwrapSequence.js +0 -14
- package/esm/utils/unwrapSequence.js.map +0 -1
- package/esm/utils/valueToLiteral.js +0 -59
- package/esm/utils/valueToLiteral.js.map +0 -1
- package/esm/utils/visitors/JSXElementsRemover.js +0 -51
- package/esm/utils/visitors/JSXElementsRemover.js.map +0 -1
- package/lib/babel.js +0 -2
- package/lib/babel.js.map +0 -1
- package/lib/cache.js +0 -308
- package/lib/cache.js.map +0 -1
- package/lib/debug/fileReporter.js +0 -153
- package/lib/debug/fileReporter.js.map +0 -1
- package/lib/evaluators/index.js +0 -20
- package/lib/evaluators/index.js.map +0 -1
- package/lib/index.js +0 -286
- package/lib/index.js.map +0 -1
- package/lib/module.js +0 -552
- package/lib/module.js.map +0 -1
- package/lib/options/buildOptions.js +0 -176
- package/lib/options/buildOptions.js.map +0 -1
- package/lib/options/buildOptions.test.js +0 -141
- package/lib/options/buildOptions.test.js.map +0 -1
- package/lib/options/loadBabelOptions.js +0 -31
- package/lib/options/loadBabelOptions.js.map +0 -1
- package/lib/plugins/babel-transform.js +0 -60
- package/lib/plugins/babel-transform.js.map +0 -1
- package/lib/plugins/collector.js +0 -70
- package/lib/plugins/collector.js.map +0 -1
- package/lib/plugins/dynamic-import.js +0 -61
- package/lib/plugins/dynamic-import.js.map +0 -1
- package/lib/plugins/preeval.js +0 -81
- package/lib/plugins/preeval.js.map +0 -1
- package/lib/plugins/shaker.js +0 -691
- package/lib/plugins/shaker.js.map +0 -1
- package/lib/shaker.js +0 -95
- package/lib/shaker.js.map +0 -1
- package/lib/transform/BaseEntrypoint.js +0 -179
- package/lib/transform/BaseEntrypoint.js.map +0 -1
- package/lib/transform/Entrypoint.helpers.js +0 -279
- package/lib/transform/Entrypoint.helpers.js.map +0 -1
- package/lib/transform/Entrypoint.js +0 -289
- package/lib/transform/Entrypoint.js.map +0 -1
- package/lib/transform/Entrypoint.types.js +0 -2
- package/lib/transform/Entrypoint.types.js.map +0 -1
- package/lib/transform/EvaluatedEntrypoint.js +0 -13
- package/lib/transform/EvaluatedEntrypoint.js.map +0 -1
- package/lib/transform/actions/AbortError.js +0 -16
- package/lib/transform/actions/AbortError.js.map +0 -1
- package/lib/transform/actions/BaseAction.js +0 -150
- package/lib/transform/actions/BaseAction.js.map +0 -1
- package/lib/transform/actions/UnprocessedEntrypointError.js +0 -16
- package/lib/transform/actions/UnprocessedEntrypointError.js.map +0 -1
- package/lib/transform/actions/actionRunner.js +0 -82
- package/lib/transform/actions/actionRunner.js.map +0 -1
- package/lib/transform/actions/types.js +0 -2
- package/lib/transform/actions/types.js.map +0 -1
- package/lib/transform/barrelManifest.js +0 -300
- package/lib/transform/barrelManifest.js.map +0 -1
- package/lib/transform/generators/baseProcessingHandlers.js +0 -27
- package/lib/transform/generators/baseProcessingHandlers.js.map +0 -1
- package/lib/transform/generators/collect.js +0 -66
- package/lib/transform/generators/collect.js.map +0 -1
- package/lib/transform/generators/createStylisPreprocessor.js +0 -372
- package/lib/transform/generators/createStylisPreprocessor.js.map +0 -1
- package/lib/transform/generators/evalFile.js +0 -57
- package/lib/transform/generators/evalFile.js.map +0 -1
- package/lib/transform/generators/explodeReexports.js +0 -71
- package/lib/transform/generators/explodeReexports.js.map +0 -1
- package/lib/transform/generators/extract.js +0 -102
- package/lib/transform/generators/extract.js.map +0 -1
- package/lib/transform/generators/getExports.js +0 -85
- package/lib/transform/generators/getExports.js.map +0 -1
- package/lib/transform/generators/index.js +0 -19
- package/lib/transform/generators/index.js.map +0 -1
- package/lib/transform/generators/processEntrypoint.js +0 -76
- package/lib/transform/generators/processEntrypoint.js.map +0 -1
- package/lib/transform/generators/processImports.js +0 -82
- package/lib/transform/generators/processImports.js.map +0 -1
- package/lib/transform/generators/resolveImports.js +0 -221
- package/lib/transform/generators/resolveImports.js.map +0 -1
- package/lib/transform/generators/rewriteBarrelImports.js +0 -743
- package/lib/transform/generators/rewriteBarrelImports.js.map +0 -1
- package/lib/transform/generators/transform.js +0 -272
- package/lib/transform/generators/transform.js.map +0 -1
- package/lib/transform/generators/workflow.js +0 -100
- package/lib/transform/generators/workflow.js.map +0 -1
- package/lib/transform/helpers/loadWywOptions.js +0 -88
- package/lib/transform/helpers/loadWywOptions.js.map +0 -1
- package/lib/transform/helpers/withDefaultServices.js +0 -31
- package/lib/transform/helpers/withDefaultServices.js.map +0 -1
- package/lib/transform/isStaticallyEvaluatableModule.js +0 -159
- package/lib/transform/isStaticallyEvaluatableModule.js.map +0 -1
- package/lib/transform/rootLog.js +0 -9
- package/lib/transform/rootLog.js.map +0 -1
- package/lib/transform/types.js +0 -8
- package/lib/transform/types.js.map +0 -1
- package/lib/transform.js +0 -160
- package/lib/transform.js.map +0 -1
- package/lib/types.js +0 -2
- package/lib/types.js.map +0 -1
- package/lib/utils/EventEmitter.js +0 -61
- package/lib/utils/EventEmitter.js.map +0 -1
- package/lib/utils/ShakerMetadata.js +0 -9
- package/lib/utils/ShakerMetadata.js.map +0 -1
- package/lib/utils/TransformDiagnostics.js +0 -20
- package/lib/utils/TransformDiagnostics.js.map +0 -1
- package/lib/utils/TransformMetadata.js +0 -45
- package/lib/utils/TransformMetadata.js.map +0 -1
- package/lib/utils/addIdentifierToWywPreval.js +0 -75
- package/lib/utils/addIdentifierToWywPreval.js.map +0 -1
- package/lib/utils/collectExportsAndImports.js +0 -1173
- package/lib/utils/collectExportsAndImports.js.map +0 -1
- package/lib/utils/collectTemplateDependencies.js +0 -242
- package/lib/utils/collectTemplateDependencies.js.map +0 -1
- package/lib/utils/createId.js +0 -13
- package/lib/utils/createId.js.map +0 -1
- package/lib/utils/dispose-polyfill.js +0 -9
- package/lib/utils/dispose-polyfill.js.map +0 -1
- package/lib/utils/findIdentifiers.js +0 -73
- package/lib/utils/findIdentifiers.js.map +0 -1
- package/lib/utils/getConstantStringValue.js +0 -66
- package/lib/utils/getConstantStringValue.js.map +0 -1
- package/lib/utils/getFileIdx.js +0 -16
- package/lib/utils/getFileIdx.js.map +0 -1
- package/lib/utils/getMemberExpressionPropertyName.js +0 -18
- package/lib/utils/getMemberExpressionPropertyName.js.map +0 -1
- package/lib/utils/getPluginKey.js +0 -21
- package/lib/utils/getPluginKey.js.map +0 -1
- package/lib/utils/getScope.js +0 -12
- package/lib/utils/getScope.js.map +0 -1
- package/lib/utils/getSource.js +0 -24
- package/lib/utils/getSource.js.map +0 -1
- package/lib/utils/getTagProcessor.js +0 -424
- package/lib/utils/getTagProcessor.js.map +0 -1
- package/lib/utils/getVisitorKeys.js +0 -11
- package/lib/utils/getVisitorKeys.js.map +0 -1
- package/lib/utils/hasWywPreval.js +0 -13
- package/lib/utils/hasWywPreval.js.map +0 -1
- package/lib/utils/importOverrides.js +0 -119
- package/lib/utils/importOverrides.js.map +0 -1
- package/lib/utils/isExports.js +0 -27
- package/lib/utils/isExports.js.map +0 -1
- package/lib/utils/isGlobal.js +0 -13
- package/lib/utils/isGlobal.js.map +0 -1
- package/lib/utils/isNode.js +0 -9
- package/lib/utils/isNode.js.map +0 -1
- package/lib/utils/isNodePath.js +0 -10
- package/lib/utils/isNodePath.js.map +0 -1
- package/lib/utils/isNotNull.js +0 -10
- package/lib/utils/isNotNull.js.map +0 -1
- package/lib/utils/isRemoved.js +0 -52
- package/lib/utils/isRemoved.js.map +0 -1
- package/lib/utils/isRequire.js +0 -18
- package/lib/utils/isRequire.js.map +0 -1
- package/lib/utils/isSerializable.js +0 -19
- package/lib/utils/isSerializable.js.map +0 -1
- package/lib/utils/isTypedNode.js +0 -13
- package/lib/utils/isTypedNode.js.map +0 -1
- package/lib/utils/isUnnecessaryReactCall.js +0 -81
- package/lib/utils/isUnnecessaryReactCall.js.map +0 -1
- package/lib/utils/parseRequest.js +0 -37
- package/lib/utils/parseRequest.js.map +0 -1
- package/lib/utils/peek.js +0 -9
- package/lib/utils/peek.js.map +0 -1
- package/lib/utils/removeDangerousCode.js +0 -284
- package/lib/utils/removeDangerousCode.js.map +0 -1
- package/lib/utils/replaceImportMetaEnv.js +0 -50
- package/lib/utils/replaceImportMetaEnv.js.map +0 -1
- package/lib/utils/scopeHelpers.js +0 -557
- package/lib/utils/scopeHelpers.js.map +0 -1
- package/lib/utils/traversalCache.js +0 -31
- package/lib/utils/traversalCache.js.map +0 -1
- package/lib/utils/unwrapExpression.js +0 -25
- package/lib/utils/unwrapExpression.js.map +0 -1
- package/lib/utils/unwrapSequence.js +0 -20
- package/lib/utils/unwrapSequence.js.map +0 -1
- package/lib/utils/valueToLiteral.js +0 -65
- package/lib/utils/valueToLiteral.js.map +0 -1
- package/lib/utils/visitors/JSXElementsRemover.js +0 -57
- package/lib/utils/visitors/JSXElementsRemover.js.map +0 -1
- package/lib/vm/createVmContext.js +0 -166
- package/lib/vm/createVmContext.js.map +0 -1
- package/lib/vm/process.js +0 -38
- package/lib/vm/process.js.map +0 -1
- package/types/babel.d.ts +0 -2
- package/types/babel.js +0 -2
- package/types/options/buildOptions.d.ts +0 -6
- package/types/options/buildOptions.js +0 -178
- package/types/options/loadBabelOptions.d.ts +0 -3
- package/types/options/loadBabelOptions.js +0 -26
- package/types/plugins/babel-transform.d.ts +0 -4
- package/types/plugins/babel-transform.js +0 -49
- package/types/plugins/collector.d.ts +0 -23
- package/types/plugins/collector.js +0 -62
- package/types/plugins/dynamic-import.d.ts +0 -6
- package/types/plugins/dynamic-import.js +0 -60
- package/types/plugins/preeval.d.ts +0 -16
- package/types/plugins/preeval.js +0 -69
- package/types/plugins/shaker.d.ts +0 -14
- package/types/plugins/shaker.js +0 -724
- package/types/transform/generators/explodeReexports.d.ts +0 -7
- package/types/transform/generators/explodeReexports.js +0 -65
- package/types/utils/addIdentifierToWywPreval.d.ts +0 -4
- package/types/utils/addIdentifierToWywPreval.js +0 -74
- package/types/utils/collectExportsAndImports.d.ts +0 -31
- package/types/utils/collectExportsAndImports.js +0 -1147
- package/types/utils/collectTemplateDependencies.d.ts +0 -17
- package/types/utils/collectTemplateDependencies.js +0 -220
- package/types/utils/createId.d.ts +0 -2
- package/types/utils/createId.js +0 -9
- package/types/utils/findIdentifiers.d.ts +0 -6
- package/types/utils/findIdentifiers.js +0 -67
- package/types/utils/getConstantStringValue.d.ts +0 -2
- package/types/utils/getConstantStringValue.js +0 -94
- package/types/utils/getMemberExpressionPropertyName.d.ts +0 -2
- package/types/utils/getMemberExpressionPropertyName.js +0 -46
- package/types/utils/getScope.d.ts +0 -2
- package/types/utils/getScope.js +0 -10
- package/types/utils/getSource.d.ts +0 -2
- package/types/utils/getSource.js +0 -22
- package/types/utils/getTagProcessor.d.ts +0 -13
- package/types/utils/getTagProcessor.js +0 -411
- package/types/utils/isExports.d.ts +0 -6
- package/types/utils/isExports.js +0 -19
- package/types/utils/isGlobal.d.ts +0 -2
- package/types/utils/isGlobal.js +0 -9
- package/types/utils/isNodePath.d.ts +0 -3
- package/types/utils/isNodePath.js +0 -6
- package/types/utils/isRemoved.d.ts +0 -5
- package/types/utils/isRemoved.js +0 -41
- package/types/utils/isRequire.d.ts +0 -6
- package/types/utils/isRequire.js +0 -14
- package/types/utils/isTypedNode.d.ts +0 -5
- package/types/utils/isTypedNode.js +0 -9
- package/types/utils/isUnnecessaryReactCall.d.ts +0 -3
- package/types/utils/isUnnecessaryReactCall.js +0 -75
- package/types/utils/removeDangerousCode.d.ts +0 -4
- package/types/utils/removeDangerousCode.js +0 -326
- package/types/utils/replaceImportMetaEnv.d.ts +0 -3
- package/types/utils/replaceImportMetaEnv.js +0 -39
- package/types/utils/scopeHelpers.d.ts +0 -12
- package/types/utils/scopeHelpers.js +0 -580
- package/types/utils/traversalCache.d.ts +0 -4
- package/types/utils/traversalCache.js +0 -27
- package/types/utils/unwrapExpression.d.ts +0 -2
- package/types/utils/unwrapExpression.js +0 -57
- package/types/utils/unwrapSequence.d.ts +0 -8
- package/types/utils/unwrapSequence.js +0 -16
- package/types/utils/valueToLiteral.d.ts +0 -3
- package/types/utils/valueToLiteral.js +0 -63
- package/types/utils/visitors/JSXElementsRemover.d.ts +0 -3
- package/types/utils/visitors/JSXElementsRemover.js +0 -51
|
@@ -1,47 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.createVmContext = createVmContext;
|
|
37
|
-
const vm = __importStar(require("vm"));
|
|
38
|
-
const shared_1 = require("@wyw-in-js/shared");
|
|
39
|
-
const process = __importStar(require("./process"));
|
|
1
|
+
import * as vm from 'vm';
|
|
2
|
+
import { isFeatureEnabled } from '@wyw-in-js/shared';
|
|
3
|
+
import * as process from './process';
|
|
40
4
|
const NOOP = () => { };
|
|
41
5
|
const IMPORT_META_ENV = '__wyw_import_meta_env';
|
|
42
6
|
const HAPPY_DOM_REQUIRE_HOOK = '__wyw_requireHappyDom';
|
|
43
7
|
let importMetaEnvWarned = false;
|
|
44
|
-
let
|
|
8
|
+
let happyDomLoadWarned = false;
|
|
45
9
|
let happyDomUnavailable = false;
|
|
46
10
|
function isErrRequireEsm(error) {
|
|
47
11
|
return (typeof error === 'object' &&
|
|
@@ -93,19 +57,23 @@ function createImportMetaEnvProxy() {
|
|
|
93
57
|
},
|
|
94
58
|
});
|
|
95
59
|
}
|
|
96
|
-
|
|
60
|
+
let happyDomImportPromise = null;
|
|
61
|
+
async function loadHappyDom() {
|
|
97
62
|
const hook = globalThis[HAPPY_DOM_REQUIRE_HOOK];
|
|
98
63
|
if (typeof hook === 'function') {
|
|
99
|
-
|
|
64
|
+
const result = hook();
|
|
65
|
+
return Promise.resolve(result);
|
|
100
66
|
}
|
|
101
|
-
|
|
102
|
-
|
|
67
|
+
if (!happyDomImportPromise) {
|
|
68
|
+
happyDomImportPromise = import('happy-dom');
|
|
69
|
+
}
|
|
70
|
+
return happyDomImportPromise;
|
|
103
71
|
}
|
|
104
|
-
function createWindow() {
|
|
72
|
+
async function createWindow() {
|
|
105
73
|
if (happyDomUnavailable)
|
|
106
74
|
return undefined;
|
|
107
75
|
try {
|
|
108
|
-
const { Window, GlobalWindow } =
|
|
76
|
+
const { Window, GlobalWindow } = await loadHappyDom();
|
|
109
77
|
const HappyWindow = GlobalWindow || Window;
|
|
110
78
|
const win = new HappyWindow();
|
|
111
79
|
// TODO: browser doesn't expose Buffer, but a lot of dependencies use it
|
|
@@ -114,27 +82,22 @@ function createWindow() {
|
|
|
114
82
|
return win;
|
|
115
83
|
}
|
|
116
84
|
catch (error) {
|
|
117
|
-
if (
|
|
118
|
-
|
|
85
|
+
if (isErrRequireEsm(error)) {
|
|
86
|
+
// This can happen if a custom hook still uses require() for ESM.
|
|
119
87
|
}
|
|
120
|
-
|
|
121
|
-
'function';
|
|
122
|
-
if (!hasCustomRequireHook) {
|
|
88
|
+
else if (!happyDomUnavailable) {
|
|
123
89
|
happyDomUnavailable = true;
|
|
124
90
|
}
|
|
125
|
-
if (
|
|
91
|
+
if (happyDomLoadWarned)
|
|
126
92
|
return undefined;
|
|
127
|
-
|
|
93
|
+
happyDomLoadWarned = true;
|
|
128
94
|
// eslint-disable-next-line no-console
|
|
129
95
|
console.warn([
|
|
130
96
|
`[wyw-in-js] DOM emulation is enabled (features.happyDOM), but "happy-dom" could not be loaded in this build-time runtime.`,
|
|
131
|
-
`This usually happens because "happy-dom" is ESM-only and cannot be loaded via require() in a CJS build.`,
|
|
132
|
-
``,
|
|
133
97
|
`WyW will continue without DOM emulation (as if features.happyDOM:false).`,
|
|
134
98
|
``,
|
|
135
99
|
`To silence this warning: set features: { happyDOM: false }.`,
|
|
136
|
-
`To
|
|
137
|
-
`or a runtime that supports require(ESM) (Node 24+).`,
|
|
100
|
+
`To restore DOM emulation, ensure "happy-dom" can be imported in the build-time runtime.`,
|
|
138
101
|
].join('\n'));
|
|
139
102
|
return undefined;
|
|
140
103
|
}
|
|
@@ -177,8 +140,8 @@ function createNothing() {
|
|
|
177
140
|
window: undefined,
|
|
178
141
|
};
|
|
179
142
|
}
|
|
180
|
-
function createHappyDOMWindow() {
|
|
181
|
-
const win = createWindow();
|
|
143
|
+
async function createHappyDOMWindow() {
|
|
144
|
+
const win = await createWindow();
|
|
182
145
|
if (!win)
|
|
183
146
|
return createNothing();
|
|
184
147
|
return {
|
|
@@ -188,10 +151,10 @@ function createHappyDOMWindow() {
|
|
|
188
151
|
window: win,
|
|
189
152
|
};
|
|
190
153
|
}
|
|
191
|
-
function createVmContext(filename, features, additionalContext, overrideContext = (i) => i) {
|
|
192
|
-
const isHappyDOMEnabled =
|
|
154
|
+
export async function createVmContext(filename, features, additionalContext, overrideContext = (i) => i) {
|
|
155
|
+
const isHappyDOMEnabled = isFeatureEnabled(features, 'happyDOM', filename);
|
|
193
156
|
const { teardown, window } = isHappyDOMEnabled
|
|
194
|
-
? createHappyDOMWindow()
|
|
157
|
+
? await createHappyDOMWindow()
|
|
195
158
|
: createNothing();
|
|
196
159
|
const envContext = {
|
|
197
160
|
[IMPORT_META_ENV]: createImportMetaEnvProxy(),
|
package/types/vm/process.js
CHANGED
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.env = exports.features = exports.uvCounters = exports.memoryUsage = exports.uptime = exports.dlopen = exports.umask = exports.chdir = exports.kill = exports.exit = exports.cwd = exports.binding = exports.argv = exports.browser = exports.pid = exports.title = exports.execPath = exports.arch = exports.platform = exports.nextTick = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* It contains API for mocked process variable available in node environment used to evaluate scripts with node's `vm` in ./module.ts
|
|
6
3
|
*/
|
|
7
|
-
const nextTick = (fn) => setTimeout(fn, 0);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const binding = function binding() {
|
|
4
|
+
export const nextTick = (fn) => setTimeout(fn, 0);
|
|
5
|
+
export const platform = 'browser';
|
|
6
|
+
export const arch = 'browser';
|
|
7
|
+
export const execPath = 'browser';
|
|
8
|
+
export const title = 'browser';
|
|
9
|
+
export const pid = 1;
|
|
10
|
+
export const browser = true;
|
|
11
|
+
export const argv = [];
|
|
12
|
+
export const binding = function binding() {
|
|
17
13
|
throw new Error('No such module. (Possibly not yet loaded)');
|
|
18
14
|
};
|
|
19
|
-
|
|
20
|
-
const cwd = () => '/';
|
|
21
|
-
exports.cwd = cwd;
|
|
15
|
+
export const cwd = () => '/';
|
|
22
16
|
const noop = () => { };
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
export const exit = noop;
|
|
18
|
+
export const kill = noop;
|
|
19
|
+
export const chdir = noop;
|
|
20
|
+
export const umask = noop;
|
|
21
|
+
export const dlopen = noop;
|
|
22
|
+
export const uptime = noop;
|
|
23
|
+
export const memoryUsage = noop;
|
|
24
|
+
export const uvCounters = noop;
|
|
25
|
+
export const features = {};
|
|
26
|
+
export const { env } = process;
|
package/esm/babel.js
DELETED
package/esm/babel.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"babel.js","names":[],"sources":["../src/babel.ts"],"sourcesContent":["import type core from '@babel/core';\n\nexport type Core = typeof core;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { isNotNull } from '../utils/isNotNull';
|
|
2
|
-
const cache = new WeakMap();
|
|
3
|
-
const isPlainObject = value => {
|
|
4
|
-
if (typeof value !== 'object' || value === null) return false;
|
|
5
|
-
const prototype = Object.getPrototypeOf(value);
|
|
6
|
-
return prototype === Object.prototype || prototype === null;
|
|
7
|
-
};
|
|
8
|
-
const mergeArraysUnique = (source = [], overrides = []) => [...new Set([...source, ...overrides])];
|
|
9
|
-
const mergeUnknown = (source, overrides) => {
|
|
10
|
-
if (Array.isArray(source) && Array.isArray(overrides)) {
|
|
11
|
-
return mergeArraysUnique(source, overrides);
|
|
12
|
-
}
|
|
13
|
-
if (isPlainObject(source) && isPlainObject(overrides)) {
|
|
14
|
-
const result = {
|
|
15
|
-
...source
|
|
16
|
-
};
|
|
17
|
-
for (const [key, value] of Object.entries(overrides)) {
|
|
18
|
-
result[key] = key in source ? mergeUnknown(source[key], value) : value;
|
|
19
|
-
}
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
return overrides;
|
|
23
|
-
};
|
|
24
|
-
const getItemKey = item => {
|
|
25
|
-
if (typeof item === 'string') return item;
|
|
26
|
-
if (Array.isArray(item)) return getItemKey(item[0]);
|
|
27
|
-
if (typeof item === 'object' && item !== null && 'key' in item) {
|
|
28
|
-
const {
|
|
29
|
-
key
|
|
30
|
-
} = item;
|
|
31
|
-
return typeof key === 'string' ? key : null;
|
|
32
|
-
}
|
|
33
|
-
return null;
|
|
34
|
-
};
|
|
35
|
-
const getItemOptions = item => {
|
|
36
|
-
if (!Array.isArray(item)) return {};
|
|
37
|
-
const options = item[1];
|
|
38
|
-
return isPlainObject(options) ? options : {};
|
|
39
|
-
};
|
|
40
|
-
const toItemWithOptions = (key, options) => Object.keys(options).length ? [key, options] : key;
|
|
41
|
-
const normalizeKey = key => key.replace(/\\/g, '/');
|
|
42
|
-
const extractPackageNameFromPath = key => {
|
|
43
|
-
const normalized = normalizeKey(key);
|
|
44
|
-
const token = '/node_modules/';
|
|
45
|
-
let nodeModulesIndex = normalized.lastIndexOf(token);
|
|
46
|
-
while (nodeModulesIndex !== -1) {
|
|
47
|
-
const start = nodeModulesIndex + token.length;
|
|
48
|
-
const firstChar = normalized[start];
|
|
49
|
-
if (!firstChar) return null;
|
|
50
|
-
let packageName = null;
|
|
51
|
-
if (firstChar === '@') {
|
|
52
|
-
const scopeEnd = normalized.indexOf('/', start);
|
|
53
|
-
if (scopeEnd === -1) return null;
|
|
54
|
-
const nameEnd = normalized.indexOf('/', scopeEnd + 1);
|
|
55
|
-
if (nameEnd === -1) return null;
|
|
56
|
-
packageName = normalized.slice(start, nameEnd);
|
|
57
|
-
} else {
|
|
58
|
-
const nameEnd = normalized.indexOf('/', start);
|
|
59
|
-
if (nameEnd === -1) return null;
|
|
60
|
-
packageName = normalized.slice(start, nameEnd);
|
|
61
|
-
}
|
|
62
|
-
if (!packageName.startsWith('.')) return packageName;
|
|
63
|
-
nodeModulesIndex = normalized.lastIndexOf(token, nodeModulesIndex - 1);
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
66
|
-
};
|
|
67
|
-
const addBabelVariants = (kind, variants, key) => {
|
|
68
|
-
const prefix = kind === 'preset' ? ['@babel/preset-', 'babel-preset-'] : ['@babel/plugin-', 'babel-plugin-'];
|
|
69
|
-
const normalized = normalizeKey(key);
|
|
70
|
-
variants.add(normalized);
|
|
71
|
-
const packageNameFromPath = extractPackageNameFromPath(normalized);
|
|
72
|
-
if (packageNameFromPath) {
|
|
73
|
-
variants.add(packageNameFromPath);
|
|
74
|
-
}
|
|
75
|
-
for (const p of prefix) {
|
|
76
|
-
if (normalized.startsWith(p)) {
|
|
77
|
-
variants.add(normalized.slice(p.length));
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if (!normalized.includes('/') && !normalized.startsWith('.')) {
|
|
81
|
-
variants.add(`${prefix[0]}${normalized}`);
|
|
82
|
-
variants.add(`${prefix[1]}${normalized}`);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
const areKeysCompatible = (kind, a, b) => {
|
|
86
|
-
const aVariants = new Set();
|
|
87
|
-
addBabelVariants(kind, aVariants, a);
|
|
88
|
-
const bVariants = new Set();
|
|
89
|
-
addBabelVariants(kind, bVariants, b);
|
|
90
|
-
for (const aVar of aVariants) {
|
|
91
|
-
if (bVariants.has(aVar)) return true;
|
|
92
|
-
}
|
|
93
|
-
return false;
|
|
94
|
-
};
|
|
95
|
-
const mergeConfigItems = (kind, source, overrides) => {
|
|
96
|
-
const combined = [...(source ?? []), ...(overrides ?? [])];
|
|
97
|
-
return combined.reduce((reduction, override) => {
|
|
98
|
-
const overrideKey = getItemKey(override);
|
|
99
|
-
if (!overrideKey) {
|
|
100
|
-
reduction.push(override);
|
|
101
|
-
return reduction;
|
|
102
|
-
}
|
|
103
|
-
const overrideOptions = getItemOptions(override);
|
|
104
|
-
const base = reduction.find(candidate => {
|
|
105
|
-
const baseKey = getItemKey(candidate);
|
|
106
|
-
return baseKey ? areKeysCompatible(kind, baseKey, overrideKey) : false;
|
|
107
|
-
});
|
|
108
|
-
if (!base) {
|
|
109
|
-
reduction.push(toItemWithOptions(overrideKey, overrideOptions));
|
|
110
|
-
return reduction;
|
|
111
|
-
}
|
|
112
|
-
const index = reduction.indexOf(base);
|
|
113
|
-
const baseKey = getItemKey(base) ?? overrideKey;
|
|
114
|
-
const baseOptions = getItemOptions(base);
|
|
115
|
-
const options = mergeUnknown(baseOptions, overrideOptions);
|
|
116
|
-
reduction.splice(index, 1, toItemWithOptions(baseKey, options));
|
|
117
|
-
return reduction;
|
|
118
|
-
}, []);
|
|
119
|
-
};
|
|
120
|
-
const babelMerge = (source, overrides) => {
|
|
121
|
-
const {
|
|
122
|
-
plugins: sourcePlugins,
|
|
123
|
-
presets: sourcePresets,
|
|
124
|
-
env: sourceEnv,
|
|
125
|
-
...sourceRest
|
|
126
|
-
} = source;
|
|
127
|
-
const {
|
|
128
|
-
plugins: overridesPlugins,
|
|
129
|
-
presets: overridesPresets,
|
|
130
|
-
env: overridesEnv,
|
|
131
|
-
...overridesRest
|
|
132
|
-
} = overrides;
|
|
133
|
-
const plugins = mergeConfigItems('plugin', sourcePlugins, overridesPlugins);
|
|
134
|
-
const presets = mergeConfigItems('preset', sourcePresets, overridesPresets);
|
|
135
|
-
const merged = mergeUnknown(sourceRest, overridesRest);
|
|
136
|
-
if (presets.length) merged.presets = presets;
|
|
137
|
-
if (plugins.length) merged.plugins = plugins;
|
|
138
|
-
const envNames = new Set([...Object.keys(sourceEnv ?? {}), ...Object.keys(overridesEnv ?? {})]);
|
|
139
|
-
if (envNames.size) {
|
|
140
|
-
merged.env = {};
|
|
141
|
-
for (const name of envNames) {
|
|
142
|
-
merged.env[name] = babelMerge(sourceEnv?.[name] ?? {}, overridesEnv?.[name] ?? {});
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return merged;
|
|
146
|
-
};
|
|
147
|
-
const merge = (a, b) => {
|
|
148
|
-
if (!cache.has(a)) {
|
|
149
|
-
cache.set(a, new WeakMap());
|
|
150
|
-
}
|
|
151
|
-
const cacheForA = cache.get(a);
|
|
152
|
-
if (cacheForA.has(b)) {
|
|
153
|
-
return cacheForA.get(b);
|
|
154
|
-
}
|
|
155
|
-
const result = babelMerge(a, b);
|
|
156
|
-
cacheForA.set(b, result);
|
|
157
|
-
return result;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Merges babel configs together. If a pair of configs were merged before,
|
|
162
|
-
* it will return the cached result.
|
|
163
|
-
*/
|
|
164
|
-
export function buildOptions(...configs) {
|
|
165
|
-
// Merge all configs together
|
|
166
|
-
return configs.map(i => i ?? null).filter(isNotNull).reduce(merge);
|
|
167
|
-
}
|
|
168
|
-
//# sourceMappingURL=buildOptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildOptions.js","names":["isNotNull","cache","WeakMap","isPlainObject","value","prototype","Object","getPrototypeOf","mergeArraysUnique","source","overrides","Set","mergeUnknown","Array","isArray","result","key","entries","getItemKey","item","getItemOptions","options","toItemWithOptions","keys","length","normalizeKey","replace","extractPackageNameFromPath","normalized","token","nodeModulesIndex","lastIndexOf","start","firstChar","packageName","scopeEnd","indexOf","nameEnd","slice","startsWith","addBabelVariants","kind","variants","prefix","add","packageNameFromPath","p","includes","areKeysCompatible","a","b","aVariants","bVariants","aVar","has","mergeConfigItems","combined","reduce","reduction","override","overrideKey","push","overrideOptions","base","find","candidate","baseKey","index","baseOptions","splice","babelMerge","plugins","sourcePlugins","presets","sourcePresets","env","sourceEnv","sourceRest","overridesPlugins","overridesPresets","overridesEnv","overridesRest","merged","envNames","size","name","merge","set","cacheForA","get","buildOptions","configs","map","i","filter"],"sources":["../../src/options/buildOptions.ts"],"sourcesContent":["import type { TransformOptions } from '@babel/core';\n\nimport { isNotNull } from '../utils/isNotNull';\n\nconst cache = new WeakMap<\n TransformOptions,\n WeakMap<TransformOptions, TransformOptions>\n>();\n\ntype PlainObject = Record<string, unknown>;\n\nconst isPlainObject = (value: unknown): value is PlainObject => {\n if (typeof value !== 'object' || value === null) return false;\n\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n};\n\ntype ItemKind = 'plugin' | 'preset';\n\nconst mergeArraysUnique = <T>(source: T[] = [], overrides: T[] = []) => [\n ...new Set([...source, ...overrides]),\n];\n\nconst mergeUnknown = (source: unknown, overrides: unknown): unknown => {\n if (Array.isArray(source) && Array.isArray(overrides)) {\n return mergeArraysUnique(source, overrides);\n }\n\n if (isPlainObject(source) && isPlainObject(overrides)) {\n const result: PlainObject = { ...source };\n\n for (const [key, value] of Object.entries(overrides)) {\n result[key] = key in source ? mergeUnknown(source[key], value) : value;\n }\n\n return result;\n }\n\n return overrides;\n};\n\ntype PluginOrPresetItem = NonNullable<\n TransformOptions['plugins']\n>[number] extends never\n ? unknown\n : NonNullable<TransformOptions['plugins']>[number];\n\nconst getItemKey = (item: unknown): string | null => {\n if (typeof item === 'string') return item;\n if (Array.isArray(item)) return getItemKey(item[0]);\n if (typeof item === 'object' && item !== null && 'key' in item) {\n const { key } = item as { key?: unknown };\n return typeof key === 'string' ? key : null;\n }\n\n return null;\n};\n\nconst getItemOptions = (item: unknown): PlainObject => {\n if (!Array.isArray(item)) return {};\n const options = item[1];\n return isPlainObject(options) ? options : {};\n};\n\nconst toItemWithOptions = (key: string, options: PlainObject) =>\n Object.keys(options).length ? ([key, options] as const) : key;\n\nconst normalizeKey = (key: string) => key.replace(/\\\\/g, '/');\n\nconst extractPackageNameFromPath = (key: string): string | null => {\n const normalized = normalizeKey(key);\n const token = '/node_modules/';\n\n let nodeModulesIndex = normalized.lastIndexOf(token);\n while (nodeModulesIndex !== -1) {\n const start = nodeModulesIndex + token.length;\n const firstChar = normalized[start];\n if (!firstChar) return null;\n\n let packageName: string | null = null;\n if (firstChar === '@') {\n const scopeEnd = normalized.indexOf('/', start);\n if (scopeEnd === -1) return null;\n const nameEnd = normalized.indexOf('/', scopeEnd + 1);\n if (nameEnd === -1) return null;\n packageName = normalized.slice(start, nameEnd);\n } else {\n const nameEnd = normalized.indexOf('/', start);\n if (nameEnd === -1) return null;\n packageName = normalized.slice(start, nameEnd);\n }\n\n if (!packageName.startsWith('.')) return packageName;\n\n nodeModulesIndex = normalized.lastIndexOf(token, nodeModulesIndex - 1);\n }\n\n return null;\n};\n\nconst addBabelVariants = (\n kind: ItemKind,\n variants: Set<string>,\n key: string\n) => {\n const prefix =\n kind === 'preset'\n ? ['@babel/preset-', 'babel-preset-']\n : ['@babel/plugin-', 'babel-plugin-'];\n\n const normalized = normalizeKey(key);\n variants.add(normalized);\n\n const packageNameFromPath = extractPackageNameFromPath(normalized);\n if (packageNameFromPath) {\n variants.add(packageNameFromPath);\n }\n\n for (const p of prefix) {\n if (normalized.startsWith(p)) {\n variants.add(normalized.slice(p.length));\n }\n }\n\n if (!normalized.includes('/') && !normalized.startsWith('.')) {\n variants.add(`${prefix[0]}${normalized}`);\n variants.add(`${prefix[1]}${normalized}`);\n }\n};\n\nconst areKeysCompatible = (kind: ItemKind, a: string, b: string) => {\n const aVariants = new Set<string>();\n addBabelVariants(kind, aVariants, a);\n\n const bVariants = new Set<string>();\n addBabelVariants(kind, bVariants, b);\n\n for (const aVar of aVariants) {\n if (bVariants.has(aVar)) return true;\n }\n\n return false;\n};\n\nconst mergeConfigItems = (\n kind: ItemKind,\n source: PluginOrPresetItem[] | null | undefined,\n overrides: PluginOrPresetItem[] | null | undefined\n) => {\n const combined = [...(source ?? []), ...(overrides ?? [])];\n\n return combined.reduce<PluginOrPresetItem[]>((reduction, override) => {\n const overrideKey = getItemKey(override);\n if (!overrideKey) {\n reduction.push(override);\n return reduction;\n }\n\n const overrideOptions = getItemOptions(override);\n\n const base = reduction.find((candidate) => {\n const baseKey = getItemKey(candidate);\n return baseKey ? areKeysCompatible(kind, baseKey, overrideKey) : false;\n });\n\n if (!base) {\n reduction.push(\n toItemWithOptions(overrideKey, overrideOptions) as PluginOrPresetItem\n );\n return reduction;\n }\n\n const index = reduction.indexOf(base);\n const baseKey = getItemKey(base) ?? overrideKey;\n const baseOptions = getItemOptions(base);\n const options = mergeUnknown(baseOptions, overrideOptions) as PlainObject;\n\n reduction.splice(\n index,\n 1,\n toItemWithOptions(baseKey, options) as PluginOrPresetItem\n );\n return reduction;\n }, []);\n};\n\nconst babelMerge = (source: TransformOptions, overrides: TransformOptions) => {\n const {\n plugins: sourcePlugins,\n presets: sourcePresets,\n env: sourceEnv,\n ...sourceRest\n } = source;\n const {\n plugins: overridesPlugins,\n presets: overridesPresets,\n env: overridesEnv,\n ...overridesRest\n } = overrides;\n\n const plugins = mergeConfigItems('plugin', sourcePlugins, overridesPlugins);\n const presets = mergeConfigItems('preset', sourcePresets, overridesPresets);\n\n const merged: TransformOptions = mergeUnknown(\n sourceRest,\n overridesRest\n ) as TransformOptions;\n if (presets.length) merged.presets = presets;\n if (plugins.length) merged.plugins = plugins;\n\n const envNames = new Set([\n ...Object.keys(sourceEnv ?? {}),\n ...Object.keys(overridesEnv ?? {}),\n ]);\n\n if (envNames.size) {\n merged.env = {};\n for (const name of envNames) {\n merged.env[name] = babelMerge(\n sourceEnv?.[name] ?? {},\n overridesEnv?.[name] ?? {}\n );\n }\n }\n\n return merged;\n};\n\nconst merge = (a: TransformOptions, b: TransformOptions) => {\n if (!cache.has(a)) {\n cache.set(a, new WeakMap());\n }\n\n const cacheForA = cache.get(a)!;\n if (cacheForA.has(b)) {\n return cacheForA.get(b)!;\n }\n\n const result = babelMerge(a, b);\n cacheForA.set(b, result);\n return result;\n};\n\n/**\n * Merges babel configs together. If a pair of configs were merged before,\n * it will return the cached result.\n */\nexport function buildOptions(\n ...configs: (TransformOptions | null | undefined)[]\n): TransformOptions {\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AK;EAC1D,IAAI,CAACjD,KAAK,CAACqD,GAAG,CAACL,CAAC,CAAC,EAAE;IACjBhD,KAAK,CAACsF,GAAG,CAACtC,CAAC,EAAE,IAAI/C,OAAO,CAAC,CAAC,CAAC;EAC7B;EAEA,MAAMsF,SAAS,GAAGvF,KAAK,CAACwF,GAAG,CAACxC,CAAC,CAAE;EAC/B,IAAIuC,SAAS,CAAClC,GAAG,CAACJ,CAAC,CAAC,EAAE;IACpB,OAAOsC,SAAS,CAACC,GAAG,CAACvC,CAAC,CAAC;EACzB;EAEA,MAAMnC,MAAM,GAAGuD,UAAU,CAACrB,CAAC,EAAEC,CAAC,CAAC;EAC/BsC,SAAS,CAACD,GAAG,CAACrC,CAAC,EAAEnC,MAAM,CAAC;EACxB,OAAOA,MAAM;AACf,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,SAAS2E,YAAYA,CAC1B,GAAGC,OAAgD,EACjC;EAClB;EACA,OAAOA,OAAO,CACXC,GAAG,CAAEC,CAAC,IAAKA,CAAC,IAAI,IAAI,CAAC,CACrBC,MAAM,CAAC9F,SAAS,CAAC,CACjByD,MAAM,CAAC6B,KAAK,CAAC;AAClB","ignoreList":[]}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
describe('buildOptions', () => {
|
|
2
|
-
it('does not crash when @babel/core resolvePreset returns an object (Babel 7.25.7 regression)', async () => {
|
|
3
|
-
const {
|
|
4
|
-
buildOptions
|
|
5
|
-
} = await import('./buildOptions');
|
|
6
|
-
expect(() => buildOptions({
|
|
7
|
-
presets: ['@babel/preset-typescript', '@babel/preset-react']
|
|
8
|
-
})).not.toThrow();
|
|
9
|
-
});
|
|
10
|
-
it('merges configs deeply and preserves presets/plugins arrays', async () => {
|
|
11
|
-
const {
|
|
12
|
-
buildOptions
|
|
13
|
-
} = await import('./buildOptions');
|
|
14
|
-
expect(buildOptions({
|
|
15
|
-
assumptions: {
|
|
16
|
-
setPublicClassFields: true
|
|
17
|
-
},
|
|
18
|
-
parserOpts: {
|
|
19
|
-
plugins: ['typescript']
|
|
20
|
-
},
|
|
21
|
-
presets: ['preset-a']
|
|
22
|
-
}, {
|
|
23
|
-
assumptions: {
|
|
24
|
-
setPublicClassFields: false
|
|
25
|
-
},
|
|
26
|
-
parserOpts: {
|
|
27
|
-
plugins: ['jsx']
|
|
28
|
-
},
|
|
29
|
-
presets: ['preset-b']
|
|
30
|
-
})).toEqual({
|
|
31
|
-
assumptions: {
|
|
32
|
-
setPublicClassFields: false
|
|
33
|
-
},
|
|
34
|
-
parserOpts: {
|
|
35
|
-
plugins: ['typescript', 'jsx']
|
|
36
|
-
},
|
|
37
|
-
presets: ['preset-a', 'preset-b']
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
it('does not treat pnpm store paths as a single ".pnpm" package', async () => {
|
|
41
|
-
const {
|
|
42
|
-
buildOptions
|
|
43
|
-
} = await import('./buildOptions');
|
|
44
|
-
const typescriptPath = '/project/node_modules/.pnpm/@babel+plugin-transform-typescript@7.25.9/node_modules/@babel/plugin-transform-typescript/lib/index.js';
|
|
45
|
-
const reactJsxPath = '/project/node_modules/.pnpm/@babel+plugin-transform-react-jsx@7.25.9/node_modules/@babel/plugin-transform-react-jsx/lib/index.js';
|
|
46
|
-
const merged = buildOptions({
|
|
47
|
-
plugins: [[typescriptPath, {
|
|
48
|
-
foo: true
|
|
49
|
-
}]]
|
|
50
|
-
}, {
|
|
51
|
-
plugins: [[reactJsxPath, {
|
|
52
|
-
bar: true
|
|
53
|
-
}]]
|
|
54
|
-
});
|
|
55
|
-
expect(merged.plugins).toEqual([[typescriptPath, {
|
|
56
|
-
foo: true
|
|
57
|
-
}], [reactJsxPath, {
|
|
58
|
-
bar: true
|
|
59
|
-
}]]);
|
|
60
|
-
});
|
|
61
|
-
it('still recognizes pnpm store paths as Babel plugin keys (Windows path)', async () => {
|
|
62
|
-
const {
|
|
63
|
-
buildOptions
|
|
64
|
-
} = await import('./buildOptions');
|
|
65
|
-
const typescriptWindowsPath = 'C:\\project\\node_modules\\.pnpm\\@babel+plugin-transform-typescript@7.25.9\\node_modules\\@babel\\plugin-transform-typescript\\lib\\index.js';
|
|
66
|
-
const merged = buildOptions({
|
|
67
|
-
plugins: [['@babel/plugin-transform-typescript', {
|
|
68
|
-
foo: true
|
|
69
|
-
}]]
|
|
70
|
-
}, {
|
|
71
|
-
plugins: [[typescriptWindowsPath, {
|
|
72
|
-
bar: true
|
|
73
|
-
}]]
|
|
74
|
-
});
|
|
75
|
-
expect(merged.plugins).toEqual([['@babel/plugin-transform-typescript', {
|
|
76
|
-
foo: true,
|
|
77
|
-
bar: true
|
|
78
|
-
}]]);
|
|
79
|
-
});
|
|
80
|
-
it('extracts real package names from pnpm store paths', async () => {
|
|
81
|
-
const {
|
|
82
|
-
buildOptions
|
|
83
|
-
} = await import('./buildOptions');
|
|
84
|
-
const typescriptPath = '/project/node_modules/.pnpm/@babel+plugin-transform-typescript@7.25.9/node_modules/@babel/plugin-transform-typescript/lib/index.js';
|
|
85
|
-
const merged = buildOptions({
|
|
86
|
-
plugins: [['@babel/plugin-transform-typescript', {
|
|
87
|
-
foo: true
|
|
88
|
-
}]]
|
|
89
|
-
}, {
|
|
90
|
-
plugins: [[typescriptPath, {
|
|
91
|
-
bar: true
|
|
92
|
-
}]]
|
|
93
|
-
});
|
|
94
|
-
expect(merged.plugins).toEqual([['@babel/plugin-transform-typescript', {
|
|
95
|
-
foo: true,
|
|
96
|
-
bar: true
|
|
97
|
-
}]]);
|
|
98
|
-
});
|
|
99
|
-
it('extracts package names from node_modules paths', async () => {
|
|
100
|
-
const {
|
|
101
|
-
buildOptions
|
|
102
|
-
} = await import('./buildOptions');
|
|
103
|
-
const pluginPath = '/project/node_modules/my-plugin/lib/index.js';
|
|
104
|
-
const merged = buildOptions({
|
|
105
|
-
plugins: [['my-plugin', {
|
|
106
|
-
foo: true
|
|
107
|
-
}]]
|
|
108
|
-
}, {
|
|
109
|
-
plugins: [[pluginPath, {
|
|
110
|
-
bar: true
|
|
111
|
-
}]]
|
|
112
|
-
});
|
|
113
|
-
expect(merged.plugins).toEqual([['my-plugin', {
|
|
114
|
-
foo: true,
|
|
115
|
-
bar: true
|
|
116
|
-
}]]);
|
|
117
|
-
});
|
|
118
|
-
it('extracts the innermost package name from nested node_modules paths', async () => {
|
|
119
|
-
const {
|
|
120
|
-
buildOptions
|
|
121
|
-
} = await import('./buildOptions');
|
|
122
|
-
const pluginPath = '/project/node_modules/wrapper/node_modules/inner-plugin/lib/index.js';
|
|
123
|
-
const merged = buildOptions({
|
|
124
|
-
plugins: [['inner-plugin', {
|
|
125
|
-
foo: true
|
|
126
|
-
}]]
|
|
127
|
-
}, {
|
|
128
|
-
plugins: [[pluginPath, {
|
|
129
|
-
bar: true
|
|
130
|
-
}]]
|
|
131
|
-
});
|
|
132
|
-
expect(merged.plugins).toEqual([['inner-plugin', {
|
|
133
|
-
foo: true,
|
|
134
|
-
bar: true
|
|
135
|
-
}]]);
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
//# sourceMappingURL=buildOptions.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildOptions.test.js","names":["describe","it","buildOptions","expect","presets","not","toThrow","assumptions","setPublicClassFields","parserOpts","plugins","toEqual","typescriptPath","reactJsxPath","merged","foo","bar","typescriptWindowsPath","pluginPath"],"sources":["../../src/options/buildOptions.test.ts"],"sourcesContent":["describe('buildOptions', () => {\n it('does not crash when @babel/core resolvePreset returns an object (Babel 7.25.7 regression)', async () => {\n const { buildOptions } = await import('./buildOptions');\n\n expect(() =>\n buildOptions({\n presets: ['@babel/preset-typescript', '@babel/preset-react'],\n })\n ).not.toThrow();\n });\n\n it('merges configs deeply and preserves presets/plugins arrays', async () => {\n const { buildOptions } = await import('./buildOptions');\n\n expect(\n buildOptions(\n {\n assumptions: { setPublicClassFields: true },\n parserOpts: { plugins: ['typescript'] },\n presets: ['preset-a'],\n },\n {\n assumptions: { setPublicClassFields: false },\n parserOpts: { plugins: ['jsx'] },\n presets: ['preset-b'],\n }\n )\n ).toEqual({\n assumptions: { setPublicClassFields: false },\n parserOpts: { plugins: ['typescript', 'jsx'] },\n presets: ['preset-a', 'preset-b'],\n });\n });\n\n it('does not treat pnpm store paths as a single \".pnpm\" package', async () => {\n const { buildOptions } = await import('./buildOptions');\n\n const typescriptPath =\n '/project/node_modules/.pnpm/@babel+plugin-transform-typescript@7.25.9/node_modules/@babel/plugin-transform-typescript/lib/index.js';\n const reactJsxPath =\n '/project/node_modules/.pnpm/@babel+plugin-transform-react-jsx@7.25.9/node_modules/@babel/plugin-transform-react-jsx/lib/index.js';\n\n const merged = buildOptions(\n {\n plugins: [[typescriptPath, { foo: true }]],\n },\n {\n plugins: [[reactJsxPath, { bar: true }]],\n }\n );\n\n expect(merged.plugins).toEqual([\n [typescriptPath, { foo: true }],\n [reactJsxPath, { bar: true }],\n ]);\n });\n\n it('still recognizes pnpm store paths as Babel plugin keys (Windows path)', async () => {\n const { buildOptions } = await import('./buildOptions');\n\n const typescriptWindowsPath =\n 'C:\\\\project\\\\node_modules\\\\.pnpm\\\\@babel+plugin-transform-typescript@7.25.9\\\\node_modules\\\\@babel\\\\plugin-transform-typescript\\\\lib\\\\index.js';\n\n const merged = buildOptions(\n {\n plugins: [['@babel/plugin-transform-typescript', { foo: true }]],\n },\n {\n plugins: [[typescriptWindowsPath, { bar: true }]],\n }\n );\n\n expect(merged.plugins).toEqual([\n ['@babel/plugin-transform-typescript', { foo: true, bar: true }],\n ]);\n });\n\n it('extracts real package names from pnpm store paths', async () => {\n const { buildOptions } = await import('./buildOptions');\n\n const typescriptPath =\n '/project/node_modules/.pnpm/@babel+plugin-transform-typescript@7.25.9/node_modules/@babel/plugin-transform-typescript/lib/index.js';\n\n const merged = buildOptions(\n {\n plugins: [['@babel/plugin-transform-typescript', { foo: true }]],\n },\n {\n plugins: [[typescriptPath, { bar: true }]],\n }\n );\n\n expect(merged.plugins).toEqual([\n ['@babel/plugin-transform-typescript', { foo: true, bar: true }],\n ]);\n });\n\n it('extracts package names from node_modules paths', async () => {\n const { buildOptions } = await import('./buildOptions');\n\n const pluginPath = '/project/node_modules/my-plugin/lib/index.js';\n\n const merged = buildOptions(\n {\n plugins: [['my-plugin', { foo: true }]],\n },\n {\n plugins: [[pluginPath, { bar: true }]],\n }\n );\n\n expect(merged.plugins).toEqual([['my-plugin', { foo: true, bar: true }]]);\n });\n\n it('extracts the innermost package name from nested node_modules paths', async () => {\n const { buildOptions } = await import('./buildOptions');\n\n const pluginPath =\n '/project/node_modules/wrapper/node_modules/inner-plugin/lib/index.js';\n\n const merged = buildOptions(\n {\n plugins: [['inner-plugin', { foo: true }]],\n },\n {\n plugins: [[pluginPath, { bar: true }]],\n }\n );\n\n expect(merged.plugins).toEqual([\n ['inner-plugin', { foo: true, bar: true }],\n ]);\n });\n});\n"],"mappings":"AAAAA,QAAQ,CAAC,cAAc,EAAE,MAAM;EAC7BC,EAAE,CAAC,2FAA2F,EAAE,YAAY;IAC1G,MAAM;MAAEC;IAAa,CAAC,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC;IAEvDC,MAAM,CAAC,MACLD,YAAY,CAAC;MACXE,OAAO,EAAE,CAAC,0BAA0B,EAAE,qBAAqB;IAC7D,CAAC,CACH,CAAC,CAACC,GAAG,CAACC,OAAO,CAAC,CAAC;EACjB,CAAC,CAAC;EAEFL,EAAE,CAAC,4DAA4D,EAAE,YAAY;IAC3E,MAAM;MAAEC;IAAa,CAAC,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC;IAEvDC,MAAM,CACJD,YAAY,CACV;MACEK,WAAW,EAAE;QAAEC,oBAAoB,EAAE;MAAK,CAAC;MAC3CC,UAAU,EAAE;QAAEC,OAAO,EAAE,CAAC,YAAY;MAAE,CAAC;MACvCN,OAAO,EAAE,CAAC,UAAU;IACtB,CAAC,EACD;MACEG,WAAW,EAAE;QAAEC,oBAAoB,EAAE;MAAM,CAAC;MAC5CC,UAAU,EAAE;QAA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,CAAC;IAEDb,MAAM,CAACW,MAAM,CAACJ,OAAO,CAAC,CAACC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE;MAAEI,GAAG,EAAE,IAAI;MAAEC,GAAG,EAAE;IAAK,CAAC,CAAC,CAAC,CAAC;EAC3E,CAAC,CAAC;EAEFf,EAAE,CAAC,oEAAoE,EAAE,YAAY;IACnF,MAAM;MAAEC;IAAa,CAAC,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC;IAEvD,MAAMgB,UAAU,GACd,sEAAsE;IAExE,MAAMJ,MAAM,GAAGZ,YAAY,CACzB;MACEQ,OAAO,EAAE,CAAC,CAAC,cAAc,EAAE;QAAEK,GAAG,EAAE;MAAK,CAAC,CAAC;IAC3C,CAAC,EACD;MACEL,OAAO,EAAE,CAAC,CAACQ,UAAU,EAAE;QAAEF,GAAG,EAAE;MAAK,CAAC,CAAC;IACvC,CACF,CAAC;IAEDb,MAAM,CAACW,MAAM,CAACJ,OAAO,CAAC,CAACC,OAAO,CAAC,CAC7B,CAAC,cAAc,EAAE;MAAEI,GAAG,EAAE,IAAI;MAAEC,GAAG,EAAE;IAAK,CAAC,CAAC,CAC3C,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const cache = new WeakMap();
|
|
2
|
-
const empty = {};
|
|
3
|
-
export function loadBabelOptions(babel, filename, overrides = empty) {
|
|
4
|
-
const fileCache = cache.get(overrides) ?? new Map();
|
|
5
|
-
if (fileCache.has(filename)) {
|
|
6
|
-
return fileCache.get(filename);
|
|
7
|
-
}
|
|
8
|
-
const babelOptions = babel.loadOptions({
|
|
9
|
-
...overrides,
|
|
10
|
-
filename,
|
|
11
|
-
caller: {
|
|
12
|
-
name: 'wyw-in-js',
|
|
13
|
-
// Indicates for @babel/preset-env to support all ESM syntax and avoid transforms before it's needed
|
|
14
|
-
supportsStaticESM: true,
|
|
15
|
-
supportsDynamicImport: true,
|
|
16
|
-
supportsTopLevelAwait: true,
|
|
17
|
-
supportsExportNamespaceFrom: true
|
|
18
|
-
}
|
|
19
|
-
}) ?? {};
|
|
20
|
-
fileCache.set(filename, babelOptions);
|
|
21
|
-
cache.set(overrides, fileCache);
|
|
22
|
-
return babelOptions;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=loadBabelOptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadBabelOptions.js","names":["cache","WeakMap","empty","loadBabelOptions","babel","filename","overrides","fileCache","get","Map","has","babelOptions","loadOptions","caller","name","supportsStaticESM","supportsDynamicImport","supportsTopLevelAwait","supportsExportNamespaceFrom","set"],"sources":["../../src/options/loadBabelOptions.ts"],"sourcesContent":["import type { TransformOptions } from '@babel/core';\n\nimport type { Core } from '../babel';\n\nconst cache = new WeakMap<\n Partial<TransformOptions>,\n Map<string, TransformOptions>\n>();\n\nconst empty = {};\n\nexport function loadBabelOptions(\n babel: Core,\n filename: string,\n overrides: TransformOptions = empty\n) {\n const fileCache = cache.get(overrides) ?? new Map<string, TransformOptions>();\n if (fileCache.has(filename)) {\n return fileCache.get(filename)!;\n }\n\n const babelOptions: TransformOptions =\n babel.loadOptions({\n ...overrides,\n filename,\n caller: {\n name: 'wyw-in-js',\n\n // Indicates for @babel/preset-env to support all ESM syntax and avoid transforms before it's needed\n supportsStaticESM: true,\n supportsDynamicImport: true,\n supportsTopLevelAwait: true,\n supportsExportNamespaceFrom: true,\n },\n }) ?? {};\n\n fileCache.set(filename, babelOptions);\n cache.set(overrides, fileCache);\n\n return babelOptions;\n}\n"],"mappings":"AAIA,MAAMA,KAAK,GAAG,IAAIC,OAAO,CAGvB,CAAC;AAEH,MAAMC,KAAK,GAAG,CAAC,CAAC;AAEhB,OAAO,SAASC,gBAAgBA,CAC9BC,KAAW,EACXC,QAAgB,EAChBC,SAA2B,GAAGJ,KAAK,EACnC;EACA,MAAMK,SAAS,GAAGP,KAAK,CAACQ,GAAG,CAACF,SAAS,CAAC,IAAI,IAAIG,GAAG,CAA2B,CAAC;EAC7E,IAAIF,SAAS,CAACG,GAAG,CAACL,QAAQ,CAAC,EAAE;IAC3B,OAAOE,SAAS,CAACC,GAAG,CAACH,QAAQ,CAAC;EAChC;EAEA,MAAMM,YAA8B,GAClCP,KAAK,CAACQ,WAAW,CAAC;IAChB,GAAGN,SAAS;IACZD,QAAQ;IACRQ,MAAM,EAAE;MACNC,IAAI,EAAE,WAAW;MAEjB;MACAC,iBAAiB,EAAE,IAAI;MACvBC,qBAAqB,EAAE,IAAI;MAC3BC,qBAAqB,EAAE,IAAI;MAC3BC,2BAA2B,EAAE;IAC/B;EACF,CAAC,CAAC,IAAI,CAAC,CAAC;EAEVX,SAAS,CAACY,GAAG,CAACd,QAAQ,EAAEM,YAAY,CAAC;EACrCX,KAAK,CAACmB,GAAG,CAACb,SAAS,EAAEC,SAAS,CAAC;EAE/B,OAAOI,YAAY;AACrB","ignoreList":[]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { logger, syncResolve } from '@wyw-in-js/shared';
|
|
2
|
-
import { loadWywOptions } from '../transform/helpers/loadWywOptions';
|
|
3
|
-
import { TransformCacheCollection } from '../cache';
|
|
4
|
-
import { transformSync } from '../transform';
|
|
5
|
-
import { collector } from './collector';
|
|
6
|
-
export default function babelTransform(babel, options) {
|
|
7
|
-
const cache = new TransformCacheCollection();
|
|
8
|
-
const debug = logger.extend('babel-transform');
|
|
9
|
-
return {
|
|
10
|
-
name: '@wyw-in-js/transform/babel-transform',
|
|
11
|
-
pre(file) {
|
|
12
|
-
// eslint-disable-next-line require-yield
|
|
13
|
-
function* collect() {
|
|
14
|
-
const {
|
|
15
|
-
valueCache
|
|
16
|
-
} = this.data;
|
|
17
|
-
const {
|
|
18
|
-
loadedAndParsed
|
|
19
|
-
} = this.entrypoint;
|
|
20
|
-
const {
|
|
21
|
-
pluginOptions
|
|
22
|
-
} = this.services.options;
|
|
23
|
-
if (loadedAndParsed.evaluator === 'ignored') {
|
|
24
|
-
throw new Error('entrypoint was ignored');
|
|
25
|
-
}
|
|
26
|
-
collector(file, pluginOptions, valueCache);
|
|
27
|
-
return {
|
|
28
|
-
ast: loadedAndParsed.ast,
|
|
29
|
-
code: loadedAndParsed.code
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
debug('start %s', file.opts.filename);
|
|
33
|
-
const pluginOptions = loadWywOptions(options);
|
|
34
|
-
transformSync({
|
|
35
|
-
babel,
|
|
36
|
-
cache,
|
|
37
|
-
options: {
|
|
38
|
-
filename: file.opts.filename,
|
|
39
|
-
root: file.opts.root ?? undefined,
|
|
40
|
-
inputSourceMap: file.opts.inputSourceMap ?? undefined,
|
|
41
|
-
pluginOptions
|
|
42
|
-
}
|
|
43
|
-
}, file.code, syncResolve, {
|
|
44
|
-
collect
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
visitor: {},
|
|
48
|
-
post(file) {
|
|
49
|
-
debug('end %s', file.opts.filename);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=babel-transform.js.map
|