@multiplatform.one/utils 10.8.0 → 10.9.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/lib/dev.cjs CHANGED
@@ -181,8 +181,7 @@ function runtimeExports(root, requireFrom) {
181
181
  }
182
182
  const names = /* @__PURE__ */ new Set();
183
183
  for (const match of source.matchAll(/^export\s*\{([^}]*)\}/gm)) for (const clause of match[1].split(",")) {
184
- const words = clause.trim().split(/\s+/);
185
- const name = words[words.length - 1];
184
+ const name = clause.trim().split(/\s+/).at(-1);
186
185
  if (name) names.add(name);
187
186
  }
188
187
  for (const match of source.matchAll(/^export\s+(?:const|let|var|function|class)\s+(\w+)/gm)) names.add(match[1]);
@@ -196,7 +195,7 @@ function importsBinding(file, binding) {
196
195
  } catch {
197
196
  return false;
198
197
  }
199
- return new RegExp(`(?:import|require)[^;]*\\b${binding}\\b[^;]*['"]react-native['"]`, "s").test(source);
198
+ return new RegExp(String.raw`(?:import|require)[^;]*\b${binding}\b[^;]*['"]react-native['"]`, "s").test(source);
200
199
  }
201
200
  /** `src/shims/<name>` from source, `../src/shims/<name>` from the built `lib`, else from the installed package. */
202
201
  function stubFile(name) {
package/lib/dev.mjs CHANGED
@@ -149,8 +149,7 @@ function runtimeExports(root, requireFrom) {
149
149
  }
150
150
  const names = /* @__PURE__ */ new Set();
151
151
  for (const match of source.matchAll(/^export\s*\{([^}]*)\}/gm)) for (const clause of match[1].split(",")) {
152
- const words = clause.trim().split(/\s+/);
153
- const name = words[words.length - 1];
152
+ const name = clause.trim().split(/\s+/).at(-1);
154
153
  if (name) names.add(name);
155
154
  }
156
155
  for (const match of source.matchAll(/^export\s+(?:const|let|var|function|class)\s+(\w+)/gm)) names.add(match[1]);
@@ -164,7 +163,7 @@ function importsBinding(file, binding) {
164
163
  } catch {
165
164
  return false;
166
165
  }
167
- return new RegExp(`(?:import|require)[^;]*\\b${binding}\\b[^;]*['"]react-native['"]`, "s").test(source);
166
+ return new RegExp(String.raw`(?:import|require)[^;]*\b${binding}\b[^;]*['"]react-native['"]`, "s").test(source);
168
167
  }
169
168
  /** `src/shims/<name>` from source, `../src/shims/<name>` from the built `lib`, else from the installed package. */
170
169
  function stubFile(name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/utils",
3
- "version": "10.8.0",
3
+ "version": "10.9.1",
4
4
  "description": "utilities for multiplatform.one",
5
5
  "keywords": [
6
6
  "multiplatform.one",
@@ -167,7 +167,7 @@ function runtimeExports(root: string, requireFrom: NodeRequire): Set<string> | u
167
167
  for (const match of source.matchAll(/^export\s*\{([^}]*)\}/gm)) {
168
168
  for (const clause of match[1]!.split(",")) {
169
169
  const words = clause.trim().split(/\s+/);
170
- const name = words[words.length - 1];
170
+ const name = words.at(-1);
171
171
  if (name) names.add(name);
172
172
  }
173
173
  }
@@ -185,9 +185,10 @@ function importsBinding(file: string, binding: string): boolean {
185
185
  } catch {
186
186
  return false;
187
187
  }
188
- return new RegExp(`(?:import|require)[^;]*\\b${binding}\\b[^;]*['"]react-native['"]`, "s").test(
189
- source,
190
- );
188
+ return new RegExp(
189
+ String.raw`(?:import|require)[^;]*\b${binding}\b[^;]*['"]react-native['"]`,
190
+ "s",
191
+ ).test(source);
191
192
  }
192
193
 
193
194
  /** `src/shims/<name>` from source, `../src/shims/<name>` from the built `lib`, else from the installed package. */