@4bitlabs/sci0 6.0.0 → 6.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/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ import { PatternCode } from "./models/pattern-code.js";
9
9
  import { draw_commands_d_exports } from "./models/draw-commands.js";
10
10
  import { DrawCommand } from "./models/draw-command.js";
11
11
  import { resource_id_d_exports } from "./models/resource-id.js";
12
+ import { index_d_exports } from "./matchers/index.js";
12
13
  import { parseAllMappings } from "./parsers/mapping.js";
13
14
  import { parseHeaderFrom, parseHeaderWithPayload } from "./parsers/resource-header.js";
14
15
  import { decompress } from "./parsers/compression.js";
@@ -22,4 +23,4 @@ import { Loop, View } from "./models/view.js";
22
23
  import { parseView } from "./parsers/parse-view.js";
23
24
  import { Pic } from "./models/pic.js";
24
25
  import { parsePic } from "./parsers/parse-pic.js";
25
- export { type Cel, type Cursor, type DrawCodes, type DrawCommand, type draw_commands_d_exports as DrawCommands, DrawMode, type FontFace, type Loop, type ParseCursorOptions, type ParseFontOptions, type PatternCode, type Pic, resource_id_d_exports as Resource, type ResourceHeader, type ResourceMap, type ResourceType, resource_types_d_exports as ResourceTypes, type View, decompress, parseAllMappings, parseCursor, parseFont, parseHeaderFrom, parseHeaderWithPayload, parsePic, parseView };
26
+ export { type Cel, type Cursor, type DrawCodes, type DrawCommand, type draw_commands_d_exports as DrawCommands, DrawMode, type FontFace, type Loop, type ParseCursorOptions, type ParseFontOptions, type PatternCode, type Pic, resource_id_d_exports as Resource, type ResourceHeader, type ResourceMap, index_d_exports as ResourceMatchers, type ResourceType, resource_types_d_exports as ResourceTypes, type View, decompress, parseAllMappings, parseCursor, parseFont, parseHeaderFrom, parseHeaderWithPayload, parsePic, parseView };
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { DrawMode } from "./models/draw-mode.js";
2
2
  import { resource_types_exports } from "./models/resource-types.js";
3
3
  import { resource_id_exports } from "./models/resource-id.js";
4
+ import { matchers_exports } from "./matchers/index.js";
4
5
  import { parseAllMappings } from "./parsers/mapping.js";
5
6
  import { parseHeaderFrom, parseHeaderWithPayload } from "./parsers/resource-header.js";
6
7
  import { decompress } from "./parsers/compression.js";
@@ -8,4 +9,4 @@ import { parseCursor } from "./parsers/parse-cursor.js";
8
9
  import { parseFont } from "./parsers/parse-font.js";
9
10
  import { parseView } from "./parsers/parse-view.js";
10
11
  import { parsePic } from "./parsers/parse-pic.js";
