@fgv/ts-res 5.0.0-9 → 5.0.1-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/CHANGELOG.json +21 -0
- package/CHANGELOG.md +14 -1
- package/README.md +794 -137
- package/dist/ts-res.d.ts +2257 -268
- package/dist/tsdoc-metadata.json +1 -1
- package/eslint.config.js +16 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -1
- package/lib/packlets/bundle/bundleBuilder.js +7 -4
- package/lib/packlets/bundle/bundleLoader.js +1 -0
- package/lib/packlets/bundle/bundleUtils.js +14 -16
- package/lib/packlets/bundle/index.d.ts +3 -1
- package/lib/packlets/bundle/index.js +14 -3
- package/lib/packlets/common/convert.d.ts +15 -0
- package/lib/packlets/common/convert.js +16 -1
- package/lib/packlets/common/helpers/context.js +1 -0
- package/lib/packlets/common/helpers/resources.d.ts +7 -0
- package/lib/packlets/common/helpers/resources.js +13 -0
- package/lib/packlets/common/resources.d.ts +44 -1
- package/lib/packlets/common/validate/conditions.d.ts +17 -1
- package/lib/packlets/common/validate/conditions.js +32 -6
- package/lib/packlets/common/validate/regularExpressions.d.ts +4 -0
- package/lib/packlets/common/validate/regularExpressions.js +5 -1
- package/lib/packlets/common/validate/resources.d.ts +35 -1
- package/lib/packlets/common/validate/resources.js +55 -0
- package/lib/packlets/conditions/condition.js +1 -0
- package/lib/packlets/conditions/conditionSet.d.ts +9 -0
- package/lib/packlets/conditions/conditionSet.js +75 -1
- package/lib/packlets/config/configInitFactory.d.ts +217 -0
- package/lib/packlets/config/configInitFactory.js +302 -0
- package/lib/packlets/config/convert.d.ts +9 -0
- package/lib/packlets/config/convert.js +12 -1
- package/lib/packlets/config/index.d.ts +1 -0
- package/lib/packlets/config/index.js +1 -0
- package/lib/packlets/config/json.d.ts +1 -1
- package/lib/packlets/config/systemConfiguration.d.ts +16 -3
- package/lib/packlets/config/systemConfiguration.js +19 -40
- package/lib/packlets/import/fsItem.d.ts +2 -1
- package/lib/packlets/import/fsItem.js +9 -13
- package/lib/packlets/import/importManager.d.ts +2 -1
- package/lib/packlets/import/importers/jsonImporter.js +1 -0
- package/lib/packlets/import/importers/pathImporter.d.ts +2 -1
- package/lib/packlets/import/importers/pathImporter.js +2 -1
- package/lib/packlets/qualifier-types/config/convert.d.ts +22 -1
- package/lib/packlets/qualifier-types/config/convert.js +67 -2
- package/lib/packlets/qualifier-types/config/json.d.ts +24 -2
- package/lib/packlets/qualifier-types/config/json.js +11 -0
- package/lib/packlets/qualifier-types/convert.d.ts +1 -1
- package/lib/packlets/qualifier-types/helpers.d.ts +14 -5
- package/lib/packlets/qualifier-types/helpers.js +2 -2
- package/lib/packlets/qualifier-types/languageQualifierType.d.ts +28 -2
- package/lib/packlets/qualifier-types/languageQualifierType.js +73 -0
- package/lib/packlets/qualifier-types/literalQualifierType.d.ts +31 -5
- package/lib/packlets/qualifier-types/literalQualifierType.js +75 -0
- package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts +7 -11
- package/lib/packlets/qualifier-types/literalValueHierarchy.js +12 -1
- package/lib/packlets/qualifier-types/qualifierType.d.ts +31 -2
- package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +31 -5
- package/lib/packlets/qualifier-types/territoryQualifierType.js +80 -0
- package/lib/packlets/qualifiers/qualifierCollector.js +1 -2
- package/lib/packlets/resource-json/compiled/convert.js +2 -1
- package/lib/packlets/resource-json/compiled/json.d.ts +6 -2
- package/lib/packlets/resource-types/config/convert.d.ts +1 -1
- package/lib/packlets/resource-types/config/convert.js +3 -1
- package/lib/packlets/resource-types/config/json.d.ts +3 -1
- package/lib/packlets/resource-types/jsonResourceType.d.ts +10 -1
- package/lib/packlets/resource-types/jsonResourceType.js +7 -3
- package/lib/packlets/resource-types/resourceType.d.ts +100 -8
- package/lib/packlets/resource-types/resourceType.js +39 -3
- package/lib/packlets/resources/candidateReducer.js +3 -0
- package/lib/packlets/resources/candidateValue.d.ts +92 -0
- package/lib/packlets/resources/candidateValue.js +128 -0
- package/lib/packlets/resources/candidateValueCollector.d.ts +55 -0
- package/lib/packlets/resources/candidateValueCollector.js +96 -0
- package/lib/packlets/resources/common.d.ts +14 -0
- package/lib/packlets/resources/deltaGenerator.d.ts +189 -0
- package/lib/packlets/resources/deltaGenerator.js +344 -0
- package/lib/packlets/resources/index.d.ts +3 -0
- package/lib/packlets/resources/index.js +3 -0
- package/lib/packlets/resources/resource.d.ts +6 -6
- package/lib/packlets/resources/resource.js +5 -10
- package/lib/packlets/resources/resourceBuilder.d.ts +6 -0
- package/lib/packlets/resources/resourceBuilder.js +4 -1
- package/lib/packlets/resources/resourceCandidate.d.ts +15 -2
- package/lib/packlets/resources/resourceCandidate.js +17 -5
- package/lib/packlets/resources/resourceManagerBuilder.d.ts +131 -10
- package/lib/packlets/resources/resourceManagerBuilder.js +289 -45
- package/lib/packlets/runtime/compiledResourceCollection.d.ts +27 -11
- package/lib/packlets/runtime/compiledResourceCollection.js +71 -28
- package/lib/packlets/runtime/conditionSetResolutionResult.js +3 -0
- package/lib/packlets/runtime/context/contextQualifierProvider.d.ts +53 -3
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts +82 -37
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.js +49 -77
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts +23 -2
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.js +53 -31
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts +4 -4
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +2 -2
- package/lib/packlets/runtime/iResourceManager.d.ts +17 -5
- package/lib/packlets/runtime/index.d.ts +1 -0
- package/lib/packlets/runtime/index.js +1 -0
- package/lib/packlets/runtime/resource-tree/common.d.ts +1 -1
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts +7 -7
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js +5 -5
- package/lib/packlets/runtime/resourceResolver.d.ts +43 -1
- package/lib/packlets/runtime/resourceResolver.js +56 -28
- package/lib/packlets/runtime/resourceTreeResolver.d.ts +152 -0
- package/lib/packlets/runtime/resourceTreeResolver.js +222 -0
- package/lib/packlets/runtime/validate.js +1 -0
- package/lib/packlets/zip-archive/convert.d.ts +52 -0
- package/lib/packlets/zip-archive/convert.js +103 -0
- package/lib/packlets/zip-archive/index.d.ts +23 -0
- package/lib/packlets/zip-archive/index.js +95 -0
- package/lib/packlets/zip-archive/json.d.ts +64 -0
- package/lib/packlets/zip-archive/json.js +24 -0
- package/lib/packlets/zip-archive/types.d.ts +98 -0
- package/lib/packlets/zip-archive/types.js +39 -0
- package/lib/packlets/zip-archive/zipArchiveCreator.d.ts +35 -0
- package/lib/packlets/zip-archive/zipArchiveCreator.js +195 -0
- package/lib/packlets/zip-archive/zipArchiveFormat.d.ts +70 -0
- package/lib/packlets/zip-archive/zipArchiveFormat.js +184 -0
- package/lib/packlets/zip-archive/zipArchiveLoader.d.ts +70 -0
- package/lib/packlets/zip-archive/zipArchiveLoader.js +286 -0
- package/package.json +26 -32
- package/CLAUDE.md +0 -186
- package/EXAMPLE_INIT_PARAMS.md +0 -88
- package/PROGRESS_SUMMARY.md +0 -48
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/packlets/bundle/bundleBuilder.d.ts.map +0 -1
- package/lib/packlets/bundle/bundleBuilder.js.map +0 -1
- package/lib/packlets/bundle/bundleLoader.d.ts.map +0 -1
- package/lib/packlets/bundle/bundleLoader.js.map +0 -1
- package/lib/packlets/bundle/bundleNormalizer.d.ts.map +0 -1
- package/lib/packlets/bundle/bundleNormalizer.js.map +0 -1
- package/lib/packlets/bundle/bundleUtils.d.ts.map +0 -1
- package/lib/packlets/bundle/bundleUtils.js.map +0 -1
- package/lib/packlets/bundle/convert.d.ts.map +0 -1
- package/lib/packlets/bundle/convert.js.map +0 -1
- package/lib/packlets/bundle/index.d.ts.map +0 -1
- package/lib/packlets/bundle/index.js.map +0 -1
- package/lib/packlets/bundle/model.d.ts.map +0 -1
- package/lib/packlets/bundle/model.js.map +0 -1
- package/lib/packlets/common/conditions.d.ts.map +0 -1
- package/lib/packlets/common/conditions.js.map +0 -1
- package/lib/packlets/common/convert.d.ts.map +0 -1
- package/lib/packlets/common/convert.js.map +0 -1
- package/lib/packlets/common/helpers/conditions.d.ts.map +0 -1
- package/lib/packlets/common/helpers/conditions.js.map +0 -1
- package/lib/packlets/common/helpers/context.d.ts.map +0 -1
- package/lib/packlets/common/helpers/context.js.map +0 -1
- package/lib/packlets/common/helpers/index.d.ts.map +0 -1
- package/lib/packlets/common/helpers/index.js.map +0 -1
- package/lib/packlets/common/helpers/qualifierDefaultValues.d.ts.map +0 -1
- package/lib/packlets/common/helpers/qualifierDefaultValues.js.map +0 -1
- package/lib/packlets/common/helpers/resources.d.ts.map +0 -1
- package/lib/packlets/common/helpers/resources.js.map +0 -1
- package/lib/packlets/common/index.d.ts.map +0 -1
- package/lib/packlets/common/index.js.map +0 -1
- package/lib/packlets/common/resources.d.ts.map +0 -1
- package/lib/packlets/common/resources.js.map +0 -1
- package/lib/packlets/common/validate/conditions.d.ts.map +0 -1
- package/lib/packlets/common/validate/conditions.js.map +0 -1
- package/lib/packlets/common/validate/index.d.ts.map +0 -1
- package/lib/packlets/common/validate/index.js.map +0 -1
- package/lib/packlets/common/validate/regularExpressions.d.ts.map +0 -1
- package/lib/packlets/common/validate/regularExpressions.js.map +0 -1
- package/lib/packlets/common/validate/resources.d.ts.map +0 -1
- package/lib/packlets/common/validate/resources.js.map +0 -1
- package/lib/packlets/conditions/condition.d.ts.map +0 -1
- package/lib/packlets/conditions/condition.js.map +0 -1
- package/lib/packlets/conditions/conditionCollector.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionCollector.js.map +0 -1
- package/lib/packlets/conditions/conditionDecls.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionDecls.js.map +0 -1
- package/lib/packlets/conditions/conditionSet.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionSet.js.map +0 -1
- package/lib/packlets/conditions/conditionSetCollector.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionSetCollector.js.map +0 -1
- package/lib/packlets/conditions/conditionSetDecls.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionSetDecls.js.map +0 -1
- package/lib/packlets/conditions/conditionToken.d.ts.map +0 -1
- package/lib/packlets/conditions/conditionToken.js.map +0 -1
- package/lib/packlets/conditions/convert/conditionSetDecls.d.ts.map +0 -1
- package/lib/packlets/conditions/convert/conditionSetDecls.js.map +0 -1
- package/lib/packlets/conditions/convert/decls.d.ts.map +0 -1
- package/lib/packlets/conditions/convert/decls.js.map +0 -1
- package/lib/packlets/conditions/convert/index.d.ts.map +0 -1
- package/lib/packlets/conditions/convert/index.js.map +0 -1
- package/lib/packlets/conditions/index.d.ts.map +0 -1
- package/lib/packlets/conditions/index.js.map +0 -1
- package/lib/packlets/config/common.d.ts.map +0 -1
- package/lib/packlets/config/common.js.map +0 -1
- package/lib/packlets/config/convert.d.ts.map +0 -1
- package/lib/packlets/config/convert.js.map +0 -1
- package/lib/packlets/config/index.d.ts.map +0 -1
- package/lib/packlets/config/index.js.map +0 -1
- package/lib/packlets/config/json.d.ts.map +0 -1
- package/lib/packlets/config/json.js.map +0 -1
- package/lib/packlets/config/predefined/default.d.ts.map +0 -1
- package/lib/packlets/config/predefined/default.js.map +0 -1
- package/lib/packlets/config/predefined/extended.d.ts.map +0 -1
- package/lib/packlets/config/predefined/extended.js.map +0 -1
- package/lib/packlets/config/predefined/index.d.ts.map +0 -1
- package/lib/packlets/config/predefined/index.js.map +0 -1
- package/lib/packlets/config/systemConfiguration.d.ts.map +0 -1
- package/lib/packlets/config/systemConfiguration.js.map +0 -1
- package/lib/packlets/context/contextDecls.d.ts.map +0 -1
- package/lib/packlets/context/contextDecls.js.map +0 -1
- package/lib/packlets/context/contextToken.d.ts.map +0 -1
- package/lib/packlets/context/contextToken.js.map +0 -1
- package/lib/packlets/context/convert/decls.d.ts.map +0 -1
- package/lib/packlets/context/convert/decls.js.map +0 -1
- package/lib/packlets/context/convert/index.d.ts.map +0 -1
- package/lib/packlets/context/convert/index.js.map +0 -1
- package/lib/packlets/context/index.d.ts.map +0 -1
- package/lib/packlets/context/index.js.map +0 -1
- package/lib/packlets/decisions/abstractDecision.d.ts.map +0 -1
- package/lib/packlets/decisions/abstractDecision.js.map +0 -1
- package/lib/packlets/decisions/abstractDecisionCollector.d.ts.map +0 -1
- package/lib/packlets/decisions/abstractDecisionCollector.js.map +0 -1
- package/lib/packlets/decisions/candidate.d.ts.map +0 -1
- package/lib/packlets/decisions/candidate.js.map +0 -1
- package/lib/packlets/decisions/common.d.ts.map +0 -1
- package/lib/packlets/decisions/common.js.map +0 -1
- package/lib/packlets/decisions/concreteDecision.d.ts.map +0 -1
- package/lib/packlets/decisions/concreteDecision.js.map +0 -1
- package/lib/packlets/decisions/decision.d.ts.map +0 -1
- package/lib/packlets/decisions/decision.js.map +0 -1
- package/lib/packlets/decisions/index.d.ts.map +0 -1
- package/lib/packlets/decisions/index.js.map +0 -1
- package/lib/packlets/import/fsItem.d.ts.map +0 -1
- package/lib/packlets/import/fsItem.js.map +0 -1
- package/lib/packlets/import/importContext.d.ts.map +0 -1
- package/lib/packlets/import/importContext.js.map +0 -1
- package/lib/packlets/import/importManager.d.ts.map +0 -1
- package/lib/packlets/import/importManager.js.map +0 -1
- package/lib/packlets/import/importable.d.ts.map +0 -1
- package/lib/packlets/import/importable.js.map +0 -1
- package/lib/packlets/import/importers/collectionImporter.d.ts.map +0 -1
- package/lib/packlets/import/importers/collectionImporter.js.map +0 -1
- package/lib/packlets/import/importers/fsItemImporter.d.ts.map +0 -1
- package/lib/packlets/import/importers/fsItemImporter.js.map +0 -1
- package/lib/packlets/import/importers/importer.d.ts.map +0 -1
- package/lib/packlets/import/importers/importer.js.map +0 -1
- package/lib/packlets/import/importers/index.d.ts.map +0 -1
- package/lib/packlets/import/importers/index.js.map +0 -1
- package/lib/packlets/import/importers/jsonImporter.d.ts.map +0 -1
- package/lib/packlets/import/importers/jsonImporter.js.map +0 -1
- package/lib/packlets/import/importers/pathImporter.d.ts.map +0 -1
- package/lib/packlets/import/importers/pathImporter.js.map +0 -1
- package/lib/packlets/import/index.d.ts.map +0 -1
- package/lib/packlets/import/index.js.map +0 -1
- package/lib/packlets/qualifier-types/config/convert.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/config/convert.js.map +0 -1
- package/lib/packlets/qualifier-types/config/index.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/config/index.js.map +0 -1
- package/lib/packlets/qualifier-types/config/json.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/config/json.js.map +0 -1
- package/lib/packlets/qualifier-types/convert.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/convert.js.map +0 -1
- package/lib/packlets/qualifier-types/helpers.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/helpers.js.map +0 -1
- package/lib/packlets/qualifier-types/index.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/index.js.map +0 -1
- package/lib/packlets/qualifier-types/languageQualifierType.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/languageQualifierType.js.map +0 -1
- package/lib/packlets/qualifier-types/literalQualifierType.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/literalQualifierType.js.map +0 -1
- package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/literalValueHierarchy.js.map +0 -1
- package/lib/packlets/qualifier-types/qualifierType.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/qualifierType.js.map +0 -1
- package/lib/packlets/qualifier-types/qualifierTypeCollector.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/qualifierTypeCollector.js.map +0 -1
- package/lib/packlets/qualifier-types/territoryQualifierType.d.ts.map +0 -1
- package/lib/packlets/qualifier-types/territoryQualifierType.js.map +0 -1
- package/lib/packlets/qualifiers/convert/decls.d.ts.map +0 -1
- package/lib/packlets/qualifiers/convert/decls.js.map +0 -1
- package/lib/packlets/qualifiers/convert/index.d.ts.map +0 -1
- package/lib/packlets/qualifiers/convert/index.js.map +0 -1
- package/lib/packlets/qualifiers/convert/qualifier.d.ts.map +0 -1
- package/lib/packlets/qualifiers/convert/qualifier.js.map +0 -1
- package/lib/packlets/qualifiers/index.d.ts.map +0 -1
- package/lib/packlets/qualifiers/index.js.map +0 -1
- package/lib/packlets/qualifiers/qualifier.d.ts.map +0 -1
- package/lib/packlets/qualifiers/qualifier.js.map +0 -1
- package/lib/packlets/qualifiers/qualifierCollector.d.ts.map +0 -1
- package/lib/packlets/qualifiers/qualifierCollector.js.map +0 -1
- package/lib/packlets/qualifiers/qualifierDecl.d.ts.map +0 -1
- package/lib/packlets/qualifiers/qualifierDecl.js.map +0 -1
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.d.ts.map +0 -1
- package/lib/packlets/qualifiers/qualifierDefaultValueDecls.js.map +0 -1
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.d.ts.map +0 -1
- package/lib/packlets/qualifiers/qualifierDefaultValueToken.js.map +0 -1
- package/lib/packlets/resource-json/compiled/common.d.ts.map +0 -1
- package/lib/packlets/resource-json/compiled/common.js.map +0 -1
- package/lib/packlets/resource-json/compiled/convert.d.ts.map +0 -1
- package/lib/packlets/resource-json/compiled/convert.js.map +0 -1
- package/lib/packlets/resource-json/compiled/index.d.ts.map +0 -1
- package/lib/packlets/resource-json/compiled/index.js.map +0 -1
- package/lib/packlets/resource-json/compiled/json.d.ts.map +0 -1
- package/lib/packlets/resource-json/compiled/json.js.map +0 -1
- package/lib/packlets/resource-json/convert.d.ts.map +0 -1
- package/lib/packlets/resource-json/convert.js.map +0 -1
- package/lib/packlets/resource-json/helpers.d.ts.map +0 -1
- package/lib/packlets/resource-json/helpers.js.map +0 -1
- package/lib/packlets/resource-json/index.d.ts.map +0 -1
- package/lib/packlets/resource-json/index.js.map +0 -1
- package/lib/packlets/resource-json/json.d.ts.map +0 -1
- package/lib/packlets/resource-json/json.js.map +0 -1
- package/lib/packlets/resource-json/normalized.d.ts.map +0 -1
- package/lib/packlets/resource-json/normalized.js.map +0 -1
- package/lib/packlets/resource-json/resourceDeclCollection.d.ts.map +0 -1
- package/lib/packlets/resource-json/resourceDeclCollection.js.map +0 -1
- package/lib/packlets/resource-json/resourceDeclContainer.d.ts.map +0 -1
- package/lib/packlets/resource-json/resourceDeclContainer.js.map +0 -1
- package/lib/packlets/resource-json/resourceDeclTree.d.ts.map +0 -1
- package/lib/packlets/resource-json/resourceDeclTree.js.map +0 -1
- package/lib/packlets/resource-types/config/convert.d.ts.map +0 -1
- package/lib/packlets/resource-types/config/convert.js.map +0 -1
- package/lib/packlets/resource-types/config/index.d.ts.map +0 -1
- package/lib/packlets/resource-types/config/index.js.map +0 -1
- package/lib/packlets/resource-types/config/json.d.ts.map +0 -1
- package/lib/packlets/resource-types/config/json.js.map +0 -1
- package/lib/packlets/resource-types/helpers.d.ts.map +0 -1
- package/lib/packlets/resource-types/helpers.js.map +0 -1
- package/lib/packlets/resource-types/index.d.ts.map +0 -1
- package/lib/packlets/resource-types/index.js.map +0 -1
- package/lib/packlets/resource-types/jsonResourceType.d.ts.map +0 -1
- package/lib/packlets/resource-types/jsonResourceType.js.map +0 -1
- package/lib/packlets/resource-types/resourceType.d.ts.map +0 -1
- package/lib/packlets/resource-types/resourceType.js.map +0 -1
- package/lib/packlets/resource-types/resourceTypeCollector.d.ts.map +0 -1
- package/lib/packlets/resource-types/resourceTypeCollector.js.map +0 -1
- package/lib/packlets/resources/candidateReducer.d.ts.map +0 -1
- package/lib/packlets/resources/candidateReducer.js.map +0 -1
- package/lib/packlets/resources/common.d.ts.map +0 -1
- package/lib/packlets/resources/common.js.map +0 -1
- package/lib/packlets/resources/index.d.ts.map +0 -1
- package/lib/packlets/resources/index.js.map +0 -1
- package/lib/packlets/resources/resource.d.ts.map +0 -1
- package/lib/packlets/resources/resource.js.map +0 -1
- package/lib/packlets/resources/resourceBuilder.d.ts.map +0 -1
- package/lib/packlets/resources/resourceBuilder.js.map +0 -1
- package/lib/packlets/resources/resourceCandidate.d.ts.map +0 -1
- package/lib/packlets/resources/resourceCandidate.js.map +0 -1
- package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +0 -1
- package/lib/packlets/resources/resourceManagerBuilder.js.map +0 -1
- package/lib/packlets/runtime/cacheListener.d.ts.map +0 -1
- package/lib/packlets/runtime/cacheListener.js.map +0 -1
- package/lib/packlets/runtime/cacheMetrics.d.ts.map +0 -1
- package/lib/packlets/runtime/cacheMetrics.js.map +0 -1
- package/lib/packlets/runtime/compiledResourceCollection.d.ts.map +0 -1
- package/lib/packlets/runtime/compiledResourceCollection.js.map +0 -1
- package/lib/packlets/runtime/conditionSetResolutionResult.d.ts.map +0 -1
- package/lib/packlets/runtime/conditionSetResolutionResult.js.map +0 -1
- package/lib/packlets/runtime/context/contextQualifierProvider.d.ts.map +0 -1
- package/lib/packlets/runtime/context/contextQualifierProvider.js.map +0 -1
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts.map +0 -1
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.js.map +0 -1
- package/lib/packlets/runtime/context/index.d.ts.map +0 -1
- package/lib/packlets/runtime/context/index.js.map +0 -1
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts.map +0 -1
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.js.map +0 -1
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts.map +0 -1
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js.map +0 -1
- package/lib/packlets/runtime/iResourceManager.d.ts.map +0 -1
- package/lib/packlets/runtime/iResourceManager.js.map +0 -1
- package/lib/packlets/runtime/index.d.ts.map +0 -1
- package/lib/packlets/runtime/index.js.map +0 -1
- package/lib/packlets/runtime/resource-tree/common.d.ts.map +0 -1
- package/lib/packlets/runtime/resource-tree/common.js.map +0 -1
- package/lib/packlets/runtime/resource-tree/index.d.ts.map +0 -1
- package/lib/packlets/runtime/resource-tree/index.js.map +0 -1
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.d.ts.map +0 -1
- package/lib/packlets/runtime/resource-tree/readOnlyResourceTree.js.map +0 -1
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.d.ts.map +0 -1
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js.map +0 -1
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.d.ts.map +0 -1
- package/lib/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js.map +0 -1
- package/lib/packlets/runtime/resourceResolver.d.ts.map +0 -1
- package/lib/packlets/runtime/resourceResolver.js.map +0 -1
- package/lib/packlets/runtime/validate.d.ts.map +0 -1
- package/lib/packlets/runtime/validate.js.map +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON representation of ZIP archive input information
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export interface IZipArchiveInputInfo {
|
|
6
|
+
/** Type of input (file or directory) */
|
|
7
|
+
type: 'file' | 'directory';
|
|
8
|
+
/** Original file/directory path */
|
|
9
|
+
originalPath: string;
|
|
10
|
+
/** Path within the archive (e.g., "input/mydir") */
|
|
11
|
+
archivePath: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* JSON representation of ZIP archive config information
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export interface IZipArchiveConfigInfo {
|
|
18
|
+
/** Type of config (always 'file') */
|
|
19
|
+
type: 'file';
|
|
20
|
+
/** Original config file path */
|
|
21
|
+
originalPath: string;
|
|
22
|
+
/** Path within the archive (e.g., "config.json") */
|
|
23
|
+
archivePath: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* JSON representation of a ZIP archive manifest
|
|
27
|
+
* Compatible with existing tools from ts-res-browser-cli
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export interface IZipArchiveManifest {
|
|
31
|
+
/** Archive creation timestamp */
|
|
32
|
+
timestamp: string;
|
|
33
|
+
/** Optional input source information */
|
|
34
|
+
input?: IZipArchiveInputInfo;
|
|
35
|
+
/** Optional configuration file information */
|
|
36
|
+
config?: IZipArchiveConfigInfo;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* JSON representation of an imported file
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export interface IImportedFile {
|
|
43
|
+
/** File name */
|
|
44
|
+
name: string;
|
|
45
|
+
/** Full path within archive */
|
|
46
|
+
path: string;
|
|
47
|
+
/** File content as string */
|
|
48
|
+
content: string;
|
|
49
|
+
/** MIME type */
|
|
50
|
+
type: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* JSON representation of an imported directory structure
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
export interface IImportedDirectory {
|
|
57
|
+
/** Directory name */
|
|
58
|
+
name: string;
|
|
59
|
+
/** Files in this directory */
|
|
60
|
+
files: IImportedFile[];
|
|
61
|
+
/** Subdirectories */
|
|
62
|
+
subdirectories: IImportedDirectory[];
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025 Erik Fortune
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
* copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
* SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Model as ConfigModel } from '../config';
|
|
2
|
+
import * as Json from './json';
|
|
3
|
+
import { FileTree } from '@fgv/ts-json-base';
|
|
4
|
+
/**
|
|
5
|
+
* Options for creating a ZIP archive buffer
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface IZipArchivePathOptions {
|
|
9
|
+
/** File or directory path to include in the archive */
|
|
10
|
+
inputPath?: string;
|
|
11
|
+
/** Optional configuration file path */
|
|
12
|
+
configPath?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Options for creating a ZIP archive buffer from a file tree
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export interface IZipArchiveFileTreeOptions {
|
|
19
|
+
/** Input file or directory */
|
|
20
|
+
inputItem?: FileTree.FileTreeItem;
|
|
21
|
+
/** Optional configuration file */
|
|
22
|
+
configItem?: FileTree.IFileTreeFileItem;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Options for creating a ZIP archive buffer
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export type ZipArchiveOptions = IZipArchivePathOptions | IZipArchiveFileTreeOptions;
|
|
29
|
+
/**
|
|
30
|
+
* Standardized ZIP archive manifest format (compatible with existing tools)
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export type IZipArchiveManifest = Json.IZipArchiveManifest;
|
|
34
|
+
/**
|
|
35
|
+
* Result of ZIP archive buffer creation
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export interface IZipArchiveResult {
|
|
39
|
+
/** Raw ZIP data buffer */
|
|
40
|
+
zipBuffer: Uint8Array;
|
|
41
|
+
/** Archive manifest with metadata */
|
|
42
|
+
manifest: IZipArchiveManifest;
|
|
43
|
+
/** Total ZIP size in bytes */
|
|
44
|
+
size: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Options for loading a ZIP archive
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export interface IZipArchiveLoadOptions {
|
|
51
|
+
/** Validate manifest strictly */
|
|
52
|
+
strictManifestValidation?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Result of ZIP archive loading
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export interface IZipArchiveLoadResult {
|
|
59
|
+
/** Parsed archive manifest */
|
|
60
|
+
manifest: IZipArchiveManifest | undefined;
|
|
61
|
+
/** Loaded configuration */
|
|
62
|
+
config: ConfigModel.ISystemConfiguration | undefined;
|
|
63
|
+
/** All files extracted from the archive */
|
|
64
|
+
files: IImportedFile[];
|
|
65
|
+
/** Directory structure if available */
|
|
66
|
+
directory: IImportedDirectory | undefined;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Imported file representation
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
export type IImportedFile = Json.IImportedFile;
|
|
73
|
+
/**
|
|
74
|
+
* Imported directory structure
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
export type IImportedDirectory = Json.IImportedDirectory;
|
|
78
|
+
/**
|
|
79
|
+
* Progress callback for ZIP operations
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
export type ZipArchiveProgressCallback = (stage: 'reading-file' | 'parsing-zip' | 'loading-manifest' | 'loading-config' | 'extracting-files' | 'processing-resources' | 'creating-zip', progress: number, // 0-100
|
|
83
|
+
details: string) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Constants for ZIP archive structure
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
export declare const ZipArchiveConstants: {
|
|
89
|
+
/** Manifest file name */
|
|
90
|
+
readonly MANIFEST_FILE: "manifest.json";
|
|
91
|
+
/** Configuration file name */
|
|
92
|
+
readonly CONFIG_FILE: "config.json";
|
|
93
|
+
/** Input files directory */
|
|
94
|
+
readonly INPUT_DIR: "input";
|
|
95
|
+
/** Configuration files directory */
|
|
96
|
+
readonly CONFIG_DIR: "config";
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025 Erik Fortune
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
* copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
* SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.ZipArchiveConstants = void 0;
|
|
25
|
+
/**
|
|
26
|
+
* Constants for ZIP archive structure
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
exports.ZipArchiveConstants = {
|
|
30
|
+
/** Manifest file name */
|
|
31
|
+
MANIFEST_FILE: 'manifest.json',
|
|
32
|
+
/** Configuration file name */
|
|
33
|
+
CONFIG_FILE: 'config.json',
|
|
34
|
+
/** Input files directory */
|
|
35
|
+
INPUT_DIR: 'input',
|
|
36
|
+
/** Configuration files directory */
|
|
37
|
+
CONFIG_DIR: 'config'
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Result } from '@fgv/ts-utils';
|
|
2
|
+
import type { IZipArchiveResult, ZipArchiveOptions, ZipArchiveProgressCallback } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* ZIP archive creator using fflate for universal compatibility
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class ZipArchiveCreator {
|
|
8
|
+
/**
|
|
9
|
+
* Create a ZIP archive buffer from a supplied buffer
|
|
10
|
+
* @param options - Input paths and configuration
|
|
11
|
+
* @param onProgress - Optional progress callback
|
|
12
|
+
* @returns Result containing ZIP buffer and manifest
|
|
13
|
+
*/
|
|
14
|
+
createFromBuffer(options: ZipArchiveOptions, onProgress?: ZipArchiveProgressCallback): Promise<Result<IZipArchiveResult>>;
|
|
15
|
+
/**
|
|
16
|
+
* Add a single FileTree item to the ZIP archive
|
|
17
|
+
* @param files - ZIP files collection
|
|
18
|
+
* @param fileItem - FileTree file item to add
|
|
19
|
+
* @param archivePath - Path within the archive
|
|
20
|
+
* @returns Result indicating success or failure
|
|
21
|
+
*/
|
|
22
|
+
private _addFileTreeItemToZip;
|
|
23
|
+
/**
|
|
24
|
+
* Add a directory recursively to the ZIP archive using FileTree
|
|
25
|
+
* @param files - ZIP files collection
|
|
26
|
+
* @param directoryItem - FileTree directory item to add
|
|
27
|
+
* @param archivePrefix - Prefix path within the archive
|
|
28
|
+
* @param onProgress - Optional progress callback
|
|
29
|
+
* @returns Result indicating success or failure
|
|
30
|
+
*/
|
|
31
|
+
private _addDirectoryTreeToZip;
|
|
32
|
+
private _getInputFileTreeItem;
|
|
33
|
+
private _getConfigFileTreeItem;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=zipArchiveCreator.d.ts.map
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025 Erik Fortune
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
* copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
* SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.ZipArchiveCreator = void 0;
|
|
25
|
+
const fflate_1 = require("fflate");
|
|
26
|
+
const ts_utils_1 = require("@fgv/ts-utils");
|
|
27
|
+
const ts_json_base_1 = require("@fgv/ts-json-base");
|
|
28
|
+
const zipArchiveFormat_1 = require("./zipArchiveFormat");
|
|
29
|
+
/**
|
|
30
|
+
* ZIP archive creator using fflate for universal compatibility
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
class ZipArchiveCreator {
|
|
34
|
+
/**
|
|
35
|
+
* Create a ZIP archive buffer from a supplied buffer
|
|
36
|
+
* @param options - Input paths and configuration
|
|
37
|
+
* @param onProgress - Optional progress callback
|
|
38
|
+
* @returns Result containing ZIP buffer and manifest
|
|
39
|
+
*/
|
|
40
|
+
async createFromBuffer(options, onProgress) {
|
|
41
|
+
try {
|
|
42
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('creating-zip', 0, 'Starting ZIP archive creation');
|
|
43
|
+
const files = {};
|
|
44
|
+
const manifest = {
|
|
45
|
+
timestamp: new Date().toISOString()
|
|
46
|
+
};
|
|
47
|
+
const { value: inputItem, message: inputItemError } = this._getInputFileTreeItem(options);
|
|
48
|
+
if (inputItemError !== undefined) {
|
|
49
|
+
return (0, ts_utils_1.fail)(inputItemError);
|
|
50
|
+
}
|
|
51
|
+
if (inputItem !== undefined) {
|
|
52
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('reading-file', 10, `Processing input: ${inputItem.absolutePath}`);
|
|
53
|
+
if (inputItem.type === 'directory') {
|
|
54
|
+
// Add entire directory recursively, preserving structure
|
|
55
|
+
const archivePath = `input/${inputItem.name}`;
|
|
56
|
+
const addDirResult = await this._addDirectoryTreeToZip(files, inputItem, archivePath, onProgress);
|
|
57
|
+
/* c8 ignore next 3 - defense in depth against internal error */
|
|
58
|
+
if (addDirResult.isFailure()) {
|
|
59
|
+
return (0, ts_utils_1.fail)(addDirResult.message);
|
|
60
|
+
}
|
|
61
|
+
manifest.input = {
|
|
62
|
+
type: 'directory',
|
|
63
|
+
originalPath: inputItem.absolutePath,
|
|
64
|
+
archivePath
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
else if (inputItem.type === 'file') {
|
|
68
|
+
// Add single file
|
|
69
|
+
const archivePath = `input/${inputItem.name}`;
|
|
70
|
+
const addFileResult = await this._addFileTreeItemToZip(files, inputItem, archivePath);
|
|
71
|
+
/* c8 ignore next 3 - defense in depth against internal error */
|
|
72
|
+
if (addFileResult.isFailure()) {
|
|
73
|
+
return (0, ts_utils_1.fail)(addFileResult.message);
|
|
74
|
+
}
|
|
75
|
+
manifest.input = {
|
|
76
|
+
type: 'file',
|
|
77
|
+
originalPath: inputItem.absolutePath,
|
|
78
|
+
archivePath
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const { value: configItem, message: configItemError } = this._getConfigFileTreeItem(options);
|
|
83
|
+
if (configItemError !== undefined) {
|
|
84
|
+
return (0, ts_utils_1.fail)(configItemError);
|
|
85
|
+
}
|
|
86
|
+
if (configItem !== undefined) {
|
|
87
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('reading-file', 40, `Processing config: ${configItem.absolutePath}`);
|
|
88
|
+
const archivePath = `config/${configItem.name}`;
|
|
89
|
+
const addConfigResult = await this._addFileTreeItemToZip(files, configItem, archivePath);
|
|
90
|
+
/* c8 ignore next 3 - defense in depth against internal error */
|
|
91
|
+
if (addConfigResult.isFailure()) {
|
|
92
|
+
return (0, ts_utils_1.fail)(addConfigResult.message);
|
|
93
|
+
}
|
|
94
|
+
// Update manifest with config info
|
|
95
|
+
manifest.config = {
|
|
96
|
+
type: 'file',
|
|
97
|
+
originalPath: configItem.absolutePath,
|
|
98
|
+
archivePath
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
// Add manifest to ZIP
|
|
102
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('creating-zip', 70, 'Adding manifest');
|
|
103
|
+
const manifestJson = JSON.stringify(manifest, null, 2);
|
|
104
|
+
files['manifest.json'] = new TextEncoder().encode(manifestJson);
|
|
105
|
+
// Create ZIP buffer using fflate
|
|
106
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('creating-zip', 80, 'Compressing files');
|
|
107
|
+
const zipBuffer = (0, fflate_1.zipSync)(files, { level: 6 });
|
|
108
|
+
const result = {
|
|
109
|
+
zipBuffer,
|
|
110
|
+
manifest,
|
|
111
|
+
size: zipBuffer.length
|
|
112
|
+
};
|
|
113
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('creating-zip', 100, 'ZIP archive buffer created');
|
|
114
|
+
return (0, ts_utils_1.succeed)(result);
|
|
115
|
+
/* c8 ignore next 3 - defense in depth against internal error */
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
return (0, ts_utils_1.fail)(`Failed to create ZIP archive: ${error instanceof Error ? error.message : String(error)}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Add a single FileTree item to the ZIP archive
|
|
123
|
+
* @param files - ZIP files collection
|
|
124
|
+
* @param fileItem - FileTree file item to add
|
|
125
|
+
* @param archivePath - Path within the archive
|
|
126
|
+
* @returns Result indicating success or failure
|
|
127
|
+
*/
|
|
128
|
+
async _addFileTreeItemToZip(files, fileItem, archivePath) {
|
|
129
|
+
return fileItem.getRawContents().onSuccess((content) => {
|
|
130
|
+
const contentBuffer = new TextEncoder().encode(content);
|
|
131
|
+
files[(0, zipArchiveFormat_1.normalizePath)(archivePath)] = contentBuffer;
|
|
132
|
+
return (0, ts_utils_1.succeed)(undefined);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Add a directory recursively to the ZIP archive using FileTree
|
|
137
|
+
* @param files - ZIP files collection
|
|
138
|
+
* @param directoryItem - FileTree directory item to add
|
|
139
|
+
* @param archivePrefix - Prefix path within the archive
|
|
140
|
+
* @param onProgress - Optional progress callback
|
|
141
|
+
* @returns Result indicating success or failure
|
|
142
|
+
*/
|
|
143
|
+
async _addDirectoryTreeToZip(files, directoryItem, archivePrefix, onProgress) {
|
|
144
|
+
const childrenResult = directoryItem.getChildren();
|
|
145
|
+
/* c8 ignore next 3 - defense in depth against internal error */
|
|
146
|
+
if (childrenResult.isFailure()) {
|
|
147
|
+
return (0, ts_utils_1.fail)(`Failed to read directory ${directoryItem.absolutePath}: ${childrenResult.message}`);
|
|
148
|
+
}
|
|
149
|
+
for (const child of childrenResult.value) {
|
|
150
|
+
const itemArchivePath = (0, zipArchiveFormat_1.normalizePath)(`${archivePrefix}/${child.name}`);
|
|
151
|
+
if (child.type === 'directory') {
|
|
152
|
+
// Recursively add subdirectory
|
|
153
|
+
const addDirResult = await this._addDirectoryTreeToZip(files, child, itemArchivePath, onProgress);
|
|
154
|
+
/* c8 ignore next 3 - defense in depth against internal error */
|
|
155
|
+
if (addDirResult.isFailure()) {
|
|
156
|
+
return (0, ts_utils_1.fail)(addDirResult.message);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
else if (child.type === 'file') {
|
|
160
|
+
// Add file
|
|
161
|
+
const addFileResult = await this._addFileTreeItemToZip(files, child, itemArchivePath);
|
|
162
|
+
/* c8 ignore next 3 - defense in depth against internal error */
|
|
163
|
+
if (addFileResult.isFailure()) {
|
|
164
|
+
return (0, ts_utils_1.fail)(addFileResult.message);
|
|
165
|
+
}
|
|
166
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('reading-file', 0, `Added file: ${itemArchivePath}`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return (0, ts_utils_1.succeed)(undefined);
|
|
170
|
+
}
|
|
171
|
+
_getInputFileTreeItem(options) {
|
|
172
|
+
if ('inputPath' in options && options.inputPath !== undefined) {
|
|
173
|
+
return ts_json_base_1.FileTree.forFilesystem()
|
|
174
|
+
.withErrorFormat((msg) => `Failed to create file tree: ${msg}`)
|
|
175
|
+
.onSuccess((fileTree) => fileTree.getItem(options.inputPath).withErrorFormat((msg) => `Failed to get item: ${msg}`));
|
|
176
|
+
}
|
|
177
|
+
else if ('inputItem' in options) {
|
|
178
|
+
return (0, ts_utils_1.succeed)(options.inputItem);
|
|
179
|
+
}
|
|
180
|
+
return (0, ts_utils_1.succeed)(undefined);
|
|
181
|
+
}
|
|
182
|
+
_getConfigFileTreeItem(options) {
|
|
183
|
+
if ('configPath' in options && options.configPath !== undefined) {
|
|
184
|
+
return ts_json_base_1.FileTree.forFilesystem()
|
|
185
|
+
.withErrorFormat((msg) => `Failed to create file tree: ${msg}`)
|
|
186
|
+
.onSuccess((fileTree) => fileTree.getFile(options.configPath).withErrorFormat((msg) => `Failed to get config file: ${msg}`));
|
|
187
|
+
}
|
|
188
|
+
else if ('configItem' in options && options.configItem !== undefined) {
|
|
189
|
+
return (0, ts_utils_1.succeed)(options.configItem);
|
|
190
|
+
}
|
|
191
|
+
return (0, ts_utils_1.succeed)(undefined);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
exports.ZipArchiveCreator = ZipArchiveCreator;
|
|
195
|
+
//# sourceMappingURL=zipArchiveCreator.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Result } from '@fgv/ts-utils';
|
|
2
|
+
import { Model as ConfigModel } from '../config';
|
|
3
|
+
import * as Json from './json';
|
|
4
|
+
/**
|
|
5
|
+
* Create a ZIP archive manifest object
|
|
6
|
+
* @param inputType - Type of input (file or directory)
|
|
7
|
+
* @param originalPath - Original file/directory path
|
|
8
|
+
* @param archivePath - Path within the archive
|
|
9
|
+
* @param configPath - Optional configuration file path
|
|
10
|
+
* @returns ZIP archive manifest
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare function createZipArchiveManifest(inputType: 'file' | 'directory', originalPath: string, archivePath: string, configPath?: string): Json.IZipArchiveManifest;
|
|
14
|
+
/**
|
|
15
|
+
* Parse and validate a ZIP archive manifest
|
|
16
|
+
* @param manifestData - JSON string containing manifest data
|
|
17
|
+
* @returns Result containing validated manifest
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseZipArchiveManifest(manifestData: string): Result<Json.IZipArchiveManifest>;
|
|
21
|
+
/**
|
|
22
|
+
* Validate a ZIP archive manifest object
|
|
23
|
+
* @param manifest - Object to validate as manifest
|
|
24
|
+
* @returns Result containing validated manifest
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export declare function validateZipArchiveManifest(manifest: unknown): Result<Json.IZipArchiveManifest>;
|
|
28
|
+
/**
|
|
29
|
+
* Parse and validate configuration JSON
|
|
30
|
+
* @param configData - JSON string containing configuration
|
|
31
|
+
* @returns Result containing validated configuration
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseZipArchiveConfiguration(configData: string): Result<ConfigModel.ISystemConfiguration>;
|
|
35
|
+
/**
|
|
36
|
+
* Generate a timestamp-based filename for ZIP archives
|
|
37
|
+
* @param customName - Optional custom name prefix
|
|
38
|
+
* @returns Generated filename
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
export declare function generateZipArchiveFilename(customName?: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Normalize path separators for cross-platform compatibility
|
|
44
|
+
* @param path - Path to normalize
|
|
45
|
+
* @returns Normalized path
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export declare function normalizePath(path: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* Extract directory name from a file path
|
|
51
|
+
* @param path - File path
|
|
52
|
+
* @returns Directory name
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export declare function getDirectoryName(path: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Create a safe filename by removing invalid characters
|
|
58
|
+
* @param filename - Original filename
|
|
59
|
+
* @returns Sanitized filename
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
export declare function sanitizeFilename(filename: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* Validate ZIP file extension
|
|
65
|
+
* @param filename - Filename to validate
|
|
66
|
+
* @returns True if filename has .zip extension
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
export declare function isZipFile(filename: string): boolean;
|
|
70
|
+
//# sourceMappingURL=zipArchiveFormat.d.ts.map
|