@ankhorage/devtools 2.1.5 → 2.1.6

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # @ankhorage/devtools
5
5
 
6
- ![license: MIT](././paradox/badges/license.svg) ![npm: v2.1.5](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v2.1.6](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
7
7
 
8
8
  Shared tooling, repository automation, and agent standards for Ankhorage TypeScript projects
9
9
 
@@ -193,6 +193,8 @@ jobs:
193
193
  const pkg = JSON.parse(readFileSync(join(packageDir, 'package.json'), 'utf8'));
194
194
  const importConditions = new Set(['bun', 'default', 'import', 'node']);
195
195
  const requireConditions = new Set(['default', 'node', 'require']);
196
+ const platformConditions = new Set(['browser', 'react-native']);
197
+ const explicitServerConditions = new Set(['bun', 'node']);
196
198
  const supportsLoader = (target, conditions) => {
197
199
  if (typeof target === 'string') return true;
198
200
  if (Array.isArray(target)) return target.some((value) => supportsLoader(value, conditions));
@@ -202,7 +204,21 @@ jobs:
202
204
  conditions.has(condition) && supportsLoader(value, conditions),
203
205
  );
204
206
  };
207
+ const declaresCondition = (target, conditions) => {
208
+ if (Array.isArray(target)) {
209
+ return target.some((value) => declaresCondition(value, conditions));
210
+ }
211
+ if (!target || typeof target !== 'object') return false;
212
+ return Object.entries(target).some(
213
+ ([condition, value]) =>
214
+ conditions.has(condition) || declaresCondition(value, conditions),
215
+ );
216
+ };
217
+ const isPlatformOnlyRuntimeTarget = (target) =>
218
+ declaresCondition(target, platformConditions) &&
219
+ !declaresCondition(target, explicitServerConditions);
205
220
  const selectLoader = (target) => {
221
+ if (isPlatformOnlyRuntimeTarget(target)) return undefined;
206
222
  if (supportsLoader(target, importConditions)) return 'import';
207
223
  if (supportsLoader(target, requireConditions)) return 'require';
208
224
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/devtools",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "Shared tooling, repository automation, and agent standards for Ankhorage TypeScript projects",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/ankhorage/devtools#readme",