bare-module-traverse 1.8.3 → 2.0.0

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
@@ -110,15 +110,12 @@ The Bare resolver, which matches the options used by the Bare module system. The
110
110
 
111
111
  ```js
112
112
  options = {
113
- platform: Bare.platform,
114
- arch: Bare.arch,
115
- simulator: false,
116
- host: `${platform}-${arch}${simulator ? '-simulator' : ''}`,
113
+ host,
117
114
  hosts: [host]
118
115
  }
119
116
  ```
120
117
 
121
- For single target traversal it is sufficient to pass `platform`, `arch`, `simulator`, and/or `host`. For multi target traversal pass a list of `hosts` identifiers instead.
118
+ For single target traversal it is sufficient to pass `host`. For multi target traversal pass a list of `hosts` identifiers instead.
122
119
 
123
120
  #### `resolve.node`
124
121
 
@@ -126,15 +123,12 @@ The Node.js resolver, which matches the options used by the Node.js module syste
126
123
 
127
124
  ```js
128
125
  options = {
129
- platform: process.platform,
130
- arch: process.arch,
131
- simulator: false,
132
- host: `${platform}-${arch}${simulator ? '-simulator' : ''}`,
126
+ host,
133
127
  hosts: [host]
134
128
  }
135
129
  ```
136
130
 
137
- For single target traversal it is sufficient to pass `platform`, `arch`, `simulator`, and/or `host`. For multi target traversal pass a list of `hosts` identifiers instead.
131
+ For single target traversal it is sufficient to pass `host`. For multi target traversal pass a list of `hosts` identifiers instead.
138
132
 
139
133
  ### Algorithm
140
134
 
package/index.js CHANGED
@@ -325,9 +325,6 @@ exports.preresolved = function* (url, source, resolutions, artifacts, visited, o
325
325
  }
326
326
 
327
327
  exports.imports = function* (parentURL, source, imports, artifacts, lexer, visited, opts = {}) {
328
- // Handle backwards compatibility with the `target` option
329
- if (opts.target) opts = { ...opts, hosts: opts.target }
330
-
331
328
  const {
332
329
  resolve = exports.resolve.default,
333
330
  builtinProtocol = 'builtin:',
@@ -3,9 +3,6 @@ import { type ResolveOptions, type Resolver } from 'bare-addon-resolve'
3
3
 
4
4
  interface BareResolveOptions extends ResolveOptions {
5
5
  linked?: boolean
6
- platform?: string
7
- arch?: string
8
- simulator?: boolean
9
6
  host?: string
10
7
  hosts?: string[]
11
8
  }
@@ -3,21 +3,7 @@ const resolve = require('../resolve')
3
3
  const runtime = require('../runtime')
4
4
 
5
5
  module.exports = function (entry, parentURL, opts = {}) {
6
- // Handle backwards compatibility with the `target` option
7
- if (opts.target) {
8
- const { target, ...rest } = opts
9
- rest.hosts = target
10
- opts = rest
11
- }
12
-
13
- const {
14
- linked = false,
15
- platform = runtime.platform,
16
- arch = runtime.arch,
17
- simulator = runtime.simulator,
18
- host = `${platform}-${arch}${simulator ? '-simulator' : ''}`,
19
- hosts = [host]
20
- } = opts
6
+ const { linked = false, host = runtime.host, hosts = [host] } = opts
21
7
 
22
8
  let extensions
23
9
  let conditions = hosts.map((host) => ['bare', 'node', ...host.split('-')])
@@ -2,9 +2,6 @@ import { type Import } from 'bare-module-lexer'
2
2
  import { type ResolveOptions, type Resolver } from 'bare-addon-resolve'
3
3
 
4
4
  interface NodeResolveOptions extends ResolveOptions {
5
- platform?: string
6
- arch?: string
7
- simulator?: boolean
8
5
  host?: string
9
6
  hosts?: string[]
10
7
  }
@@ -3,20 +3,7 @@ const resolve = require('../resolve')
3
3
  const runtime = require('../runtime')
4
4
 
5
5
  module.exports = function (entry, parentURL, opts = {}) {
6
- // Handle backwards compatibility with the `target` option
7
- if (opts.target) {
8
- const { target, ...rest } = opts
9
- rest.hosts = target
10
- opts = rest
11
- }
12
-
13
- const {
14
- platform = runtime.platform,
15
- arch = runtime.arch,
16
- simulator = runtime.simulator,
17
- host = `${platform}-${arch}${simulator ? '-simulator' : ''}`,
18
- hosts = [host]
19
- } = opts
6
+ const { host = runtime.host, hosts = [host] } = opts
20
7
 
21
8
  let extensions
22
9
  let conditions
@@ -1,3 +1 @@
1
- exports.platform = Bare.platform
2
- exports.arch = Bare.arch
3
- exports.simulator = Bare.simulator
1
+ exports.host = Bare.Addon.host
@@ -1,3 +1 @@
1
- exports.platform = process.platform
2
- exports.arch = process.arch
3
- exports.simulator = false
1
+ exports.host = `${process.platform}-${process.arch}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-module-traverse",
3
- "version": "1.8.3",
3
+ "version": "2.0.0",
4
4
  "description": "Low-level module graph traversal for Bare",
5
5
  "exports": {
6
6
  ".": {
@@ -25,17 +25,17 @@
25
25
  },
26
26
  "./package": "./package.json"
27
27
  },
28
- "files": [
29
- "index.js",
30
- "index.d.ts",
31
- "lib"
32
- ],
33
28
  "imports": {
34
29
  "#runtime": {
35
30
  "bare": "./lib/runtime/bare.js",
36
31
  "node": "./lib/runtime/node.js"
37
32
  }
38
33
  },
34
+ "files": [
35
+ "index.js",
36
+ "index.d.ts",
37
+ "lib"
38
+ ],
39
39
  "scripts": {
40
40
  "test": "npm run lint && npm run test:bare && npm run test:node",
41
41
  "test:bare": "bare test.js",