11
- export { DrawMode, resource_id_exports as Resource, resource_types_exports as ResourceTypes, decompress, parseAllMappings, parseCursor, parseFont, parseHeaderFrom, parseHeaderWithPayload, parsePic, parseView };
12
+ export { DrawMode, resource_id_exports as Resource, matchers_exports as ResourceMatchers, resource_types_exports as ResourceTypes, decompress, parseAllMappings, parseCursor, parseFont, parseHeaderFrom, parseHeaderWithPayload, parsePic, parseView };
@@ -0,0 +1,11 @@
1
+ import { ResourceMapPredicate } from "./resource-map-predicate.js";
2
+ import { matchResourceNumber } from "./number-predicate.js";
3
+ import { isCursorPredicate, isFontPredicate, isMemoryPredicate, isPatchPredicate, isPicPredicate, isScriptPredicate, isSoundPredicate, isTextPredicate, isViewPredicate, isVocabPredicate, matchResourceType } from "./type-predicates.js";
4
+ import { joinResourcePredicates } from "./utils.js";
5
+ import { match } from "./type-and-number-predicate.js";
6
+ declare namespace index_d_exports {
7
+ export { ResourceMapPredicate, isCursorPredicate, isFontPredicate, isMemoryPredicate, isPatchPredicate, isPicPredicate, isScriptPredicate, isSoundPredicate, isTextPredicate, isViewPredicate, isVocabPredicate, joinResourcePredicates, match, matchResourceNumber, matchResourceType };
8
+ }
9
+ //#endregion
10
+ export { type ResourceMapPredicate, index_d_exports, isCursorPredicate, isFontPredicate, isMemoryPredicate, isPatchPredicate, isPicPredicate, isScriptPredicate, isSoundPredicate, isTextPredicate, isViewPredicate, isVocabPredicate, joinResourcePredicates, match, matchResourceNumber, matchResourceType };
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/matchers/index.ts"],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ import { matchResourceNumber } from "./number-predicate.js";
3
+ import { isCursorPredicate, isFontPredicate, isMemoryPredicate, isPatchPredicate, isPicPredicate, isScriptPredicate, isSoundPredicate, isTextPredicate, isViewPredicate, isVocabPredicate, matchResourceType } from "./type-predicates.js";
4
+ import { joinResourcePredicates } from "./utils.js";
5
+ import { match } from "./type-and-number-predicate.js";
6
+ //#region src/matchers/index.ts
7
+ var matchers_exports = /* @__PURE__ */ __exportAll({
8
+ isCursorPredicate: () => isCursorPredicate,
9
+ isFontPredicate: () => isFontPredicate,
10
+ isMemoryPredicate: () => isMemoryPredicate,
11
+ isPatchPredicate: () => isPatchPredicate,
12
+ isPicPredicate: () => isPicPredicate,
13
+ isScriptPredicate: () => isScriptPredicate,
14
+ isSoundPredicate: () => isSoundPredicate,
15
+ isTextPredicate: () => isTextPredicate,
16
+ isViewPredicate: () => isViewPredicate,
17
+ isVocabPredicate: () => isVocabPredicate,
18
+ joinResourcePredicates: () => joinResourcePredicates,
19
+ match: () => match,
20
+ matchResourceNumber: () => matchResourceNumber,
21
+ matchResourceType: () => matchResourceType
22
+ });
23
+ //#endregion
24
+ export { isCursorPredicate, isFontPredicate, isMemoryPredicate, isPatchPredicate, isPicPredicate, isScriptPredicate, isSoundPredicate, isTextPredicate, isViewPredicate, isVocabPredicate, joinResourcePredicates, match, matchResourceNumber, matchResourceType, matchers_exports };
25
+
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/matchers/index.ts"],"sourcesContent":["export type { ResourceMapPredicate } from './resource-map-predicate.js';\n\nexport { matchResourceNumber } from './number-predicate.js';\nexport { matchResourceType } from './type-predicates.js';\nexport { joinResourcePredicates } from './utils.js';\n\nexport {\n isViewPredicate,\n isPicPredicate,\n isScriptPredicate,\n isTextPredicate,\n isSoundPredicate,\n isMemoryPredicate,\n isVocabPredicate,\n isFontPredicate,\n isCursorPredicate,\n isPatchPredicate,\n} from './type-predicates.js';\n\nexport { match } from './type-and-number-predicate.js';\n"],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { ResourceMapPredicate } from "./resource-map-predicate.js";
2
+ //#region src/matchers/number-predicate.d.ts
3
+ declare const matchResourceNumber: (...targets: number[]) => ResourceMapPredicate;
4
+ //#endregion
5
+ export { matchResourceNumber };
6
+ //# sourceMappingURL=number-predicate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-predicate.d.ts","names":[],"sources":["../../src/matchers/number-predicate.ts"],"mappings":";;cAIa,yBACP,sBAAoB"}
@@ -0,0 +1,7 @@
1
+ import { getNumber } from "../models/resource-id.js";
2
+ //#region src/matchers/number-predicate.ts
3
+ const matchResourceNumber = (...targets) => (it) => [...targets].some((target) => getNumber(it.id) === target);
4
+ //#endregion
5
+ export { matchResourceNumber };
6
+
7
+ //# sourceMappingURL=number-predicate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-predicate.js","names":[],"sources":["../../src/matchers/number-predicate.ts"],"sourcesContent":["import type { ResourceMap } from '../models/resource-map.js';\nimport { getNumber } from '../models/resource-id.js';\nimport type { ResourceMapPredicate } from './resource-map-predicate.js';\n\nexport const matchResourceNumber =\n (...targets: number[]): ResourceMapPredicate =>\n (it: ResourceMap) =>\n [...targets].some((target) => getNumber(it.id) === target);\n"],"mappings":";;AAIA,MAAa,uBACV,GAAG,aACH,OACC,CAAC,GAAG,OAAO,CAAC,CAAC,MAAM,WAAW,UAAU,GAAG,EAAE,MAAM,MAAM"}
@@ -0,0 +1,6 @@
1
+ import { ResourceMap } from "../models/resource-map.js";
2
+ //#region src/matchers/resource-map-predicate.d.ts
3
+ type ResourceMapPredicate = (it: ResourceMap) => boolean;
4
+ //#endregion
5
+ export { ResourceMapPredicate };
6
+ //# sourceMappingURL=resource-map-predicate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-map-predicate.d.ts","names":[],"sources":["../../src/matchers/resource-map-predicate.ts"],"mappings":";;KAEY,wBAAwB,IAAI"}
@@ -0,0 +1,10 @@
1
+ import { ResourceType } from "../models/resource-type.js";
2
+ import { ResourceMapPredicate } from "./resource-map-predicate.js";
3
+ //#region src/matchers/type-and-number-predicate.d.ts
4
+ declare const match: (criteria?: {
5
+ number?: number | number[];
6
+ type?: ResourceType | ResourceType[];
7
+ }) => ResourceMapPredicate;
8
+ //#endregion
9
+ export { match };
10
+ //# sourceMappingURL=type-and-number-predicate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-and-number-predicate.d.ts","names":[],"sources":["../../src/matchers/type-and-number-predicate.ts"],"mappings":";;;cAMa,QACX;EACE;EACA,OAAO,eAAe;MAEvB"}
@@ -0,0 +1,20 @@
1
+ import { matchResourceNumber } from "./number-predicate.js";
2
+ import { matchResourceType } from "./type-predicates.js";
3
+ import { joinResourcePredicates } from "./utils.js";
4
+ //#region src/matchers/type-and-number-predicate.ts
5
+ const match = (criteria = {}) => {
6
+ const predicates = [];
7
+ if (criteria.number !== void 0) {
8
+ const set = Array.isArray(criteria.number) ? criteria.number : [criteria.number];
9
+ predicates.push(matchResourceNumber(...set));
10
+ }
11
+ if (criteria.type !== void 0) {
12
+ const set = Array.isArray(criteria.type) ? criteria.type : [criteria.type];
13
+ predicates.push(matchResourceType(...set));
14
+ }
15
+ return joinResourcePredicates(...predicates);
16
+ };
17
+ //#endregion
18
+ export { match };
19
+
20
+ //# sourceMappingURL=type-and-number-predicate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-and-number-predicate.js","names":[],"sources":["../../src/matchers/type-and-number-predicate.ts"],"sourcesContent":["import type { ResourceType } from '../models/resource-type.js';\nimport type { ResourceMapPredicate } from './resource-map-predicate.js';\nimport { joinResourcePredicates } from './utils.js';\nimport { matchResourceNumber } from './number-predicate.js';\nimport { matchResourceType } from './type-predicates.js';\n\nexport const match = (\n criteria: {\n number?: number | number[];\n type?: ResourceType | ResourceType[];\n } = {},\n): ResourceMapPredicate => {\n const predicates = [];\n if (criteria.number !== undefined) {\n const set = Array.isArray(criteria.number)\n ? criteria.number\n : [criteria.number];\n predicates.push(matchResourceNumber(...set));\n }\n\n if (criteria.type !== undefined) {\n const set = Array.isArray(criteria.type) ? criteria.type : [criteria.type];\n predicates.push(matchResourceType(...set));\n }\n\n return joinResourcePredicates(...predicates);\n};\n"],"mappings":";;;;AAMA,MAAa,SACX,WAGI,CAAC,MACoB;CACzB,MAAM,aAAa,CAAC;CACpB,IAAI,SAAS,WAAW,KAAA,GAAW;EACjC,MAAM,MAAM,MAAM,QAAQ,SAAS,MAAM,IACrC,SAAS,SACT,CAAC,SAAS,MAAM;EACpB,WAAW,KAAK,oBAAoB,GAAG,GAAG,CAAC;CAC7C;CAEA,IAAI,SAAS,SAAS,KAAA,GAAW;EAC/B,MAAM,MAAM,MAAM,QAAQ,SAAS,IAAI,IAAI,SAAS,OAAO,CAAC,SAAS,IAAI;EACzE,WAAW,KAAK,kBAAkB,GAAG,GAAG,CAAC;CAC3C;CAEA,OAAO,uBAAuB,GAAG,UAAU;AAC7C"}
@@ -0,0 +1,17 @@
1
+ import { ResourceType } from "../models/resource-type.js";
2
+ import { ResourceMapPredicate } from "./resource-map-predicate.js";
3
+ //#region src/matchers/type-predicates.d.ts
4
+ declare const matchResourceType: (...targets: ResourceType[]) => ResourceMapPredicate;
5
+ declare const isViewPredicate: ResourceMapPredicate;
6
+ declare const isPicPredicate: ResourceMapPredicate;
7
+ declare const isScriptPredicate: ResourceMapPredicate;
8
+ declare const isTextPredicate: ResourceMapPredicate;
9
+ declare const isSoundPredicate: ResourceMapPredicate;
10
+ declare const isMemoryPredicate: ResourceMapPredicate;
11
+ declare const isVocabPredicate: ResourceMapPredicate;
12
+ declare const isFontPredicate: ResourceMapPredicate;
13
+ declare const isCursorPredicate: ResourceMapPredicate;
14
+ declare const isPatchPredicate: ResourceMapPredicate;
15
+ //#endregion
16
+ export { isCursorPredicate, isFontPredicate, isMemoryPredicate, isPatchPredicate, isPicPredicate, isScriptPredicate, isSoundPredicate, isTextPredicate, isViewPredicate, isVocabPredicate, matchResourceType };
17
+ //# sourceMappingURL=type-predicates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-predicates.d.ts","names":[],"sources":["../../src/matchers/type-predicates.ts"],"mappings":";;;cAiBa,uBACP,SAAS,mBAAiB;cAInB,iBAAiB;cAGjB,gBAAgB;cAEhB,mBAAmB;cAGnB,iBAAiB;cAGjB,kBAAkB;cAGlB,mBAAmB;cAGnB,kBAAkB;cAGlB,iBAAiB;cAGjB,mBAAmB;cAGnB,kBAAkB"}
@@ -0,0 +1,17 @@
1
+ import { getType } from "../models/resource-id.js";
2
+ //#region src/matchers/type-predicates.ts
3
+ const matchResourceType = (...targets) => (it) => [...targets].some((target) => getType(it.id) === target);
4
+ const isViewPredicate = matchResourceType(0);
5
+ const isPicPredicate = matchResourceType(1);
6
+ const isScriptPredicate = matchResourceType(2);
7
+ const isTextPredicate = matchResourceType(3);
8
+ const isSoundPredicate = matchResourceType(4);
9
+ const isMemoryPredicate = matchResourceType(5);
10
+ const isVocabPredicate = matchResourceType(6);
11
+ const isFontPredicate = matchResourceType(7);
12
+ const isCursorPredicate = matchResourceType(8);
13
+ const isPatchPredicate = matchResourceType(9);
14
+ //#endregion
15
+ export { isCursorPredicate, isFontPredicate, isMemoryPredicate, isPatchPredicate, isPicPredicate, isScriptPredicate, isSoundPredicate, isTextPredicate, isViewPredicate, isVocabPredicate, matchResourceType };
16
+
17
+ //# sourceMappingURL=type-predicates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-predicates.js","names":[],"sources":["../../src/matchers/type-predicates.ts"],"sourcesContent":["import type { ResourceMap } from '../models/resource-map.js';\nimport { getType } from '../models/resource-id.js';\nimport {\n CURSOR_TYPE,\n FONT_TYPE,\n MEMORY_TYPE,\n PATCH_TYPE,\n PIC_TYPE,\n SCRIPT_TYPE,\n SOUND_TYPE,\n TEXT_TYPE,\n VIEW_TYPE,\n VOCAB_TYPE,\n} from '../models/resource-types.js';\nimport type { ResourceType } from '../models/resource-type.js';\nimport type { ResourceMapPredicate } from './resource-map-predicate.js';\n\nexport const matchResourceType =\n (...targets: ResourceType[]): ResourceMapPredicate =>\n (it: ResourceMap) =>\n [...targets].some((target) => getType(it.id) === target);\n\nexport const isViewPredicate: ResourceMapPredicate =\n matchResourceType(VIEW_TYPE);\n\nexport const isPicPredicate: ResourceMapPredicate = matchResourceType(PIC_TYPE);\n\nexport const isScriptPredicate: ResourceMapPredicate =\n matchResourceType(SCRIPT_TYPE);\n\nexport const isTextPredicate: ResourceMapPredicate =\n matchResourceType(TEXT_TYPE);\n\nexport const isSoundPredicate: ResourceMapPredicate =\n matchResourceType(SOUND_TYPE);\n\nexport const isMemoryPredicate: ResourceMapPredicate =\n matchResourceType(MEMORY_TYPE);\n\nexport const isVocabPredicate: ResourceMapPredicate =\n matchResourceType(VOCAB_TYPE);\n\nexport const isFontPredicate: ResourceMapPredicate =\n matchResourceType(FONT_TYPE);\n\nexport const isCursorPredicate: ResourceMapPredicate =\n matchResourceType(CURSOR_TYPE);\n\nexport const isPatchPredicate: ResourceMapPredicate =\n matchResourceType(PATCH_TYPE);\n"],"mappings":";;AAiBA,MAAa,qBACV,GAAG,aACH,OACC,CAAC,GAAG,OAAO,CAAC,CAAC,MAAM,WAAW,QAAQ,GAAG,EAAE,MAAM,MAAM;AAE3D,MAAa,kBACX,kBAAA,CAA2B;AAE7B,MAAa,iBAAuC,kBAAA,CAA0B;AAE9E,MAAa,oBACX,kBAAA,CAA6B;AAE/B,MAAa,kBACX,kBAAA,CAA2B;AAE7B,MAAa,mBACX,kBAAA,CAA4B;AAE9B,MAAa,oBACX,kBAAA,CAA6B;AAE/B,MAAa,mBACX,kBAAA,CAA4B;AAE9B,MAAa,kBACX,kBAAA,CAA2B;AAE7B,MAAa,oBACX,kBAAA,CAA6B;AAE/B,MAAa,mBACX,kBAAA,CAA4B"}
@@ -0,0 +1,6 @@
1
+ import { ResourceMapPredicate } from "./resource-map-predicate.js";
2
+ //#region src/matchers/utils.d.ts
3
+ declare const joinResourcePredicates: (...predicates: ResourceMapPredicate[]) => ResourceMapPredicate;
4
+ //#endregion
5
+ export { joinResourcePredicates };
6
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/matchers/utils.ts"],"mappings":";;cAGa,4BACP,YAAY,2BAAyB"}
@@ -0,0 +1,6 @@
1
+ //#region src/matchers/utils.ts
2
+ const joinResourcePredicates = (...predicates) => (it) => [...predicates].every((fn) => fn(it));
3
+ //#endregion
4
+ export { joinResourcePredicates };
5
+
6
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../src/matchers/utils.ts"],"sourcesContent":["import type { ResourceMapPredicate } from './resource-map-predicate.js';\nimport type { ResourceMap } from '../models/resource-map.js';\n\nexport const joinResourcePredicates =\n (...predicates: ResourceMapPredicate[]): ResourceMapPredicate =>\n (it: ResourceMap) =>\n [...predicates].every((fn) => fn(it));\n"],"mappings":";AAGA,MAAa,0BACV,GAAG,gBACH,OACC,CAAC,GAAG,UAAU,CAAC,CAAC,OAAO,OAAO,GAAG,EAAE,CAAC"}
@@ -4,8 +4,8 @@ declare namespace resource_id_d_exports {
4
4
  }
