@fgv/ts-res 5.0.0-8 → 5.0.0-9
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/dist/ts-res.d.ts +519 -98
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -1
- package/lib/index.js.map +1 -1
- package/lib/packlets/bundle/bundleBuilder.d.ts +41 -0
- package/lib/packlets/bundle/bundleBuilder.d.ts.map +1 -0
- package/lib/packlets/bundle/bundleBuilder.js +131 -0
- package/lib/packlets/bundle/bundleBuilder.js.map +1 -0
- package/lib/packlets/bundle/bundleLoader.d.ts +72 -0
- package/lib/packlets/bundle/bundleLoader.d.ts.map +1 -0
- package/lib/packlets/bundle/bundleLoader.js +104 -0
- package/lib/packlets/bundle/bundleLoader.js.map +1 -0
- package/lib/packlets/bundle/bundleNormalizer.d.ts +73 -0
- package/lib/packlets/bundle/bundleNormalizer.d.ts.map +1 -0
- package/lib/packlets/bundle/bundleNormalizer.js +142 -0
- package/lib/packlets/bundle/bundleNormalizer.js.map +1 -0
- package/lib/packlets/bundle/bundleUtils.d.ts +70 -0
- package/lib/packlets/bundle/bundleUtils.d.ts.map +1 -0
- package/lib/packlets/bundle/bundleUtils.js +119 -0
- package/lib/packlets/bundle/bundleUtils.js.map +1 -0
- package/lib/packlets/bundle/convert.d.ts +33 -0
- package/lib/packlets/bundle/convert.d.ts.map +1 -0
- package/lib/packlets/bundle/convert.js +78 -0
- package/lib/packlets/bundle/convert.js.map +1 -0
- package/lib/packlets/bundle/index.d.ts +19 -0
- package/lib/packlets/bundle/index.d.ts.map +1 -0
- package/lib/packlets/bundle/index.js +72 -0
- package/lib/packlets/bundle/index.js.map +1 -0
- package/lib/packlets/bundle/model.d.ts +100 -0
- package/lib/packlets/bundle/model.d.ts.map +1 -0
- package/lib/packlets/bundle/model.js +24 -0
- package/lib/packlets/bundle/model.js.map +1 -0
- package/lib/packlets/resources/resourceManagerBuilder.d.ts +15 -1
- package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +1 -1
- package/lib/packlets/resources/resourceManagerBuilder.js +31 -0
- package/lib/packlets/resources/resourceManagerBuilder.js.map +1 -1
- package/package.json +12 -12
|
@@ -0,0 +1,142 @@
|
|
|
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.BundleNormalizer = void 0;
|
|
25
|
+
const ts_utils_1 = require("@fgv/ts-utils");
|
|
26
|
+
const resources_1 = require("../resources");
|
|
27
|
+
const resources_2 = require("../resources");
|
|
28
|
+
const conditions_1 = require("../conditions");
|
|
29
|
+
/**
|
|
30
|
+
* Normalizes ResourceManagerBuilder instances to ensure consistent ordering
|
|
31
|
+
* of internal entities, enabling order-independent bundle checksums.
|
|
32
|
+
*
|
|
33
|
+
* The normalization process rebuilds the ResourceManagerBuilder from the ground up
|
|
34
|
+
* in a canonical order to ensure identical index assignments regardless of
|
|
35
|
+
* original construction order.
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
class BundleNormalizer {
|
|
39
|
+
/**
|
|
40
|
+
* Creates a normalized ResourceManagerBuilder from an existing builder.
|
|
41
|
+
* The normalized builder will have identical entities but arranged in
|
|
42
|
+
* canonical order to ensure consistent index assignments.
|
|
43
|
+
*
|
|
44
|
+
* @param originalBuilder - The ResourceManagerBuilder to normalize
|
|
45
|
+
* @param systemConfig - The SystemConfiguration used to create the original builder
|
|
46
|
+
* @returns Success with the normalized ResourceManagerBuilder if successful, Failure otherwise
|
|
47
|
+
*/
|
|
48
|
+
static normalize(originalBuilder, systemConfig) {
|
|
49
|
+
// Create a fresh builder using the same system configuration
|
|
50
|
+
return resources_1.ResourceManagerBuilder.create({
|
|
51
|
+
qualifiers: systemConfig.qualifiers,
|
|
52
|
+
resourceTypes: systemConfig.resourceTypes
|
|
53
|
+
}).onSuccess((normalizedBuilder) => {
|
|
54
|
+
return BundleNormalizer._addNormalizedResources(originalBuilder, normalizedBuilder).onSuccess(() => (0, ts_utils_1.succeed)(normalizedBuilder));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Creates a normalized ResourceManagerBuilder using a predefined system configuration.
|
|
59
|
+
* This is a convenience method for the common case of using predefined configurations.
|
|
60
|
+
*
|
|
61
|
+
* @param originalBuilder - The ResourceManagerBuilder to normalize
|
|
62
|
+
* @param configName - The name of the predefined system configuration used
|
|
63
|
+
* @returns Success with the normalized ResourceManagerBuilder if successful, Failure otherwise
|
|
64
|
+
*/
|
|
65
|
+
static normalizeFromPredefined(originalBuilder, configName) {
|
|
66
|
+
return resources_1.ResourceManagerBuilder.createPredefined(configName).onSuccess((normalizedBuilder) => {
|
|
67
|
+
return BundleNormalizer._addNormalizedResources(originalBuilder, normalizedBuilder).onSuccess(() => (0, ts_utils_1.succeed)(normalizedBuilder));
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Normalizes all conditions from the original builder by adding them to the
|
|
72
|
+
* normalized builder in sorted order using loose condition declarations.
|
|
73
|
+
*
|
|
74
|
+
* @param originalBuilder - The source ResourceManagerBuilder
|
|
75
|
+
* @param normalizedBuilder - The target normalized ResourceManagerBuilder
|
|
76
|
+
* @returns Success if all conditions were normalized successfully, Failure otherwise
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
static _normalizeConditions(originalBuilder, normalizedBuilder) {
|
|
80
|
+
const conditions = Array.from(originalBuilder.conditions.values()).sort(conditions_1.Condition.compare);
|
|
81
|
+
const errors = new ts_utils_1.MessageAggregator();
|
|
82
|
+
for (const condition of conditions) {
|
|
83
|
+
const looseDecl = condition.toLooseConditionDecl();
|
|
84
|
+
normalizedBuilder.addCondition(looseDecl).aggregateError(errors);
|
|
85
|
+
}
|
|
86
|
+
return errors.returnOrReport((0, ts_utils_1.succeed)(true));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Normalizes all condition sets from the original builder by adding them to the
|
|
90
|
+
* normalized builder in sorted order using loose condition set declarations.
|
|
91
|
+
*
|
|
92
|
+
* @param originalBuilder - The source ResourceManagerBuilder
|
|
93
|
+
* @param normalizedBuilder - The target normalized ResourceManagerBuilder
|
|
94
|
+
* @returns Success if all condition sets were normalized successfully, Failure otherwise
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
static _normalizeConditionSets(originalBuilder, normalizedBuilder) {
|
|
98
|
+
const conditionSets = Array.from(originalBuilder.conditionSets.values()).sort(conditions_1.ConditionSet.compare);
|
|
99
|
+
const errors = new ts_utils_1.MessageAggregator();
|
|
100
|
+
for (const conditionSet of conditionSets) {
|
|
101
|
+
const conditions = conditionSet.toConditionSetArrayDecl();
|
|
102
|
+
normalizedBuilder.addConditionSet(conditions).aggregateError(errors);
|
|
103
|
+
}
|
|
104
|
+
return errors.returnOrReport((0, ts_utils_1.succeed)(true));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Normalizes all candidates by sorting them first by resource ID, then by condition set.
|
|
108
|
+
*
|
|
109
|
+
* @param originalBuilder - The source ResourceManagerBuilder
|
|
110
|
+
* @param normalizedBuilder - The target normalized ResourceManagerBuilder
|
|
111
|
+
* @returns Success if all candidates were normalized successfully, Failure otherwise
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
static _normalizeCandidates(originalBuilder, normalizedBuilder) {
|
|
115
|
+
const candidates = Array.from(originalBuilder.getAllCandidates()).sort((c1, c2) => {
|
|
116
|
+
const idCompare = c1.id.localeCompare(c2.id);
|
|
117
|
+
return idCompare !== 0 ? idCompare : resources_2.ResourceCandidate.compare(c1, c2);
|
|
118
|
+
});
|
|
119
|
+
const errors = new ts_utils_1.MessageAggregator();
|
|
120
|
+
for (const candidate of candidates) {
|
|
121
|
+
const decl = candidate.toLooseResourceCandidateDecl();
|
|
122
|
+
normalizedBuilder.addLooseCandidate(decl).aggregateError(errors);
|
|
123
|
+
}
|
|
124
|
+
return errors.returnOrReport((0, ts_utils_1.succeed)(true));
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Adds normalized resources to the target builder by first normalizing conditions,
|
|
128
|
+
* then condition sets, then candidates.
|
|
129
|
+
*
|
|
130
|
+
* @param originalBuilder - The source ResourceManagerBuilder
|
|
131
|
+
* @param normalizedBuilder - The target normalized ResourceManagerBuilder
|
|
132
|
+
* @returns Success if all resources were added successfully, Failure otherwise
|
|
133
|
+
* @internal
|
|
134
|
+
*/
|
|
135
|
+
static _addNormalizedResources(originalBuilder, normalizedBuilder) {
|
|
136
|
+
return BundleNormalizer._normalizeConditions(originalBuilder, normalizedBuilder)
|
|
137
|
+
.onSuccess(() => BundleNormalizer._normalizeConditionSets(originalBuilder, normalizedBuilder))
|
|
138
|
+
.onSuccess(() => BundleNormalizer._normalizeCandidates(originalBuilder, normalizedBuilder));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.BundleNormalizer = BundleNormalizer;
|
|
142
|
+
//# sourceMappingURL=bundleNormalizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundleNormalizer.js","sourceRoot":"","sources":["../../../src/packlets/bundle/bundleNormalizer.ts"],"names":[],"mappings":"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","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Result, succeed, MessageAggregator } from '@fgv/ts-utils';\nimport { ResourceManagerBuilder } from '../resources';\nimport { ResourceCandidate } from '../resources';\nimport { SystemConfiguration, PredefinedSystemConfiguration } from '../config';\nimport { Condition, ConditionSet } from '../conditions';\n\n/**\n * Normalizes ResourceManagerBuilder instances to ensure consistent ordering\n * of internal entities, enabling order-independent bundle checksums.\n *\n * The normalization process rebuilds the ResourceManagerBuilder from the ground up\n * in a canonical order to ensure identical index assignments regardless of\n * original construction order.\n * @public\n */\nexport class BundleNormalizer {\n /**\n * Creates a normalized ResourceManagerBuilder from an existing builder.\n * The normalized builder will have identical entities but arranged in\n * canonical order to ensure consistent index assignments.\n *\n * @param originalBuilder - The ResourceManagerBuilder to normalize\n * @param systemConfig - The SystemConfiguration used to create the original builder\n * @returns Success with the normalized ResourceManagerBuilder if successful, Failure otherwise\n */\n public static normalize(\n originalBuilder: ResourceManagerBuilder,\n systemConfig: SystemConfiguration\n ): Result<ResourceManagerBuilder> {\n // Create a fresh builder using the same system configuration\n return ResourceManagerBuilder.create({\n qualifiers: systemConfig.qualifiers,\n resourceTypes: systemConfig.resourceTypes\n }).onSuccess((normalizedBuilder) => {\n return BundleNormalizer._addNormalizedResources(originalBuilder, normalizedBuilder).onSuccess(() =>\n succeed(normalizedBuilder)\n );\n });\n }\n\n /**\n * Creates a normalized ResourceManagerBuilder using a predefined system configuration.\n * This is a convenience method for the common case of using predefined configurations.\n *\n * @param originalBuilder - The ResourceManagerBuilder to normalize\n * @param configName - The name of the predefined system configuration used\n * @returns Success with the normalized ResourceManagerBuilder if successful, Failure otherwise\n */\n public static normalizeFromPredefined(\n originalBuilder: ResourceManagerBuilder,\n configName: PredefinedSystemConfiguration\n ): Result<ResourceManagerBuilder> {\n return ResourceManagerBuilder.createPredefined(configName).onSuccess((normalizedBuilder) => {\n return BundleNormalizer._addNormalizedResources(originalBuilder, normalizedBuilder).onSuccess(() =>\n succeed(normalizedBuilder)\n );\n });\n }\n\n /**\n * Normalizes all conditions from the original builder by adding them to the\n * normalized builder in sorted order using loose condition declarations.\n *\n * @param originalBuilder - The source ResourceManagerBuilder\n * @param normalizedBuilder - The target normalized ResourceManagerBuilder\n * @returns Success if all conditions were normalized successfully, Failure otherwise\n * @internal\n */\n private static _normalizeConditions(\n originalBuilder: ResourceManagerBuilder,\n normalizedBuilder: ResourceManagerBuilder\n ): Result<boolean> {\n const conditions = Array.from(originalBuilder.conditions.values()).sort(Condition.compare);\n\n const errors = new MessageAggregator();\n for (const condition of conditions) {\n const looseDecl = condition.toLooseConditionDecl();\n normalizedBuilder.addCondition(looseDecl).aggregateError(errors);\n }\n\n return errors.returnOrReport(succeed(true));\n }\n\n /**\n * Normalizes all condition sets from the original builder by adding them to the\n * normalized builder in sorted order using loose condition set declarations.\n *\n * @param originalBuilder - The source ResourceManagerBuilder\n * @param normalizedBuilder - The target normalized ResourceManagerBuilder\n * @returns Success if all condition sets were normalized successfully, Failure otherwise\n * @internal\n */\n private static _normalizeConditionSets(\n originalBuilder: ResourceManagerBuilder,\n normalizedBuilder: ResourceManagerBuilder\n ): Result<boolean> {\n const conditionSets = Array.from(originalBuilder.conditionSets.values()).sort(ConditionSet.compare);\n\n const errors = new MessageAggregator();\n for (const conditionSet of conditionSets) {\n const conditions = conditionSet.toConditionSetArrayDecl();\n normalizedBuilder.addConditionSet(conditions).aggregateError(errors);\n }\n\n return errors.returnOrReport(succeed(true));\n }\n\n /**\n * Normalizes all candidates by sorting them first by resource ID, then by condition set.\n *\n * @param originalBuilder - The source ResourceManagerBuilder\n * @param normalizedBuilder - The target normalized ResourceManagerBuilder\n * @returns Success if all candidates were normalized successfully, Failure otherwise\n * @internal\n */\n private static _normalizeCandidates(\n originalBuilder: ResourceManagerBuilder,\n normalizedBuilder: ResourceManagerBuilder\n ): Result<boolean> {\n const candidates = Array.from(originalBuilder.getAllCandidates()).sort((c1, c2) => {\n const idCompare = c1.id.localeCompare(c2.id);\n return idCompare !== 0 ? idCompare : ResourceCandidate.compare(c1, c2);\n });\n\n const errors = new MessageAggregator();\n for (const candidate of candidates) {\n const decl = candidate.toLooseResourceCandidateDecl();\n normalizedBuilder.addLooseCandidate(decl).aggregateError(errors);\n }\n\n return errors.returnOrReport(succeed(true));\n }\n\n /**\n * Adds normalized resources to the target builder by first normalizing conditions,\n * then condition sets, then candidates.\n *\n * @param originalBuilder - The source ResourceManagerBuilder\n * @param normalizedBuilder - The target normalized ResourceManagerBuilder\n * @returns Success if all resources were added successfully, Failure otherwise\n * @internal\n */\n private static _addNormalizedResources(\n originalBuilder: ResourceManagerBuilder,\n normalizedBuilder: ResourceManagerBuilder\n ): Result<boolean> {\n return BundleNormalizer._normalizeConditions(originalBuilder, normalizedBuilder)\n .onSuccess(() => BundleNormalizer._normalizeConditionSets(originalBuilder, normalizedBuilder))\n .onSuccess(() => BundleNormalizer._normalizeCandidates(originalBuilder, normalizedBuilder));\n }\n}\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Result } from '@fgv/ts-utils';
|
|
2
|
+
import { SystemConfiguration } from '../config';
|
|
3
|
+
import { Compiled as ResourceJsonCompiled } from '../resource-json';
|
|
4
|
+
import { IBundleMetadata } from './model';
|
|
5
|
+
/**
|
|
6
|
+
* Components extracted from a bundle for reuse in different contexts.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export interface IBundleComponents {
|
|
10
|
+
/**
|
|
11
|
+
* The system configuration from the bundle.
|
|
12
|
+
*/
|
|
13
|
+
systemConfiguration: SystemConfiguration;
|
|
14
|
+
/**
|
|
15
|
+
* The compiled resource collection from the bundle.
|
|
16
|
+
*/
|
|
17
|
+
compiledCollection: ResourceJsonCompiled.ICompiledResourceCollection;
|
|
18
|
+
/**
|
|
19
|
+
* The bundle metadata including build information.
|
|
20
|
+
*/
|
|
21
|
+
metadata: IBundleMetadata;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Utility functions for working with resource bundles.
|
|
25
|
+
* Provides reusable logic for bundle detection, parsing, and component extraction.
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export declare class BundleUtils {
|
|
29
|
+
/**
|
|
30
|
+
* Checks if the given object appears to be a bundle file by examining its structure.
|
|
31
|
+
* This is a lightweight check that doesn't perform full validation.
|
|
32
|
+
* @param data - The data to check
|
|
33
|
+
* @returns True if the data appears to be a bundle structure
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
static isBundleFile(data: unknown): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Extracts and validates components from a bundle for reuse.
|
|
39
|
+
* Performs full validation of the bundle structure and creates typed components.
|
|
40
|
+
* @param bundleData - The raw bundle data to extract components from
|
|
41
|
+
* @returns Success with bundle components if valid, Failure with error message otherwise
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
static extractBundleComponents(bundleData: unknown): Result<IBundleComponents>;
|
|
45
|
+
/**
|
|
46
|
+
* Extracts just the metadata from potential bundle data without full validation.
|
|
47
|
+
* Useful for displaying bundle information without processing the entire bundle.
|
|
48
|
+
* @param data - The data to extract metadata from
|
|
49
|
+
* @returns Success with metadata if found and valid, Failure otherwise
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
static extractBundleMetadata(data: unknown): Result<IBundleMetadata>;
|
|
53
|
+
/**
|
|
54
|
+
* Parses bundle data from a JSON string.
|
|
55
|
+
* Convenience method that combines JSON parsing with bundle component extraction.
|
|
56
|
+
* @param jsonString - The JSON string containing bundle data
|
|
57
|
+
* @returns Success with bundle components if valid, Failure with error message otherwise
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
static parseBundleFromJson(jsonString: string): Result<IBundleComponents>;
|
|
61
|
+
/**
|
|
62
|
+
* Checks if a file name suggests it might be a bundle file.
|
|
63
|
+
* This is a heuristic check based on file naming conventions.
|
|
64
|
+
* @param fileName - The file name to check
|
|
65
|
+
* @returns True if the file name suggests a bundle file
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
static isBundleFileName(fileName: string): boolean;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=bundleUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundleUtils.d.ts","sourceRoot":"","sources":["../../../src/packlets/bundle/bundleUtils.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,QAAQ,IAAI,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG1C;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,mBAAmB,EAAE,mBAAmB,CAAC;IAEzC;;OAEG;IACH,kBAAkB,EAAE,oBAAoB,CAAC,2BAA2B,CAAC;IAErE;;OAEG;IACH,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED;;;;GAIG;AACH,qBAAa,WAAW;IACtB;;;;;;OAMG;WACW,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAIlD;;;;;;OAMG;WACW,uBAAuB,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,CAAC,iBAAiB,CAAC;IAwBrF;;;;;;OAMG;WACW,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC;IAW3E;;;;;;OAMG;WACW,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC;IAShF;;;;;;OAMG;WACW,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;CAS1D"}
|
|
@@ -0,0 +1,119 @@
|
|
|
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.BundleUtils = void 0;
|
|
25
|
+
const ts_utils_1 = require("@fgv/ts-utils");
|
|
26
|
+
const config_1 = require("../config");
|
|
27
|
+
const convert_1 = require("./convert");
|
|
28
|
+
/**
|
|
29
|
+
* Utility functions for working with resource bundles.
|
|
30
|
+
* Provides reusable logic for bundle detection, parsing, and component extraction.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
class BundleUtils {
|
|
34
|
+
/**
|
|
35
|
+
* Checks if the given object appears to be a bundle file by examining its structure.
|
|
36
|
+
* This is a lightweight check that doesn't perform full validation.
|
|
37
|
+
* @param data - The data to check
|
|
38
|
+
* @returns True if the data appears to be a bundle structure
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
static isBundleFile(data) {
|
|
42
|
+
return convert_1.bundle.convert(data).isSuccess();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Extracts and validates components from a bundle for reuse.
|
|
46
|
+
* Performs full validation of the bundle structure and creates typed components.
|
|
47
|
+
* @param bundleData - The raw bundle data to extract components from
|
|
48
|
+
* @returns Success with bundle components if valid, Failure with error message otherwise
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
static extractBundleComponents(bundleData) {
|
|
52
|
+
// First validate and convert the bundle
|
|
53
|
+
const bundleResult = convert_1.bundle.convert(bundleData);
|
|
54
|
+
if (bundleResult.isFailure()) {
|
|
55
|
+
return (0, ts_utils_1.fail)(`Invalid bundle structure: ${bundleResult.message}`);
|
|
56
|
+
}
|
|
57
|
+
const bundle = bundleResult.value;
|
|
58
|
+
// Create SystemConfiguration from the bundle config
|
|
59
|
+
const systemConfigResult = config_1.SystemConfiguration.create(bundle.config);
|
|
60
|
+
if (systemConfigResult.isFailure()) {
|
|
61
|
+
return (0, ts_utils_1.fail)(`Invalid system configuration in bundle: ${systemConfigResult.message}`);
|
|
62
|
+
}
|
|
63
|
+
const systemConfiguration = systemConfigResult.value;
|
|
64
|
+
return (0, ts_utils_1.succeed)({
|
|
65
|
+
systemConfiguration,
|
|
66
|
+
compiledCollection: bundle.compiledCollection,
|
|
67
|
+
metadata: bundle.metadata
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Extracts just the metadata from potential bundle data without full validation.
|
|
72
|
+
* Useful for displaying bundle information without processing the entire bundle.
|
|
73
|
+
* @param data - The data to extract metadata from
|
|
74
|
+
* @returns Success with metadata if found and valid, Failure otherwise
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
static extractBundleMetadata(data) {
|
|
78
|
+
return convert_1.bundle
|
|
79
|
+
.convert(data)
|
|
80
|
+
.onSuccess((bundle) => {
|
|
81
|
+
return (0, ts_utils_1.succeed)(bundle.metadata);
|
|
82
|
+
})
|
|
83
|
+
.withErrorFormat((err) => {
|
|
84
|
+
return `Not a bundle file: ${err}`;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Parses bundle data from a JSON string.
|
|
89
|
+
* Convenience method that combines JSON parsing with bundle component extraction.
|
|
90
|
+
* @param jsonString - The JSON string containing bundle data
|
|
91
|
+
* @returns Success with bundle components if valid, Failure with error message otherwise
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
static parseBundleFromJson(jsonString) {
|
|
95
|
+
try {
|
|
96
|
+
const data = JSON.parse(jsonString);
|
|
97
|
+
return BundleUtils.extractBundleComponents(data);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
return (0, ts_utils_1.fail)(`Failed to parse JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Checks if a file name suggests it might be a bundle file.
|
|
105
|
+
* This is a heuristic check based on file naming conventions.
|
|
106
|
+
* @param fileName - The file name to check
|
|
107
|
+
* @returns True if the file name suggests a bundle file
|
|
108
|
+
* @public
|
|
109
|
+
*/
|
|
110
|
+
static isBundleFileName(fileName) {
|
|
111
|
+
const lowerName = fileName.toLowerCase();
|
|
112
|
+
return (lowerName.endsWith('.bundle.json') ||
|
|
113
|
+
lowerName.endsWith('-bundle.json') ||
|
|
114
|
+
lowerName.endsWith('_bundle.json') ||
|
|
115
|
+
(lowerName.includes('bundle') && lowerName.endsWith('.json')));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.BundleUtils = BundleUtils;
|
|
119
|
+
//# sourceMappingURL=bundleUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundleUtils.js","sourceRoot":"","sources":["../../../src/packlets/bundle/bundleUtils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAsD;AACtD,sCAAgD;AAGhD,uCAAsD;AAuBtD;;;;GAIG;AACH,MAAa,WAAW;IACtB;;;;;;OAMG;IACI,MAAM,CAAC,YAAY,CAAC,IAAa;QACtC,OAAO,gBAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IACnD,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,uBAAuB,CAAC,UAAmB;QACvD,wCAAwC;QACxC,MAAM,YAAY,GAAG,gBAAe,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACzD,IAAI,YAAY,CAAC,SAAS,EAAE,EAAE,CAAC;YAC7B,OAAO,IAAA,eAAI,EAAC,6BAA6B,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC;QACnE,CAAC;QAED,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC;QAElC,oDAAoD;QACpD,MAAM,kBAAkB,GAAG,4BAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACrE,IAAI,kBAAkB,CAAC,SAAS,EAAE,EAAE,CAAC;YACnC,OAAO,IAAA,eAAI,EAAC,2CAA2C,kBAAkB,CAAC,OAAO,EAAE,CAAC,CAAC;QACvF,CAAC;QAED,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,KAAK,CAAC;QAErD,OAAO,IAAA,kBAAO,EAAC;YACb,mBAAmB;YACnB,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;YAC7C,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,qBAAqB,CAAC,IAAa;QAC/C,OAAO,gBAAe;aACnB,OAAO,CAAC,IAAI,CAAC;aACb,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE;YACpB,OAAO,IAAA,kBAAO,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC,CAAC;aACD,eAAe,CAAC,CAAC,GAAG,EAAE,EAAE;YACvB,OAAO,sBAAsB,GAAG,EAAE,CAAC;QACrC,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,mBAAmB,CAAC,UAAkB;QAClD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACpC,OAAO,WAAW,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;QACnD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAA,eAAI,EAAC,yBAAyB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACjG,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,gBAAgB,CAAC,QAAgB;QAC7C,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;QACzC,OAAO,CACL,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC;YAClC,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC;YAClC,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC;YAClC,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAC9D,CAAC;IACJ,CAAC;CACF;AA7FD,kCA6FC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Result, succeed, fail } from '@fgv/ts-utils';\nimport { SystemConfiguration } from '../config';\nimport { Compiled as ResourceJsonCompiled } from '../resource-json';\nimport { IBundleMetadata } from './model';\nimport { bundle as bundleConverter } from './convert';\n\n/**\n * Components extracted from a bundle for reuse in different contexts.\n * @public\n */\nexport interface IBundleComponents {\n /**\n * The system configuration from the bundle.\n */\n systemConfiguration: SystemConfiguration;\n\n /**\n * The compiled resource collection from the bundle.\n */\n compiledCollection: ResourceJsonCompiled.ICompiledResourceCollection;\n\n /**\n * The bundle metadata including build information.\n */\n metadata: IBundleMetadata;\n}\n\n/**\n * Utility functions for working with resource bundles.\n * Provides reusable logic for bundle detection, parsing, and component extraction.\n * @public\n */\nexport class BundleUtils {\n /**\n * Checks if the given object appears to be a bundle file by examining its structure.\n * This is a lightweight check that doesn't perform full validation.\n * @param data - The data to check\n * @returns True if the data appears to be a bundle structure\n * @public\n */\n public static isBundleFile(data: unknown): boolean {\n return bundleConverter.convert(data).isSuccess();\n }\n\n /**\n * Extracts and validates components from a bundle for reuse.\n * Performs full validation of the bundle structure and creates typed components.\n * @param bundleData - The raw bundle data to extract components from\n * @returns Success with bundle components if valid, Failure with error message otherwise\n * @public\n */\n public static extractBundleComponents(bundleData: unknown): Result<IBundleComponents> {\n // First validate and convert the bundle\n const bundleResult = bundleConverter.convert(bundleData);\n if (bundleResult.isFailure()) {\n return fail(`Invalid bundle structure: ${bundleResult.message}`);\n }\n\n const bundle = bundleResult.value;\n\n // Create SystemConfiguration from the bundle config\n const systemConfigResult = SystemConfiguration.create(bundle.config);\n if (systemConfigResult.isFailure()) {\n return fail(`Invalid system configuration in bundle: ${systemConfigResult.message}`);\n }\n\n const systemConfiguration = systemConfigResult.value;\n\n return succeed({\n systemConfiguration,\n compiledCollection: bundle.compiledCollection,\n metadata: bundle.metadata\n });\n }\n\n /**\n * Extracts just the metadata from potential bundle data without full validation.\n * Useful for displaying bundle information without processing the entire bundle.\n * @param data - The data to extract metadata from\n * @returns Success with metadata if found and valid, Failure otherwise\n * @public\n */\n public static extractBundleMetadata(data: unknown): Result<IBundleMetadata> {\n return bundleConverter\n .convert(data)\n .onSuccess((bundle) => {\n return succeed(bundle.metadata);\n })\n .withErrorFormat((err) => {\n return `Not a bundle file: ${err}`;\n });\n }\n\n /**\n * Parses bundle data from a JSON string.\n * Convenience method that combines JSON parsing with bundle component extraction.\n * @param jsonString - The JSON string containing bundle data\n * @returns Success with bundle components if valid, Failure with error message otherwise\n * @public\n */\n public static parseBundleFromJson(jsonString: string): Result<IBundleComponents> {\n try {\n const data = JSON.parse(jsonString);\n return BundleUtils.extractBundleComponents(data);\n } catch (error) {\n return fail(`Failed to parse JSON: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n\n /**\n * Checks if a file name suggests it might be a bundle file.\n * This is a heuristic check based on file naming conventions.\n * @param fileName - The file name to check\n * @returns True if the file name suggests a bundle file\n * @public\n */\n public static isBundleFileName(fileName: string): boolean {\n const lowerName = fileName.toLowerCase();\n return (\n lowerName.endsWith('.bundle.json') ||\n lowerName.endsWith('-bundle.json') ||\n lowerName.endsWith('_bundle.json') ||\n (lowerName.includes('bundle') && lowerName.endsWith('.json'))\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Converter } from '@fgv/ts-utils';
|
|
2
|
+
import { IBundleMetadata, IBundleExportMetadata, IBundle, IBundleCreateParams } from './model';
|
|
3
|
+
/**
|
|
4
|
+
* `Converter` for a {@link Bundle.IBundleMetadata | bundle metadata} object.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare const bundleMetadata: Converter<IBundleMetadata>;
|
|
8
|
+
/**
|
|
9
|
+
* `Converter` for {@link Bundle.IBundleExportMetadata | bundle export metadata}.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare const bundleExportMetadata: Converter<IBundleExportMetadata>;
|
|
13
|
+
/**
|
|
14
|
+
* `Converter` for a {@link Bundle.IBundle | bundle} object.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare const bundle: Converter<IBundle>;
|
|
18
|
+
/**
|
|
19
|
+
* `Converter` for {@link Bundle.IBundleCreateParams | bundle creation parameters}.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare const bundleCreateParams: Converter<IBundleCreateParams>;
|
|
23
|
+
/**
|
|
24
|
+
* Lightweight converter for bundle structure validation without full processing.
|
|
25
|
+
* Useful for detecting bundle files without the overhead of full validation.
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export declare const bundleStructure: Converter<{
|
|
29
|
+
metadata: IBundleMetadata;
|
|
30
|
+
config: unknown;
|
|
31
|
+
compiledCollection: unknown;
|
|
32
|
+
}>;
|
|
33
|
+
//# sourceMappingURL=convert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../src/packlets/bundle/convert.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,SAAS,EAAc,MAAM,eAAe,CAAC;AAItD,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE/F;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,CAAC,eAAe,CAKpD,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,CAAC,qBAAqB,CAM9D,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,SAAS,CAAC,OAAO,CAKpC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,CAAC,mBAAmB,CAK1D,CAAC;AAEL;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC;IACtC,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAIC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
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.bundleStructure = exports.bundleCreateParams = exports.bundle = exports.bundleExportMetadata = exports.bundleMetadata = void 0;
|
|
25
|
+
const ts_utils_1 = require("@fgv/ts-utils");
|
|
26
|
+
const ts_json_base_1 = require("@fgv/ts-json-base");
|
|
27
|
+
const config_1 = require("../config");
|
|
28
|
+
const resource_json_1 = require("../resource-json");
|
|
29
|
+
/**
|
|
30
|
+
* `Converter` for a {@link Bundle.IBundleMetadata | bundle metadata} object.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
exports.bundleMetadata = ts_utils_1.Converters.strictObject({
|
|
34
|
+
dateBuilt: ts_utils_1.Converters.string,
|
|
35
|
+
checksum: ts_utils_1.Converters.string,
|
|
36
|
+
version: ts_utils_1.Converters.string.optional(),
|
|
37
|
+
description: ts_utils_1.Converters.string.optional()
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* `Converter` for {@link Bundle.IBundleExportMetadata | bundle export metadata}.
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
exports.bundleExportMetadata = ts_utils_1.Converters.strictObject({
|
|
44
|
+
exportedAt: ts_utils_1.Converters.string,
|
|
45
|
+
exportedFrom: ts_utils_1.Converters.string,
|
|
46
|
+
type: ts_utils_1.Converters.string,
|
|
47
|
+
filterContext: ts_json_base_1.Converters.jsonObject.optional()
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* `Converter` for a {@link Bundle.IBundle | bundle} object.
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
exports.bundle = ts_utils_1.Converters.strictObject({
|
|
54
|
+
metadata: exports.bundleMetadata,
|
|
55
|
+
config: config_1.Convert.systemConfiguration,
|
|
56
|
+
compiledCollection: resource_json_1.Compiled.Convert.compiledResourceCollection,
|
|
57
|
+
exportMetadata: exports.bundleExportMetadata.optional()
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* `Converter` for {@link Bundle.IBundleCreateParams | bundle creation parameters}.
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
exports.bundleCreateParams = ts_utils_1.Converters.strictObject({
|
|
64
|
+
version: ts_utils_1.Converters.string.optional(),
|
|
65
|
+
description: ts_utils_1.Converters.string.optional(),
|
|
66
|
+
dateBuilt: ts_utils_1.Converters.string.optional()
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* Lightweight converter for bundle structure validation without full processing.
|
|
70
|
+
* Useful for detecting bundle files without the overhead of full validation.
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
exports.bundleStructure = ts_utils_1.Converters.strictObject({
|
|
74
|
+
metadata: exports.bundleMetadata,
|
|
75
|
+
config: ts_json_base_1.Converters.jsonValue,
|
|
76
|
+
compiledCollection: ts_json_base_1.Converters.jsonValue
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=convert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../../src/packlets/bundle/convert.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAAsD;AACtD,oDAAiE;AACjE,sCAAqD;AACrD,oDAAoE;AAGpE;;;GAGG;AACU,QAAA,cAAc,GAA+B,qBAAU,CAAC,YAAY,CAAkB;IACjG,SAAS,EAAE,qBAAU,CAAC,MAAM;IAC5B,QAAQ,EAAE,qBAAU,CAAC,MAAM;IAC3B,OAAO,EAAE,qBAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;IACrC,WAAW,EAAE,qBAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC;AAEH;;;GAGG;AACU,QAAA,oBAAoB,GAC/B,qBAAU,CAAC,YAAY,CAAwB;IAC7C,UAAU,EAAE,qBAAU,CAAC,MAAM;IAC7B,YAAY,EAAE,qBAAU,CAAC,MAAM;IAC/B,IAAI,EAAE,qBAAU,CAAC,MAAM;IACvB,aAAa,EAAE,yBAAc,CAAC,UAAU,CAAC,QAAQ,EAAE;CACpD,CAAC,CAAC;AAEL;;;GAGG;AACU,QAAA,MAAM,GAAuB,qBAAU,CAAC,YAAY,CAAU;IACzE,QAAQ,EAAE,sBAAc;IACxB,MAAM,EAAE,gBAAa,CAAC,mBAAmB;IACzC,kBAAkB,EAAE,wBAAoB,CAAC,OAAO,CAAC,0BAA0B;IAC3E,cAAc,EAAE,4BAAoB,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC;AAEH;;;GAGG;AACU,QAAA,kBAAkB,GAC7B,qBAAU,CAAC,YAAY,CAAsB;IAC3C,OAAO,EAAE,qBAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;IACrC,WAAW,EAAE,qBAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;IACzC,SAAS,EAAE,qBAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAEL;;;;GAIG;AACU,QAAA,eAAe,GAIvB,qBAAU,CAAC,YAAY,CAAC;IAC3B,QAAQ,EAAE,sBAAc;IACxB,MAAM,EAAE,yBAAc,CAAC,SAAS;IAChC,kBAAkB,EAAE,yBAAc,CAAC,SAAS;CAC7C,CAAC,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Converter, Converters } from '@fgv/ts-utils';\nimport { Converters as JsonConverters } from '@fgv/ts-json-base';\nimport { Convert as ConfigConvert } from '../config';\nimport { Compiled as ResourceJsonCompiled } from '../resource-json';\nimport { IBundleMetadata, IBundleExportMetadata, IBundle, IBundleCreateParams } from './model';\n\n/**\n * `Converter` for a {@link Bundle.IBundleMetadata | bundle metadata} object.\n * @public\n */\nexport const bundleMetadata: Converter<IBundleMetadata> = Converters.strictObject<IBundleMetadata>({\n dateBuilt: Converters.string,\n checksum: Converters.string,\n version: Converters.string.optional(),\n description: Converters.string.optional()\n});\n\n/**\n * `Converter` for {@link Bundle.IBundleExportMetadata | bundle export metadata}.\n * @public\n */\nexport const bundleExportMetadata: Converter<IBundleExportMetadata> =\n Converters.strictObject<IBundleExportMetadata>({\n exportedAt: Converters.string,\n exportedFrom: Converters.string,\n type: Converters.string,\n filterContext: JsonConverters.jsonObject.optional()\n });\n\n/**\n * `Converter` for a {@link Bundle.IBundle | bundle} object.\n * @public\n */\nexport const bundle: Converter<IBundle> = Converters.strictObject<IBundle>({\n metadata: bundleMetadata,\n config: ConfigConvert.systemConfiguration,\n compiledCollection: ResourceJsonCompiled.Convert.compiledResourceCollection,\n exportMetadata: bundleExportMetadata.optional()\n});\n\n/**\n * `Converter` for {@link Bundle.IBundleCreateParams | bundle creation parameters}.\n * @public\n */\nexport const bundleCreateParams: Converter<IBundleCreateParams> =\n Converters.strictObject<IBundleCreateParams>({\n version: Converters.string.optional(),\n description: Converters.string.optional(),\n dateBuilt: Converters.string.optional()\n });\n\n/**\n * Lightweight converter for bundle structure validation without full processing.\n * Useful for detecting bundle files without the overhead of full validation.\n * @public\n */\nexport const bundleStructure: Converter<{\n metadata: IBundleMetadata;\n config: unknown;\n compiledCollection: unknown;\n}> = Converters.strictObject({\n metadata: bundleMetadata,\n config: JsonConverters.jsonValue,\n compiledCollection: JsonConverters.jsonValue\n});\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundle packlet providing functionality for creating and loading resource bundles.
|
|
3
|
+
*
|
|
4
|
+
* Resource bundles encapsulate compiled resources, configuration, and metadata with
|
|
5
|
+
* integrity verification. They provide a portable way to distribute pre-compiled
|
|
6
|
+
* resource collections.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
export type { IBundleMetadata, IBundleExportMetadata, IBundle, IBundleCreateParams } from './model';
|
|
11
|
+
export { BundleBuilder } from './bundleBuilder';
|
|
12
|
+
export { BundleLoader } from './bundleLoader';
|
|
13
|
+
export type { IBundleLoaderCreateParams } from './bundleLoader';
|
|
14
|
+
export { BundleUtils } from './bundleUtils';
|
|
15
|
+
export type { IBundleComponents } from './bundleUtils';
|
|
16
|
+
export * as Convert from './convert';
|
|
17
|
+
/** @internal */
|
|
18
|
+
export { BundleNormalizer } from './bundleNormalizer';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/bundle/index.ts"],"names":[],"mappings":"AAsBA;;;;;;;;GAQG;AAGH,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGpG,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAGrC,gBAAgB;AAChB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
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.BundleNormalizer = exports.Convert = exports.BundleUtils = exports.BundleLoader = exports.BundleBuilder = void 0;
|
|
58
|
+
// Builder and loader classes
|
|
59
|
+
var bundleBuilder_1 = require("./bundleBuilder");
|
|
60
|
+
Object.defineProperty(exports, "BundleBuilder", { enumerable: true, get: function () { return bundleBuilder_1.BundleBuilder; } });
|
|
61
|
+
var bundleLoader_1 = require("./bundleLoader");
|
|
62
|
+
Object.defineProperty(exports, "BundleLoader", { enumerable: true, get: function () { return bundleLoader_1.BundleLoader; } });
|
|
63
|
+
// Utilities
|
|
64
|
+
var bundleUtils_1 = require("./bundleUtils");
|
|
65
|
+
Object.defineProperty(exports, "BundleUtils", { enumerable: true, get: function () { return bundleUtils_1.BundleUtils; } });
|
|
66
|
+
// Converters
|
|
67
|
+
exports.Convert = __importStar(require("./convert"));
|
|
68
|
+
// Internal utilities (not part of public API)
|
|
69
|
+
/** @internal */
|
|
70
|
+
var bundleNormalizer_1 = require("./bundleNormalizer");
|
|
71
|
+
Object.defineProperty(exports, "BundleNormalizer", { enumerable: true, get: function () { return bundleNormalizer_1.BundleNormalizer; } });
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/bundle/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeH,6BAA6B;AAC7B,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAGrB,YAAY;AACZ,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AAGpB,aAAa;AACb,qDAAqC;AAErC,8CAA8C;AAC9C,gBAAgB;AAChB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * Bundle packlet providing functionality for creating and loading resource bundles.\n *\n * Resource bundles encapsulate compiled resources, configuration, and metadata with\n * integrity verification. They provide a portable way to distribute pre-compiled\n * resource collections.\n *\n * @packageDocumentation\n */\n\n// Model interfaces\nexport type { IBundleMetadata, IBundleExportMetadata, IBundle, IBundleCreateParams } from './model';\n\n// Builder and loader classes\nexport { BundleBuilder } from './bundleBuilder';\nexport { BundleLoader } from './bundleLoader';\nexport type { IBundleLoaderCreateParams } from './bundleLoader';\n\n// Utilities\nexport { BundleUtils } from './bundleUtils';\nexport type { IBundleComponents } from './bundleUtils';\n\n// Converters\nexport * as Convert from './convert';\n\n// Internal utilities (not part of public API)\n/** @internal */\nexport { BundleNormalizer } from './bundleNormalizer';\n"]}
|