houdini-core 2.0.0-go.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/package.json +24 -0
- package/postInstall.js +117 -0
- package/runtime/cache.ts +5 -0
- package/runtime/client.ts +181 -0
- package/runtime/config.ts +79 -0
- package/runtime/generated.ts +1 -0
- package/runtime/imports/config.ts +3 -0
- package/runtime/imports/pluginConfig.ts +5 -0
- package/runtime/index.ts +38 -0
- package/runtime/package.json +1 -0
- package/runtime/plugins/cache.ts +178 -0
- package/runtime/plugins/fetch.ts +337 -0
- package/runtime/plugins/fetchParams.ts +36 -0
- package/runtime/plugins/fragment.ts +80 -0
- package/runtime/plugins/index.ts +9 -0
- package/runtime/plugins/injectedPlugins.ts +9 -0
- package/runtime/plugins/mutation.ts +98 -0
- package/runtime/plugins/optimisticKeys.ts +455 -0
- package/runtime/plugins/query.ts +93 -0
- package/runtime/plugins/subscription.ts +153 -0
- package/runtime/plugins/throwOnError.ts +44 -0
- package/runtime/plugins/utils/documentPlugins.ts +54 -0
- package/runtime/plugins/utils/index.ts +1 -0
- package/runtime/public/cache.ts +121 -0
- package/runtime/public/index.ts +1 -0
- package/runtime/public/list.ts +164 -0
- package/runtime/public/record.ts +113 -0
- package/runtime/public/types.ts +166 -0
- package/runtime/server/index.ts +1 -0
- package/shim.cjs +64 -0
package/shim.cjs
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
function getBinaryPath() {
|
|
4
|
+
// lookup table for all platforms and binary distribution packages
|
|
5
|
+
const BINARY_DISTRIBUTION_PACKAGES = {
|
|
6
|
+
'linux-x64': 'houdini-core-linux-x64',
|
|
7
|
+
'linux-arm64': 'houdini-core-linux-arm64',
|
|
8
|
+
'win32-x64': 'houdini-core-windows-x64',
|
|
9
|
+
'win32-arm64': 'houdini-core-windows-arm64',
|
|
10
|
+
'darwin-x64': 'houdini-core-darwin-x64',
|
|
11
|
+
'darwin-arm64': 'houdini-core-darwin-arm64',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// windows binaries end with .exe so we need to special case them
|
|
15
|
+
const binaryName = process.platform === 'win32' ? 'houdini-core.exe' : 'houdini-core'
|
|
16
|
+
|
|
17
|
+
// determine package name for this platform
|
|
18
|
+
const platformSpecificPackageName =
|
|
19
|
+
BINARY_DISTRIBUTION_PACKAGES[`${process.platform}-${process.arch}`]
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
// resolving will fail if the optionalDependency was not installed
|
|
23
|
+
return require.resolve(`../${platformSpecificPackageName}/bin/${binaryName}`)
|
|
24
|
+
} catch (e) {
|
|
25
|
+
return require('path').join(__dirname, binaryName)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// instead of execFileSync, use spawn to handle the process more gracefully
|
|
29
|
+
const childProcess = require('child_process').spawn(getBinaryPath(), process.argv.slice(2), {
|
|
30
|
+
stdio: 'inherit',
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
// array of signals we want to handle
|
|
34
|
+
const signals = ['SIGTERM', 'SIGINT', 'SIGQUIT', 'SIGHUP']
|
|
35
|
+
|
|
36
|
+
// handle each signal
|
|
37
|
+
signals.forEach((signal) => {
|
|
38
|
+
process.on(signal, () => {
|
|
39
|
+
if (childProcess) {
|
|
40
|
+
// on windows, we need to use taskkill for proper tree killing
|
|
41
|
+
if (process.platform === 'win32') {
|
|
42
|
+
require('child_process').spawn('taskkill', ['/pid', childProcess.pid, '/f', '/t'])
|
|
43
|
+
} else {
|
|
44
|
+
try {
|
|
45
|
+
childProcess.kill(signal)
|
|
46
|
+
} catch (err) {
|
|
47
|
+
// if the process is already gone, that's fine
|
|
48
|
+
if (err.code !== 'ESRCH') throw err
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
process.exit(0)
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
// handle child process exit
|
|
57
|
+
childProcess.on('exit', (code, signal) => {
|
|
58
|
+
// if the child was terminated due to a signal, exit with the same signal
|
|
59
|
+
if (signal) {
|
|
60
|
+
process.exit(0)
|
|
61
|
+
} else {
|
|
62
|
+
process.exit(code)
|
|
63
|
+
}
|
|
64
|
+
})
|