@neon-rs/manifest 0.1.2 → 0.1.3

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/lib/platform.cjs CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.rust2Node = exports.node2Rust = exports.describeTarget = exports.expandPlatformFamily = exports.expandPlatformPreset = exports.assertIsPlatformFamily = exports.assertIsPlatformMap = exports.assertIsPlatformPreset = exports.isPlatformPreset = exports.assertIsNodePlatform = exports.isNodePlatform = exports.assertIsRustTarget = exports.isRustTarget = void 0;
6
+ exports.rust2Node = exports.node2Rust = exports.describeTarget = exports.expandPlatformFamily = exports.expandPlatformPreset = exports.assertIsPlatformFamily = exports.assertIsPlatformMap = exports.assertIsPlatformPreset = exports.assertIsPlatformName = exports.isPlatformPreset = exports.assertIsNodePlatform = exports.isNodePlatform = exports.assertIsRustTarget = exports.isRustTarget = void 0;
7
7
  const rust_json_1 = __importDefault(require("../data/rust.json"));
8
8
  const node_json_1 = __importDefault(require("../data/node.json"));
9
9
  const preset_json_1 = __importDefault(require("../data/preset.json"));
@@ -32,6 +32,12 @@ function isPlatformPreset(x) {
32
32
  return (typeof x === 'string') && (x in preset_json_1.default);
33
33
  }
34
34
  exports.isPlatformPreset = isPlatformPreset;
35
+ function assertIsPlatformName(x) {
36
+ if (!isPlatformPreset(x) && !isNodePlatform(x)) {
37
+ throw new RangeError(`invalid platform name: ${x}`);
38
+ }
39
+ }
40
+ exports.assertIsPlatformName = assertIsPlatformName;
35
41
  function assertIsPlatformPreset(x) {
36
42
  if (!isPlatformPreset(x)) {
37
43
  throw new RangeError(`invalid platform family preset: ${x}`);
@@ -53,12 +59,12 @@ function assertIsPlatformMap(json, path) {
53
59
  exports.assertIsPlatformMap = assertIsPlatformMap;
54
60
  function assertIsPlatformFamily(json, path) {
55
61
  if (typeof json === 'string') {
56
- assertIsPlatformPreset(json);
62
+ assertIsPlatformName(json);
57
63
  return;
58
64
  }
59
65
  if (Array.isArray(json)) {
60
66
  for (const elt of json) {
61
- assertIsPlatformPreset(elt);
67
+ assertIsPlatformName(elt);
62
68
  }
63
69
  return;
64
70
  }
@@ -9,6 +9,8 @@ export declare function isNodePlatform(x: unknown): x is NodePlatform;
9
9
  export declare function assertIsNodePlatform(x: unknown): asserts x is NodePlatform;
10
10
  export type PlatformPreset = keyof (typeof PRESET);
11
11
  export declare function isPlatformPreset(x: unknown): x is PlatformPreset;
12
+ export type PlatformName = NodePlatform | PlatformPreset;
13
+ export declare function assertIsPlatformName(x: unknown): asserts x is PlatformName;
12
14
  export declare function assertIsPlatformPreset(x: unknown): asserts x is PlatformPreset;
13
15
  export declare function assertIsPlatformMap(json: unknown, path: string): asserts json is PlatformMap;
14
16
  export declare function assertIsPlatformFamily(json: unknown, path: string): asserts json is PlatformFamily;
@@ -19,7 +21,6 @@ export type TargetPair = {
19
21
  export type PlatformMap = {
20
22
  [key in NodePlatform]?: RustTarget;
21
23
  };
22
- export type PlatformName = NodePlatform | PlatformPreset;
23
24
  export type PlatformFamily = PlatformName | PlatformName[] | PlatformMap;
24
25
  export declare function expandPlatformPreset(preset: PlatformPreset): PlatformMap;
25
26
  export declare function expandPlatformFamily(family: PlatformFamily): PlatformMap;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@neon-rs/manifest",
3
3
  "private": false,
4
- "version": "0.1.2",
4
+ "version": "0.1.3",
5
5
  "description": "Library for working with Neon package configuration.",
6
6
  "exports": {
7
7
  ".": {