5
5
  declare const getType: (id: number) => ResourceType;
6
6
  declare const getNumber: (id: number) => number;
7
- declare const getIdStr: (id: number) => string;
8
7
  declare const getTypeStr: (id: number) => string;
8
+ declare const getIdStr: (id: number) => string;
9
9
  //#endregion
10
10
  export { getIdStr, getNumber, getType, getTypeStr, resource_id_d_exports };
11
11
  //# sourceMappingURL=resource-id.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resource-id.d.ts","names":[],"sources":["../../src/models/resource-id.ts"],"mappings":";;;;cAea,UAAW,eAAa;cAGxB,YAAa;cAEb,WAAY;cAGZ,aAAc"}
1
+ {"version":3,"file":"resource-id.d.ts","names":[],"sources":["../../src/models/resource-id.ts"],"mappings":";;;;cAea,UAAW,eAAa;cAGxB,YAAa;cAEb,aAAc;cA4Bd,WAAY"}
@@ -9,7 +9,6 @@ var resource_id_exports = /* @__PURE__ */ __exportAll({
9
9
  });
10
10
  const getType = (id) => id >>> 11;
11
11
  const getNumber = (id) => id & 2047;
12
- const getIdStr = (id) => `(${getTypeStr(id)}:${getNumber(id).toString(10)})`;
13
12
  const getTypeStr = (id) => {
14
13
  const type = getType(id);
15
14
  switch (type) {
@@ -26,6 +25,7 @@ const getTypeStr = (id) => {
26
25
  default: exhaustive("Unsupported resource type", type);
27
26
  }
28
27
  };
28
+ const getIdStr = (id) => `(${getTypeStr(id)}:${getNumber(id).toString(10)})`;
29
29
  //#endregion
30
30
  export { getIdStr, getNumber, getType, getTypeStr, resource_id_exports };
31
31
 
@@ -1 +1 @@
1
- {"version":3,"file":"resource-id.js","names":[],"sources":["../../src/models/resource-id.ts"],"sourcesContent":["import { exhaustive } from '../utils/exhaustive.js';\nimport type { ResourceType } from './resource-type.js';\nimport {\n VIEW_TYPE,\n PIC_TYPE,\n SCRIPT_TYPE,\n TEXT_TYPE,\n SOUND_TYPE,\n MEMORY_TYPE,\n VOCAB_TYPE,\n FONT_TYPE,\n CURSOR_TYPE,\n PATCH_TYPE,\n} from './resource-types.js';\n\nexport const getType = (id: number): ResourceType =>\n (id >>> 11) as ResourceType;\n\nexport const getNumber = (id: number): number => id & 0b111_1111_1111;\n\nexport const getIdStr = (id: number) =>\n `(${getTypeStr(id)}:${getNumber(id).toString(10)})`;\n\nexport const getTypeStr = (id: number): string => {\n const type = getType(id);\n switch (type) {\n case VIEW_TYPE:\n return 'View';\n case PIC_TYPE:\n return 'Pic';\n case SCRIPT_TYPE:\n return 'Script';\n case TEXT_TYPE:\n return 'Text';\n case SOUND_TYPE:\n return 'Sound';\n case MEMORY_TYPE:\n return 'Memory';\n case VOCAB_TYPE:\n return 'Vocab';\n case FONT_TYPE:\n return 'Font';\n case CURSOR_TYPE:\n return 'Cursor';\n case PATCH_TYPE:\n return 'Patch';\n default:\n exhaustive('Unsupported resource type', type);\n }\n};\n"],"mappings":";;;;;;;;;AAeA,MAAa,WAAW,OACrB,OAAO;AAEV,MAAa,aAAa,OAAuB,KAAK;AAEtD,MAAa,YAAY,OACvB,IAAI,WAAW,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC,SAAS,EAAE,EAAE;AAEnD,MAAa,cAAc,OAAuB;CAChD,MAAM,OAAO,QAAQ,EAAE;CACvB,QAAQ,MAAR;EACE,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,SACE,WAAW,6BAA6B,IAAI;CAChD;AACF"}
1
+ {"version":3,"file":"resource-id.js","names":[],"sources":["../../src/models/resource-id.ts"],"sourcesContent":["import { exhaustive } from '../utils/exhaustive.js';\nimport type { ResourceType } from './resource-type.js';\nimport {\n VIEW_TYPE,\n PIC_TYPE,\n SCRIPT_TYPE,\n TEXT_TYPE,\n SOUND_TYPE,\n MEMORY_TYPE,\n VOCAB_TYPE,\n FONT_TYPE,\n CURSOR_TYPE,\n PATCH_TYPE,\n} from './resource-types.js';\n\nexport const getType = (id: number): ResourceType =>\n (id >>> 11) as ResourceType;\n\nexport const getNumber = (id: number): number => id & 0b111_1111_1111;\n\nexport const getTypeStr = (id: number): string => {\n const type = getType(id);\n switch (type) {\n case VIEW_TYPE:\n return 'View';\n case PIC_TYPE:\n return 'Pic';\n case SCRIPT_TYPE:\n return 'Script';\n case TEXT_TYPE:\n return 'Text';\n case SOUND_TYPE:\n return 'Sound';\n case MEMORY_TYPE:\n return 'Memory';\n case VOCAB_TYPE:\n return 'Vocab';\n case FONT_TYPE:\n return 'Font';\n case CURSOR_TYPE:\n return 'Cursor';\n case PATCH_TYPE:\n return 'Patch';\n default:\n exhaustive('Unsupported resource type', type);\n }\n};\n\nexport const getIdStr = (id: number) =>\n `(${getTypeStr(id)}:${getNumber(id).toString(10)})`;\n"],"mappings":";;;;;;;;;AAeA,MAAa,WAAW,OACrB,OAAO;AAEV,MAAa,aAAa,OAAuB,KAAK;AAEtD,MAAa,cAAc,OAAuB;CAChD,MAAM,OAAO,QAAQ,EAAE;CACvB,QAAQ,MAAR;EACE,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,KAAA,GACE,OAAO;EACT,SACE,WAAW,6BAA6B,IAAI;CAChD;AACF;AAEA,MAAa,YAAY,OACvB,IAAI,WAAW,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC,SAAS,EAAE,EAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4bitlabs/sci0",
3
- "version": "6.0.0",
3
+ "version": "6.1.1",
4
4
  "description": "Library for decoding and parsing assets from Sierra On-line's SCI-engine.",
5
5
  "homepage": "https://github.com/32bitkid/sci.js/tree/main/libs/sci0#readme",
6
6
  "bugs": {
@@ -13,8 +13,12 @@
13
13
  "license": "ISC",
14
14
  "author": "J. Holmes <j@holmes.codes>",
15
15
  "type": "module",
16
- "exports": "./dist/index.js",
17
- "types": "./dist/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js"
20
+ }
21
+ },
18
22
  "files": [
19
23
  "./dist/**/*"
20
24
  ],
@@ -22,14 +26,15 @@
22
26
  "build": "tsdown",
23
27
  "clean": "tsc --build --clean",
24
28
  "clean:wipe": "rimraf ./dist",
29
+ "prepublishOnly": "npm run build",
25
30
  "test": "vitest run",
26
31
  "test:dev": "vitest dev"
27
32
  },
28
33
  "dependencies": {
29
- "@4bitlabs/codecs": "^3.0.0",
30
- "@4bitlabs/image": "^5.0.0",
34
+ "@4bitlabs/codecs": "^3.0.1",
35
+ "@4bitlabs/image": "^5.0.1",
31
36
  "@4bitlabs/readers": "^3.0.0",
32
- "@4bitlabs/vec2": "^3.0.0"
37
+ "@4bitlabs/vec2": "^3.0.1"
33
38
  },
34
- "gitHead": "e8b4502e1f5fd42407c8857829e66eb5713a9f84"
39
+ "gitHead": "297c461cf9b826fea7f3dc4bec197fbdda8f2f14"
35
40
  }