@neon-rs/cli 0.0.177 → 0.0.178

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.
Files changed (2) hide show
  1. package/index.js +49 -26
  2. package/package.json +8 -8
package/index.js CHANGED
@@ -8,8 +8,8 @@ import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";
8
8
  var __webpack_unused_export__;
9
9
 
10
10
  __webpack_unused_export__ = ({ value: true });
11
- __webpack_unused_export__ = exports.sj = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = void 0;
12
- function currentTarget() {
11
+ __webpack_unused_export__ = exports.sj = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = void 0;
12
+ function currentPlatform() {
13
13
  let os = null;
14
14
  switch (process.platform) {
15
15
  case 'android':
@@ -65,6 +65,11 @@ function currentTarget() {
65
65
  }
66
66
  throw new Error(`Neon: unsupported system: ${process.platform}`);
67
67
  }
68
+ __webpack_unused_export__ = currentPlatform;
69
+ // DEPRECATE(0.1)
70
+ function currentTarget() {
71
+ return currentPlatform();
72
+ }
68
73
  __webpack_unused_export__ = currentTarget;
69
74
  function isGlibc() {
70
75
  // Cast to unknown to work around a bug in the type definition:
@@ -97,25 +102,34 @@ function* interleave(a1, a2) {
97
102
  }
98
103
  }
99
104
  function bin(scope, ...rest) {
100
- return [...interleave(scope, rest)].join("") + "/" + currentTarget();
105
+ return [...interleave(scope, rest)].join("") + "/" + currentPlatform();
101
106
  }
102
107
  __webpack_unused_export__ = bin;
108
+ // DEPRECATE(0.1)
103
109
  function lazyV1(loaders, exports) {
104
110
  return lazyV2({
105
111
  targets: loaders,
106
112
  exports
107
113
  });
108
114
  }
115
+ // DEPRECATE(0.1)
109
116
  function lazyV2(options) {
110
- const loaders = options.targets;
117
+ return lazyV3({
118
+ platforms: options.targets,
119
+ exports: options.exports,
120
+ debug: options.debug
121
+ });
122
+ }
123
+ function lazyV3(options) {
124
+ const loaders = options.platforms;
111
125
  let loaded = null;
112
126
  function load() {
113
127
  if (loaded) {
114
128
  return loaded;
115
129
  }
116
- const target = currentTarget();
117
- if (!loaders.hasOwnProperty(target)) {
118
- throw new Error(`no precompiled module found for ${target}`);
130
+ const platform = currentPlatform();
131
+ if (!loaders.hasOwnProperty(platform)) {
132
+ throw new Error(`no precompiled module found for ${platform}`);
119
133
  }
120
134
  if (options.debug) {
121
135
  try {
@@ -126,7 +140,7 @@ function lazyV2(options) {
126
140
  }
127
141
  }
128
142
  if (!loaded) {
129
- loaded = loaders[target]();
143
+ loaded = loaders[platform]();
130
144
  }
131
145
  return loaded;
132
146
  }
@@ -137,17 +151,19 @@ function lazyV2(options) {
137
151
  return module;
138
152
  }
139
153
  function lazy(optionsOrLoaders, exports) {
140
- return exports
141
- ? lazyV1(optionsOrLoaders, exports)
142
- : lazyV2(optionsOrLoaders);
154
+ return (!exports && !('targets' in optionsOrLoaders))
155
+ ? lazyV3(optionsOrLoaders)
156
+ : !exports
157
+ ? lazyV2(optionsOrLoaders)
158
+ : lazyV1(optionsOrLoaders, exports);
143
159
  }
144
160
  __webpack_unused_export__ = lazy;
145
161
  function __UNSTABLE_loader(loaders) {
146
- const target = currentTarget();
147
- if (!loaders.hasOwnProperty(target)) {
148
- throw new Error(`no precompiled module found for ${target}`);
162
+ const platform = currentPlatform();
163
+ if (!loaders.hasOwnProperty(platform)) {
164
+ throw new Error(`no precompiled module found for ${platform}`);
149
165
  }
150
- const loader = loaders[target];
166
+ const loader = loaders[platform];
151
167
  let loaded = null;
152
168
  return () => {
153
169
  if (loaded) {
@@ -158,19 +174,25 @@ function __UNSTABLE_loader(loaders) {
158
174
  };
159
175
  }
160
176
  __webpack_unused_export__ = __UNSTABLE_loader;
161
- function isTargetTable(options) {
162
- return !('targets' in options);
177
+ // DEPRECATE(0.1)
178
+ function isDeprecatedProxyOptions(options) {
179
+ return 'targets' in options;
180
+ }
181
+ function isProxyOptions(options) {
182
+ return 'platforms' in options;
163
183
  }
164
184
  function proxy(options) {
165
- if (isTargetTable(options)) {
166
- options = { targets: options };
167
- }
168
- const target = currentTarget();
169
- const loaders = options.targets;
170
- if (!loaders.hasOwnProperty(target)) {
171
- throw new Error(`no precompiled module found for ${target}`);
172
- }
173
- const loader = loaders[target];
185
+ const opts = isProxyOptions(options)
186
+ ? options
187
+ : !isDeprecatedProxyOptions(options)
188
+ ? { platforms: options }
189
+ : { platforms: options.targets, debug: options.debug };
190
+ const platform = currentPlatform();
191
+ const loaders = opts.platforms;
192
+ if (!loaders.hasOwnProperty(platform)) {
193
+ throw new Error(`no precompiled module found for ${platform}`);
194
+ }
195
+ const loader = loaders[platform];
174
196
  let loaded = null;
175
197
  function load() {
176
198
  if (!loaded) {
@@ -226,6 +248,7 @@ function proxy(options) {
226
248
  return new Proxy({}, handler);
227
249
  }
228
250
  exports.sj = proxy;
251
+ // DEPRECATE(0.1)
229
252
  function __UNSTABLE_proxy(options) {
230
253
  return proxy(options);
231
254
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neon-rs/cli",
3
- "version": "0.0.177",
3
+ "version": "0.0.178",
4
4
  "description": "Command-line build tool for Neon modules.",
5
5
  "type": "module",
6
6
  "exports": "./index.js",
@@ -27,12 +27,12 @@
27
27
  },
28
28
  "homepage": "https://github.com/dherman/neon-rs#readme",
29
29
  "optionalDependencies": {
30
- "@cargo-messages/android-arm-eabi": "0.0.177",
31
- "@cargo-messages/darwin-arm64": "0.0.177",
32
- "@cargo-messages/darwin-x64": "0.0.177",
33
- "@cargo-messages/linux-arm-gnueabihf": "0.0.177",
34
- "@cargo-messages/linux-x64-gnu": "0.0.177",
35
- "@cargo-messages/win32-arm64-msvc": "0.0.177",
36
- "@cargo-messages/win32-x64-msvc": "0.0.177"
30
+ "@cargo-messages/android-arm-eabi": "0.0.178",
31
+ "@cargo-messages/darwin-arm64": "0.0.178",
32
+ "@cargo-messages/darwin-x64": "0.0.178",
33
+ "@cargo-messages/linux-arm-gnueabihf": "0.0.178",
34
+ "@cargo-messages/linux-x64-gnu": "0.0.178",
35
+ "@cargo-messages/win32-arm64-msvc": "0.0.178",
36
+ "@cargo-messages/win32-x64-msvc": "0.0.178"
37
37
  }
38
38
  }