@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,184 @@
|
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
26
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
27
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
28
|
+
}
|
|
29
|
+
Object.defineProperty(o, k2, desc);
|
|
30
|
+
}) : (function(o, m, k, k2) {
|
|
31
|
+
if (k2 === undefined) k2 = k;
|
|
32
|
+
o[k2] = m[k];
|
|
33
|
+
}));
|
|
34
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
35
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
36
|
+
}) : function(o, v) {
|
|
37
|
+
o["default"] = v;
|
|
38
|
+
});
|
|
39
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
40
|
+
var ownKeys = function(o) {
|
|
41
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
42
|
+
var ar = [];
|
|
43
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
44
|
+
return ar;
|
|
45
|
+
};
|
|
46
|
+
return ownKeys(o);
|
|
47
|
+
};
|
|
48
|
+
return function (mod) {
|
|
49
|
+
if (mod && mod.__esModule) return mod;
|
|
50
|
+
var result = {};
|
|
51
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
52
|
+
__setModuleDefault(result, mod);
|
|
53
|
+
return result;
|
|
54
|
+
};
|
|
55
|
+
})();
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.createZipArchiveManifest = createZipArchiveManifest;
|
|
58
|
+
exports.parseZipArchiveManifest = parseZipArchiveManifest;
|
|
59
|
+
exports.validateZipArchiveManifest = validateZipArchiveManifest;
|
|
60
|
+
exports.parseZipArchiveConfiguration = parseZipArchiveConfiguration;
|
|
61
|
+
exports.generateZipArchiveFilename = generateZipArchiveFilename;
|
|
62
|
+
exports.normalizePath = normalizePath;
|
|
63
|
+
exports.getDirectoryName = getDirectoryName;
|
|
64
|
+
exports.sanitizeFilename = sanitizeFilename;
|
|
65
|
+
exports.isZipFile = isZipFile;
|
|
66
|
+
const ts_utils_1 = require("@fgv/ts-utils");
|
|
67
|
+
const Convert = __importStar(require("./convert"));
|
|
68
|
+
/**
|
|
69
|
+
* Create a ZIP archive manifest object
|
|
70
|
+
* @param inputType - Type of input (file or directory)
|
|
71
|
+
* @param originalPath - Original file/directory path
|
|
72
|
+
* @param archivePath - Path within the archive
|
|
73
|
+
* @param configPath - Optional configuration file path
|
|
74
|
+
* @returns ZIP archive manifest
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
function createZipArchiveManifest(inputType, originalPath, archivePath, configPath) {
|
|
78
|
+
const manifest = {
|
|
79
|
+
timestamp: new Date().toISOString(),
|
|
80
|
+
input: {
|
|
81
|
+
type: inputType,
|
|
82
|
+
originalPath,
|
|
83
|
+
archivePath
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
if (configPath) {
|
|
87
|
+
manifest.config = {
|
|
88
|
+
type: 'file',
|
|
89
|
+
originalPath: configPath,
|
|
90
|
+
archivePath: 'config.json'
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return manifest;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Parse and validate a ZIP archive manifest
|
|
97
|
+
* @param manifestData - JSON string containing manifest data
|
|
98
|
+
* @returns Result containing validated manifest
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
function parseZipArchiveManifest(manifestData) {
|
|
102
|
+
return (0, ts_utils_1.captureResult)(() => {
|
|
103
|
+
const parsed = JSON.parse(manifestData);
|
|
104
|
+
return parsed;
|
|
105
|
+
})
|
|
106
|
+
.onSuccess((parsed) => Convert.zipArchiveManifest.validate(parsed))
|
|
107
|
+
.withErrorFormat((e) => `Failed to parse ZIP archive manifest: ${e}`);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Validate a ZIP archive manifest object
|
|
111
|
+
* @param manifest - Object to validate as manifest
|
|
112
|
+
* @returns Result containing validated manifest
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
function validateZipArchiveManifest(manifest) {
|
|
116
|
+
return Convert.zipArchiveManifest.validate(manifest);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Parse and validate configuration JSON
|
|
120
|
+
* @param configData - JSON string containing configuration
|
|
121
|
+
* @returns Result containing validated configuration
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
124
|
+
function parseZipArchiveConfiguration(configData) {
|
|
125
|
+
return (0, ts_utils_1.captureResult)(() => {
|
|
126
|
+
const parsed = JSON.parse(configData);
|
|
127
|
+
return parsed;
|
|
128
|
+
})
|
|
129
|
+
.onSuccess((parsed) => Convert.systemConfiguration.validate(parsed))
|
|
130
|
+
.withErrorFormat((e) => `Failed to parse ZIP archive configuration: ${e}`);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Generate a timestamp-based filename for ZIP archives
|
|
134
|
+
* @param customName - Optional custom name prefix
|
|
135
|
+
* @returns Generated filename
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
function generateZipArchiveFilename(customName) {
|
|
139
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').replace('T', '_').slice(0, -5);
|
|
140
|
+
return customName ? `${customName}-${timestamp}.zip` : `ts-res-archive-${timestamp}.zip`;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Normalize path separators for cross-platform compatibility
|
|
144
|
+
* @param path - Path to normalize
|
|
145
|
+
* @returns Normalized path
|
|
146
|
+
* @public
|
|
147
|
+
*/
|
|
148
|
+
function normalizePath(path) {
|
|
149
|
+
return path.replace(/\\/g, '/').replace(/\/+/g, '/');
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Extract directory name from a file path
|
|
153
|
+
* @param path - File path
|
|
154
|
+
* @returns Directory name
|
|
155
|
+
* @public
|
|
156
|
+
*/
|
|
157
|
+
function getDirectoryName(path) {
|
|
158
|
+
const normalized = normalizePath(path);
|
|
159
|
+
const parts = normalized.split('/');
|
|
160
|
+
return parts[parts.length - 1] || 'archive';
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Create a safe filename by removing invalid characters
|
|
164
|
+
* @param filename - Original filename
|
|
165
|
+
* @returns Sanitized filename
|
|
166
|
+
* @public
|
|
167
|
+
*/
|
|
168
|
+
function sanitizeFilename(filename) {
|
|
169
|
+
return filename
|
|
170
|
+
.replace(/[<>:"/\\|?*]/g, '_')
|
|
171
|
+
.replace(/\s+/g, '_')
|
|
172
|
+
.replace(/_+/g, '_')
|
|
173
|
+
.trim();
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Validate ZIP file extension
|
|
177
|
+
* @param filename - Filename to validate
|
|
178
|
+
* @returns True if filename has .zip extension
|
|
179
|
+
* @public
|
|
180
|
+
*/
|
|
181
|
+
function isZipFile(filename) {
|
|
182
|
+
return filename.toLowerCase().endsWith('.zip');
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=zipArchiveFormat.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Result } from '@fgv/ts-utils';
|
|
2
|
+
import type { IZipArchiveLoadOptions, IZipArchiveLoadResult, ZipArchiveProgressCallback } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* ZIP archive loader extending ts-extras foundation
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class ZipArchiveLoader {
|
|
8
|
+
/**
|
|
9
|
+
* Load ZIP archive from File object (Browser)
|
|
10
|
+
* @param file - File object from file input
|
|
11
|
+
* @param options - Loading options
|
|
12
|
+
* @param onProgress - Optional progress callback
|
|
13
|
+
* @returns Result containing loaded archive data
|
|
14
|
+
*/
|
|
15
|
+
loadFromFile(file: File, options?: IZipArchiveLoadOptions, onProgress?: ZipArchiveProgressCallback): Promise<Result<IZipArchiveLoadResult>>;
|
|
16
|
+
/**
|
|
17
|
+
* Load ZIP archive from ArrayBuffer (Universal)
|
|
18
|
+
* @param buffer - ZIP data buffer
|
|
19
|
+
* @param options - Loading options
|
|
20
|
+
* @param onProgress - Optional progress callback
|
|
21
|
+
* @returns Result containing loaded archive data
|
|
22
|
+
*/
|
|
23
|
+
loadFromBuffer(buffer: ArrayBuffer, options?: IZipArchiveLoadOptions, onProgress?: ZipArchiveProgressCallback): Promise<Result<IZipArchiveLoadResult>>;
|
|
24
|
+
/**
|
|
25
|
+
* Load manifest from ZIP using ZipFileTreeAccessors
|
|
26
|
+
* @param zipAccessors - ZIP file tree accessors
|
|
27
|
+
* @returns Result containing parsed manifest
|
|
28
|
+
*/
|
|
29
|
+
private _loadManifestFromAccessors;
|
|
30
|
+
/**
|
|
31
|
+
* Load configuration from ZIP using ZipFileTreeAccessors
|
|
32
|
+
* @param zipAccessors - ZIP file tree accessors
|
|
33
|
+
* @param manifest - Parsed manifest (may be undefined)
|
|
34
|
+
* @param options - Loading options
|
|
35
|
+
* @returns Result containing parsed configuration
|
|
36
|
+
*/
|
|
37
|
+
private _loadConfigurationFromAccessors;
|
|
38
|
+
/**
|
|
39
|
+
* Extract files and directory structure from ZIP
|
|
40
|
+
* @param zipAccessors - ZIP file tree accessors
|
|
41
|
+
* @param onProgress - Optional progress callback
|
|
42
|
+
* @returns Result containing files and directory structure
|
|
43
|
+
*/
|
|
44
|
+
private _extractFilesFromAccessors;
|
|
45
|
+
/**
|
|
46
|
+
* Recursively process file tree items
|
|
47
|
+
* @param zipAccessors - ZIP file tree accessors
|
|
48
|
+
* @param currentPath - Current directory path
|
|
49
|
+
* @param items - Items to process
|
|
50
|
+
* @param files - Files collection
|
|
51
|
+
* @param directories - Directories collection
|
|
52
|
+
* @param onProgress - Optional progress callback
|
|
53
|
+
* @param processed - Processing counter
|
|
54
|
+
*/
|
|
55
|
+
private _processFileTreeItems;
|
|
56
|
+
/**
|
|
57
|
+
* Build directory structure from files
|
|
58
|
+
* @param files - Extracted files
|
|
59
|
+
* @param directories - Directories map
|
|
60
|
+
* @returns Root directory structure or null
|
|
61
|
+
*/
|
|
62
|
+
private _buildDirectoryStructure;
|
|
63
|
+
/**
|
|
64
|
+
* Get file MIME type based on extension
|
|
65
|
+
* @param filename - Filename
|
|
66
|
+
* @returns MIME type
|
|
67
|
+
*/
|
|
68
|
+
private _getFileType;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=zipArchiveLoader.d.ts.map
|
|
@@ -0,0 +1,286 @@
|
|
|
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.ZipArchiveLoader = void 0;
|
|
25
|
+
const ts_utils_1 = require("@fgv/ts-utils");
|
|
26
|
+
// ZipFileTree is browser-safe - doesn't depend on Node.js crypto/fs modules
|
|
27
|
+
const ts_extras_1 = require("@fgv/ts-extras");
|
|
28
|
+
const zipArchiveFormat_1 = require("./zipArchiveFormat");
|
|
29
|
+
/**
|
|
30
|
+
* ZIP archive loader extending ts-extras foundation
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
class ZipArchiveLoader {
|
|
34
|
+
/**
|
|
35
|
+
* Load ZIP archive from File object (Browser)
|
|
36
|
+
* @param file - File object from file input
|
|
37
|
+
* @param options - Loading options
|
|
38
|
+
* @param onProgress - Optional progress callback
|
|
39
|
+
* @returns Result containing loaded archive data
|
|
40
|
+
*/
|
|
41
|
+
async loadFromFile(file, options = {}, onProgress) {
|
|
42
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('reading-file', 0, `Reading file: ${file.name}`);
|
|
43
|
+
if (!(0, zipArchiveFormat_1.isZipFile)(file.name)) {
|
|
44
|
+
return (0, ts_utils_1.fail)(`File ${file.name} is not a ZIP file`);
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const buffer = await file.arrayBuffer();
|
|
48
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('reading-file', 100, 'File read complete');
|
|
49
|
+
return await this.loadFromBuffer(buffer, options, onProgress);
|
|
50
|
+
/* c8 ignore next 3 - defense in depth against internal error */
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return (0, ts_utils_1.fail)(`Failed to read file: ${error instanceof Error ? error.message : String(error)}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Load ZIP archive from ArrayBuffer (Universal)
|
|
58
|
+
* @param buffer - ZIP data buffer
|
|
59
|
+
* @param options - Loading options
|
|
60
|
+
* @param onProgress - Optional progress callback
|
|
61
|
+
* @returns Result containing loaded archive data
|
|
62
|
+
*/
|
|
63
|
+
async loadFromBuffer(buffer, options = {}, onProgress) {
|
|
64
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('parsing-zip', 0, 'Parsing ZIP archive');
|
|
65
|
+
const zipAccessorsResult = ts_extras_1.ZipFileTree.ZipFileTreeAccessors.fromBuffer(buffer);
|
|
66
|
+
if (zipAccessorsResult.isFailure()) {
|
|
67
|
+
return (0, ts_utils_1.fail)(`Failed to parse ZIP: ${zipAccessorsResult.message}`);
|
|
68
|
+
}
|
|
69
|
+
const zipAccessors = zipAccessorsResult.value;
|
|
70
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('parsing-zip', 100, 'ZIP archive parsed');
|
|
71
|
+
// Load manifest
|
|
72
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('loading-manifest', 0, 'Loading manifest');
|
|
73
|
+
const manifestResult = this._loadManifestFromAccessors(zipAccessors);
|
|
74
|
+
if (manifestResult.isFailure()) {
|
|
75
|
+
return (0, ts_utils_1.fail)(manifestResult.message);
|
|
76
|
+
}
|
|
77
|
+
const manifest = manifestResult.value;
|
|
78
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('loading-manifest', 100, 'Manifest loaded');
|
|
79
|
+
// Load configuration
|
|
80
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('loading-config', 0, 'Loading configuration');
|
|
81
|
+
const configResult = this._loadConfigurationFromAccessors(zipAccessors, manifest, options);
|
|
82
|
+
if (configResult.isFailure()) {
|
|
83
|
+
return (0, ts_utils_1.fail)(configResult.message);
|
|
84
|
+
}
|
|
85
|
+
const config = configResult.value;
|
|
86
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('loading-config', 100, 'Configuration loaded');
|
|
87
|
+
// Extract files and directory structure
|
|
88
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('extracting-files', 0, 'Extracting files');
|
|
89
|
+
const filesResult = await this._extractFilesFromAccessors(zipAccessors, onProgress);
|
|
90
|
+
/* c8 ignore next 3 - defense in depth against internal error */
|
|
91
|
+
if (filesResult.isFailure()) {
|
|
92
|
+
return (0, ts_utils_1.fail)(filesResult.message);
|
|
93
|
+
}
|
|
94
|
+
const { files, directory } = filesResult.value;
|
|
95
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('extracting-files', 100, `Extracted ${files.length} files`);
|
|
96
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('extracting-files', 100, 'ZIP loading complete');
|
|
97
|
+
return (0, ts_utils_1.succeed)({
|
|
98
|
+
manifest,
|
|
99
|
+
config,
|
|
100
|
+
files,
|
|
101
|
+
directory
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Load manifest from ZIP using ZipFileTreeAccessors
|
|
106
|
+
* @param zipAccessors - ZIP file tree accessors
|
|
107
|
+
* @returns Result containing parsed manifest
|
|
108
|
+
*/
|
|
109
|
+
_loadManifestFromAccessors(zipAccessors) {
|
|
110
|
+
const manifestResult = zipAccessors.getFileContents('manifest.json');
|
|
111
|
+
if (manifestResult.isFailure()) {
|
|
112
|
+
// Manifest is optional - return success with undefined
|
|
113
|
+
return (0, ts_utils_1.succeed)(undefined);
|
|
114
|
+
}
|
|
115
|
+
const parseResult = (0, zipArchiveFormat_1.parseZipArchiveManifest)(manifestResult.value);
|
|
116
|
+
if (parseResult.isFailure()) {
|
|
117
|
+
return (0, ts_utils_1.fail)(`Failed to parse manifest.json: ${parseResult.message}`);
|
|
118
|
+
}
|
|
119
|
+
return (0, ts_utils_1.succeed)(parseResult.value);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Load configuration from ZIP using ZipFileTreeAccessors
|
|
123
|
+
* @param zipAccessors - ZIP file tree accessors
|
|
124
|
+
* @param manifest - Parsed manifest (may be undefined)
|
|
125
|
+
* @param options - Loading options
|
|
126
|
+
* @returns Result containing parsed configuration
|
|
127
|
+
*/
|
|
128
|
+
_loadConfigurationFromAccessors(zipAccessors, manifest, options) {
|
|
129
|
+
// Check if manifest specifies a config file
|
|
130
|
+
const manifestSpecifiesConfig = (manifest === null || manifest === void 0 ? void 0 : manifest.config) !== undefined;
|
|
131
|
+
if (!manifestSpecifiesConfig) {
|
|
132
|
+
// If no config specified in manifest, config is optional
|
|
133
|
+
return (0, ts_utils_1.succeed)(undefined);
|
|
134
|
+
}
|
|
135
|
+
// Get the config path from the manifest
|
|
136
|
+
const configPath = manifest.config.archivePath;
|
|
137
|
+
return zipAccessors
|
|
138
|
+
.getFileContents(configPath)
|
|
139
|
+
.withErrorFormat(() => `Manifest specifies config file at '${configPath}' but it was not found in archive`)
|
|
140
|
+
.onSuccess((configContent) => (0, zipArchiveFormat_1.parseZipArchiveConfiguration)(configContent))
|
|
141
|
+
.withErrorFormat((e) => `Failed to parse config file '${configPath}': ${e}`);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Extract files and directory structure from ZIP
|
|
145
|
+
* @param zipAccessors - ZIP file tree accessors
|
|
146
|
+
* @param onProgress - Optional progress callback
|
|
147
|
+
* @returns Result containing files and directory structure
|
|
148
|
+
*/
|
|
149
|
+
async _extractFilesFromAccessors(zipAccessors, onProgress) {
|
|
150
|
+
try {
|
|
151
|
+
const files = [];
|
|
152
|
+
const directories = new Map();
|
|
153
|
+
// Get all children from root
|
|
154
|
+
const rootChildrenResult = zipAccessors.getChildren('/');
|
|
155
|
+
/* c8 ignore next 3 - defense in depth against internal error */
|
|
156
|
+
if (rootChildrenResult.isFailure()) {
|
|
157
|
+
return (0, ts_utils_1.fail)(`Failed to read ZIP contents: ${rootChildrenResult.message}`);
|
|
158
|
+
}
|
|
159
|
+
// Process all items recursively
|
|
160
|
+
await this._processFileTreeItems(zipAccessors, '/', rootChildrenResult.value, files, directories, onProgress);
|
|
161
|
+
// Build directory structure
|
|
162
|
+
const directory = this._buildDirectoryStructure(files, directories);
|
|
163
|
+
return (0, ts_utils_1.succeed)({ files, directory });
|
|
164
|
+
/* c8 ignore next 3 - defense in depth against internal error */
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
return (0, ts_utils_1.fail)(`Failed to extract files: ${error instanceof Error ? error.message : String(error)}`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Recursively process file tree items
|
|
172
|
+
* @param zipAccessors - ZIP file tree accessors
|
|
173
|
+
* @param currentPath - Current directory path
|
|
174
|
+
* @param items - Items to process
|
|
175
|
+
* @param files - Files collection
|
|
176
|
+
* @param directories - Directories collection
|
|
177
|
+
* @param onProgress - Optional progress callback
|
|
178
|
+
* @param processed - Processing counter
|
|
179
|
+
*/
|
|
180
|
+
async _processFileTreeItems(zipAccessors, currentPath, items, files, directories, onProgress, processed = { count: 0 }) {
|
|
181
|
+
for (const item of items) {
|
|
182
|
+
/* c8 ignore next 1 - defense in depth */
|
|
183
|
+
const itemPath = item.absolutePath.startsWith('/') ? item.absolutePath.substring(1) : item.absolutePath;
|
|
184
|
+
if (item.type === 'directory') {
|
|
185
|
+
// Track directory
|
|
186
|
+
if (!directories.has(itemPath)) {
|
|
187
|
+
directories.set(itemPath, {
|
|
188
|
+
name: item.name,
|
|
189
|
+
files: [],
|
|
190
|
+
subdirectories: []
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
// Recursively process children
|
|
194
|
+
const childrenResult = zipAccessors.getChildren(item.absolutePath);
|
|
195
|
+
if (childrenResult.isSuccess()) {
|
|
196
|
+
await this._processFileTreeItems(zipAccessors, item.absolutePath, childrenResult.value, files, directories, onProgress, processed);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
else if (item.type === 'file') {
|
|
200
|
+
// Get file content
|
|
201
|
+
const contentResult = item.getRawContents();
|
|
202
|
+
const content = contentResult.orDefault('');
|
|
203
|
+
files.push({
|
|
204
|
+
name: item.name,
|
|
205
|
+
path: itemPath,
|
|
206
|
+
content,
|
|
207
|
+
type: this._getFileType(item.name)
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
processed.count++;
|
|
211
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress('extracting-files', 0, `Processing ${itemPath}`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Build directory structure from files
|
|
216
|
+
* @param files - Extracted files
|
|
217
|
+
* @param directories - Directories map
|
|
218
|
+
* @returns Root directory structure or null
|
|
219
|
+
*/
|
|
220
|
+
_buildDirectoryStructure(files, directories) {
|
|
221
|
+
/* c8 ignore next 3 - should never happen with fflate */
|
|
222
|
+
if (files.length === 0) {
|
|
223
|
+
return undefined;
|
|
224
|
+
}
|
|
225
|
+
const rootDir = {
|
|
226
|
+
name: 'root',
|
|
227
|
+
files: [],
|
|
228
|
+
subdirectories: []
|
|
229
|
+
};
|
|
230
|
+
// Process files to build directory structure
|
|
231
|
+
for (const file of files) {
|
|
232
|
+
const pathParts = file.path.split('/').filter((part) => part.length > 0);
|
|
233
|
+
/* c8 ignore next 1 - defense in depth should never happen */
|
|
234
|
+
if (pathParts.length === 0)
|
|
235
|
+
continue;
|
|
236
|
+
// Ensure all parent directories exist
|
|
237
|
+
let currentDir = rootDir;
|
|
238
|
+
for (let i = 0; i < pathParts.length - 1; i++) {
|
|
239
|
+
const dirName = pathParts[i];
|
|
240
|
+
let foundDir = currentDir.subdirectories.find((d) => d.name === dirName);
|
|
241
|
+
if (!foundDir) {
|
|
242
|
+
foundDir = {
|
|
243
|
+
name: dirName,
|
|
244
|
+
files: [],
|
|
245
|
+
subdirectories: []
|
|
246
|
+
};
|
|
247
|
+
currentDir.subdirectories.push(foundDir);
|
|
248
|
+
}
|
|
249
|
+
currentDir = foundDir;
|
|
250
|
+
}
|
|
251
|
+
// Add file to its parent directory
|
|
252
|
+
currentDir.files.push(file);
|
|
253
|
+
}
|
|
254
|
+
return rootDir;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Get file MIME type based on extension
|
|
258
|
+
* @param filename - Filename
|
|
259
|
+
* @returns MIME type
|
|
260
|
+
*/
|
|
261
|
+
_getFileType(filename) {
|
|
262
|
+
const ext = filename.toLowerCase().split('.').pop();
|
|
263
|
+
/* c8 ignore next 20 - no need to test every one */
|
|
264
|
+
switch (ext) {
|
|
265
|
+
case 'json':
|
|
266
|
+
return 'application/json';
|
|
267
|
+
case 'yaml':
|
|
268
|
+
case 'yml':
|
|
269
|
+
return 'application/yaml';
|
|
270
|
+
case 'xml':
|
|
271
|
+
return 'application/xml';
|
|
272
|
+
case 'txt':
|
|
273
|
+
return 'text/plain';
|
|
274
|
+
case 'md':
|
|
275
|
+
return 'text/markdown';
|
|
276
|
+
case 'js':
|
|
277
|
+
return 'application/javascript';
|
|
278
|
+
case 'ts':
|
|
279
|
+
return 'application/typescript';
|
|
280
|
+
default:
|
|
281
|
+
return 'application/octet-stream';
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
exports.ZipArchiveLoader = ZipArchiveLoader;
|
|
286
|
+
//# sourceMappingURL=zipArchiveLoader.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fgv/ts-res",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1-1",
|
|
4
4
|
"description": "Multi-dimensional Resource Runtime",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "dist/ts-res.d.ts",
|
|
@@ -18,48 +18,42 @@
|
|
|
18
18
|
"homepage": "https://github.com/ErikFortune/fgv/tree/main/libraries/ts-res#readme",
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@microsoft/api-documenter": "^7.26.
|
|
22
|
-
"@microsoft/api-extractor": "^7.
|
|
21
|
+
"@microsoft/api-documenter": "^7.26.31",
|
|
22
|
+
"@microsoft/api-extractor": "^7.52.10",
|
|
23
23
|
"@types/jest": "^29.5.14",
|
|
24
|
-
"@types/luxon": "^3.
|
|
24
|
+
"@types/luxon": "^3.7.1",
|
|
25
25
|
"@types/node": "^20.14.9",
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
27
|
-
"@typescript-eslint/parser": "^
|
|
28
|
-
"eslint": "^
|
|
29
|
-
"eslint-config-prettier": "^10.1.
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^8.42.0",
|
|
27
|
+
"@typescript-eslint/parser": "^8.42.0",
|
|
28
|
+
"eslint": "^9.35.0",
|
|
29
|
+
"eslint-config-prettier": "^10.1.8",
|
|
30
30
|
"eslint-plugin-import": "^2.32.0",
|
|
31
31
|
"eslint-plugin-node": "^11.1.0",
|
|
32
|
-
"eslint-plugin-prettier": "^5.5.
|
|
33
|
-
"eslint-plugin-promise": "^
|
|
32
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
33
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
34
34
|
"jest": "^29.7.0",
|
|
35
35
|
"prettier": "^3.6.2",
|
|
36
|
-
"rimraf": "^
|
|
37
|
-
"ts-jest": "^29.4.
|
|
36
|
+
"rimraf": "^6.0.1",
|
|
37
|
+
"ts-jest": "^29.4.1",
|
|
38
38
|
"ts-node": "^10.9.2",
|
|
39
|
-
"typescript": "
|
|
40
|
-
"eslint-plugin-n": "^
|
|
41
|
-
"@rushstack/eslint-config": "
|
|
42
|
-
"@rushstack/heft": "
|
|
43
|
-
"@rushstack/heft-jest-plugin": "
|
|
44
|
-
"@rushstack/heft-node-rig": "
|
|
39
|
+
"typescript": "5.8.3",
|
|
40
|
+
"eslint-plugin-n": "^17.21.3",
|
|
41
|
+
"@rushstack/eslint-config": "4.4.0",
|
|
42
|
+
"@rushstack/heft": "0.74.4",
|
|
43
|
+
"@rushstack/heft-jest-plugin": "0.16.13",
|
|
44
|
+
"@rushstack/heft-node-rig": "2.9.5",
|
|
45
45
|
"@types/heft-jest": "1.0.6",
|
|
46
46
|
"eslint-plugin-tsdoc": "~0.4.0",
|
|
47
|
-
"@fgv/ts-utils": "5.0.
|
|
48
|
-
"@fgv/ts-
|
|
49
|
-
"@fgv/ts-extras": "5.0.0-9",
|
|
50
|
-
"@fgv/ts-bcp47": "5.0.0-9",
|
|
51
|
-
"@fgv/ts-json": "5.0.0-9",
|
|
52
|
-
"@fgv/ts-json-base": "5.0.0-9"
|
|
47
|
+
"@fgv/ts-utils-jest": "5.0.1-1",
|
|
48
|
+
"@fgv/ts-extras": "5.0.1-1"
|
|
53
49
|
},
|
|
54
50
|
"dependencies": {
|
|
55
|
-
"luxon": "^3.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"@fgv/ts-
|
|
59
|
-
"@fgv/ts-
|
|
60
|
-
"@fgv/ts-
|
|
61
|
-
"@fgv/ts-json": "5.0.0-9",
|
|
62
|
-
"@fgv/ts-bcp47": "5.0.0-9"
|
|
51
|
+
"luxon": "^3.7.2",
|
|
52
|
+
"fflate": "~0.8.2",
|
|
53
|
+
"@fgv/ts-utils": "5.0.1-1",
|
|
54
|
+
"@fgv/ts-json-base": "5.0.1-1",
|
|
55
|
+
"@fgv/ts-json": "5.0.1-1",
|
|
56
|
+
"@fgv/ts-bcp47": "5.0.1-1"
|
|
63
57
|
},
|
|
64
58
|
"scripts": {
|
|
65
59
|
"build": "heft build --clean",
|