Skip to content

Commit 0193683

Browse files
committed
Rename 'node' target to 'bare-sidecar'
1 parent 349c483 commit 0193683

11 files changed

Lines changed: 30 additions & 29 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ module.exports = async function start(ipc, ready) {
3030

3131
The `ipc` argument is a duplex byte stream. Anything written to it is delivered to the host, and `'data'` events fire when the host writes back.
3232

33-
Stow it for the `node` target:
33+
Stow it for the `bare-sidecar` target:
3434

3535
```js
3636
const stow = require('bare-stow')
3737

3838
const entry = new URL('file:///app/core.js')
3939
const out = new URL('file:///app/out/index.js')
4040

41-
for await (const artifact of stow(entry, 'node', out)) {
41+
for await (const artifact of stow(entry, 'bare-sidecar', out)) {
4242
console.log(artifact.url.href)
4343
}
4444
```
4545

4646
Or equivalently from the command line:
4747

4848
```console
49-
$ bare-stow --target node --out ./out/index.js ./core.js
49+
$ bare-stow --target bare-sidecar --out ./out/index.js ./core.js
5050
```
5151

5252
This writes the harness to `out` and the bundle alongside it. The harness can then be required from the host and booted with `start()`. The harness awaits the worker's `ready` signal before resolving, so by the time `start()` returns the bundle is up:
@@ -118,7 +118,7 @@ await ipc.ready
118118

119119
Bundle the module graph rooted at `entry` for a `target` runtime and write the resulting artifacts to disk at and alongside `out`. Returns an async generator that yields `{ url }` objects as each artifact is written, allowing callers to observe progress.
120120

121-
`entry` is a `URL` (or `URL`-coercible string) pointing at the entry module. `target` selects the target runtime, given either as a built-in name (one of `'react-native'`, `'pear-runtime'`, or `'node'`) or as a [target provider](#targets-and-rpc-providers) object. It determines the harness format, bundle extension, host triples, and whether assets and addons are linked into the bundle or offloaded as sibling files. `out` is the output `URL` of the harness; the bundle is written next to it with the target's extension.
121+
`entry` is a `URL` (or `URL`-coercible string) pointing at the entry module. `target` selects the target runtime, given either as a built-in name (one of `'react-native'`, `'pear-runtime'`, or `'bare-sidecar'`) or as a [target provider](#targets-and-rpc-providers) object. It determines the harness format, bundle extension, host triples, and whether assets and addons are linked into the bundle or offloaded as sibling files. `out` is the output `URL` of the harness; the bundle is written next to it with the target's extension.
122122

123123
The first artifact yielded is the harness at `out`; the second is the bundle alongside it; any further yields are offloaded assets and native addons when the target supports offloading.
124124

@@ -203,13 +203,13 @@ Stow the module graph rooted at `<entry>`, writing the harness and bundle to the
203203

204204
##### `--target <name>`
205205

206-
The target runtime. One of `react-native`, `pear-runtime`, or `node`. Required.
206+
The target runtime. One of `react-native`, `pear-runtime`, or `bare-sidecar`. Required.
207207

208208
| Target | Format | Extension | Linked | Offload |
209209
| -------------- | ------------ | ------------- | ------ | ------- |
210210
| `react-native` | `bundle.mjs` | `.bundle.mjs` | Yes | No |
211211
| `pear-runtime` | `bundle` | `.bundle` | No | Yes |
212-
| `node` | `bundle` | `.bundle` | No | Yes |
212+
| `bare-sidecar` | `bundle` | `.bundle` | No | Yes |
213213

214214
##### `--client <name>` and `--server <name>`
215215

bin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const cmd = command(
1111
summary(pkg.description),
1212
arg('<entry>', 'The entry point of the module graph'),
1313
flag('--version|-v', 'Print the current version'),
14-
flag('--target <name>', 'The target runtime (react-native, pear-runtime, node)'),
14+
flag('--target <name>', 'The target runtime (react-native, pear-runtime, bare-sidecar)'),
1515
flag('--client <name>', 'The RPC client harness to include (e.g. bare-rpc)'),
1616
flag('--server <name>', 'The RPC server harness to include (e.g. bare-rpc)'),
1717
flag('--base <path>', 'The base path of the bundle'),

index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import URL from 'bare-url'
22

3-
type TargetName = 'react-native' | 'pear-runtime' | 'node'
3+
type TargetName = 'react-native' | 'pear-runtime' | 'bare-sidecar'
44

55
interface TargetContext {
66
bundleSpecifier: string

lib/harness.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const registry = {
22
'react-native': () => require('./harness/react-native'),
33
'pear-runtime': () => require('./harness/pear-runtime'),
4-
node: () => require('./harness/node')
4+
'bare-sidecar': () => require('./harness/bare-sidecar')
55
}
66

77
module.exports = function harness(target, resolve) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
exports.name = 'node'
1+
exports.name = 'bare-sidecar'
22
exports.linked = false
33
exports.offload = true
44
exports.format = 'bundle'

test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ test('stow pear-runtime yields harness + bundle', async (t) => {
4040
t.alike(artifacts, [{ url: out }, { url: new URL('out/index.bundle', base) }])
4141
})
4242

43-
test('stow node yields harness + bundle', async (t) => {
43+
test('stow bare-sidecar yields harness + bundle', async (t) => {
4444
const base = new URL('basic/', fixtures)
4545
const entry = new URL('core.js', base)
4646
const out = new URL('out/index.js', base)
4747

4848
const artifacts = []
4949

50-
for await (const artifact of stow(entry, 'node', out, { base })) {
50+
for await (const artifact of stow(entry, 'bare-sidecar', out, { base })) {
5151
artifacts.push(artifact)
5252
}
5353

@@ -68,7 +68,7 @@ test('stow throws without target', async (t) => {
6868

6969
test('stow throws without out', async (t) => {
7070
await t.exception(async () => {
71-
for await (const _ of stow(new URL('basic/core.js', fixtures), 'node')) {
71+
for await (const _ of stow(new URL('basic/core.js', fixtures), 'bare-sidecar')) {
7272
//
7373
}
7474
}, /'out' is required/)
@@ -81,7 +81,7 @@ test('stow accepts a subset of target hosts', async (t) => {
8181

8282
const artifacts = []
8383

84-
for await (const artifact of stow(entry, 'node', out, {
84+
for await (const artifact of stow(entry, 'bare-sidecar', out, {
8585
base,
8686
hosts: ['darwin-arm64']
8787
})) {
@@ -98,7 +98,7 @@ test('stow reroots offloaded assets resolved outside base', async (t) => {
9898

9999
const artifacts = []
100100

101-
for await (const artifact of stow(entry, 'node', out, { base })) {
101+
for await (const artifact of stow(entry, 'bare-sidecar', out, { base })) {
102102
artifacts.push(artifact)
103103
}
104104

@@ -115,11 +115,11 @@ test('stow throws for host not supported by target', async (t) => {
115115
const out = new URL('out/index.js', base)
116116

117117
await t.exception(async () => {
118-
for await (const _ of stow(entry, 'node', out, {
118+
for await (const _ of stow(entry, 'bare-sidecar', out, {
119119
base,
120120
hosts: ['ios-arm64']
121121
})) {
122122
//
123123
}
124-
}, /Host 'ios-arm64' is not supported by target 'node'/)
124+
}, /Host 'ios-arm64' is not supported by target 'bare-sidecar'/)
125125
})

test/fixtures/harness.snapshot.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = {
3636
}
3737
`
3838

39-
exports['harness node - should match snapshot - 0'] = `const path = require('path')
39+
exports['harness bare-sidecar - should match snapshot - 0'] = `const path = require('path')
4040
const Sidecar = require('bare-sidecar')
4141
const stow = require('bare-stow/host')
4242
@@ -55,7 +55,7 @@ module.exports = {
5555
}
5656
`
5757

58-
exports['harness node with bare-rpc client - should match snapshot - 0'] =
58+
exports['harness bare-sidecar with bare-rpc client - should match snapshot - 0'] =
5959
`const path = require('path')
6060
const Sidecar = require('bare-sidecar')
6161
const stow = require('bare-stow/host')

test/fixtures/shim.snapshot.cjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ try {
104104
}
105105
`
106106

107-
exports['shim node - should match snapshot - 0'] = `import protocol from 'bare-stow/protocol'
107+
exports['shim bare-sidecar - should match snapshot - 0'] =
108+
`import protocol from 'bare-stow/protocol'
108109
109110
const ipc = protocol.attach(Bare.IPC)
110111
@@ -214,7 +215,7 @@ try {
214215
}
215216
`
216217

217-
exports['shim node with bare-rpc server - should match snapshot - 0'] =
218+
exports['shim bare-sidecar with bare-rpc server - should match snapshot - 0'] =
218219
`import protocol from 'bare-stow/protocol'
219220
220221
const ipc = protocol.attach(Bare.IPC)

test/harness.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ test('harness pear-runtime', (t) => {
1616
t.snapshot(generate(target, './core.bundle'))
1717
})
1818

19-
test('harness node', (t) => {
20-
const target = harness('node')
19+
test('harness bare-sidecar', (t) => {
20+
const target = harness('bare-sidecar')
2121

2222
t.is(target.format, 'bundle')
2323
t.snapshot(generate(target, './core.bundle'))
2424
})
2525

26-
test('harness node with bare-rpc client', (t) => {
27-
const target = harness('node')
26+
test('harness bare-sidecar with bare-rpc client', (t) => {
27+
const target = harness('bare-sidecar')
2828

2929
t.snapshot(generate(target, './core.bundle', client(target)))
3030
})
@@ -42,7 +42,7 @@ test('harness pear-runtime with bare-rpc client', (t) => {
4242
})
4343

4444
test('harness accepts a target provider object', (t) => {
45-
const provided = harness('node')
45+
const provided = harness('bare-sidecar')
4646

4747
t.is(harness(provided), provided)
4848
})

test/shim.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test('shim pear-runtime', (t) => {
1313
t.snapshot(shim(new URL(`${root}/app/entry.js`), new URL(`${root}/app/__main__.js`)))
1414
})
1515

16-
test('shim node', (t) => {
16+
test('shim bare-sidecar', (t) => {
1717
t.snapshot(shim(new URL(`${root}/app/entry.js`), new URL(`${root}/app/__main__.js`)))
1818
})
1919

@@ -25,7 +25,7 @@ test('shim react-native with bare-rpc server', (t) => {
2525
)
2626
})
2727

28-
test('shim node with bare-rpc server', (t) => {
28+
test('shim bare-sidecar with bare-rpc server', (t) => {
2929
t.snapshot(
3030
shim(new URL(`${root}/app/entry.js`), new URL(`${root}/app/__main__.js`), {
3131
server: server()

0 commit comments

Comments
 (0)