@jpwesselink/playground-core 0.1.0-pr-7.b5def44

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.
Files changed (3) hide show
  1. package/index.d.ts +1 -0
  2. package/index.js +42 -0
  3. package/package.json +38 -0
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function greet(name?: string | undefined | null): string;
package/index.js ADDED
@@ -0,0 +1,42 @@
1
+ const path = require("path");
2
+
3
+ const PLATFORMS = {
4
+ "darwin-arm64": "@jpwesselink/playground-core-darwin-arm64",
5
+ "darwin-x64": "@jpwesselink/playground-core-darwin-x64",
6
+ "linux-x64": "@jpwesselink/playground-core-linux-x64-gnu",
7
+ "linux-arm64": "@jpwesselink/playground-core-linux-arm64-gnu",
8
+ "win32-x64": "@jpwesselink/playground-core-win32-x64-msvc",
9
+ "win32-arm64": "@jpwesselink/playground-core-win32-arm64-msvc",
10
+ };
11
+
12
+ const key = `${process.platform}-${process.arch}`;
13
+ const pkg = PLATFORMS[key];
14
+
15
+ if (!pkg) {
16
+ throw new Error(
17
+ `@jpwesselink/playground-core: unsupported platform ${process.platform}-${process.arch}\n` +
18
+ `Supported: ${Object.keys(PLATFORMS).join(", ")}`
19
+ );
20
+ }
21
+
22
+ let nativeModule;
23
+ try {
24
+ nativeModule = require(pkg);
25
+ } catch {
26
+ try {
27
+ const pkgDir = path.dirname(require.resolve(`${pkg}/package.json`));
28
+ nativeModule = require(path.join(pkgDir, "playground-core.node"));
29
+ } catch {
30
+ try {
31
+ nativeModule = require(path.join(__dirname, "playground-core.node"));
32
+ } catch {
33
+ throw new Error(
34
+ `@jpwesselink/playground-core: could not load native module "${pkg}"\n\n` +
35
+ `This usually means the optional dependency was not installed.\n` +
36
+ `Try reinstalling with: npm install @jpwesselink/playground-core`
37
+ );
38
+ }
39
+ }
40
+ }
41
+
42
+ module.exports = { ...nativeModule };
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@jpwesselink/playground-core",
3
+ "version": "0.1.0-pr-7.b5def44",
4
+ "description": "Native Node.js bindings for release-playground",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "type": "commonjs",
8
+ "napi": {
9
+ "binaryName": "playground-core",
10
+ "targets": [
11
+ "x86_64-apple-darwin",
12
+ "aarch64-apple-darwin",
13
+ "x86_64-unknown-linux-gnu",
14
+ "aarch64-unknown-linux-gnu",
15
+ "x86_64-pc-windows-msvc",
16
+ "aarch64-pc-windows-msvc"
17
+ ]
18
+ },
19
+ "files": [
20
+ "index.js",
21
+ "index.d.ts"
22
+ ],
23
+ "optionalDependencies": {
24
+ "@jpwesselink/playground-core-darwin-arm64": "0.1.0-pr-7.b5def44",
25
+ "@jpwesselink/playground-core-darwin-x64": "0.1.0-pr-7.b5def44",
26
+ "@jpwesselink/playground-core-linux-x64-gnu": "0.1.0-pr-7.b5def44",
27
+ "@jpwesselink/playground-core-linux-arm64-gnu": "0.1.0-pr-7.b5def44",
28
+ "@jpwesselink/playground-core-win32-x64-msvc": "0.1.0-pr-7.b5def44",
29
+ "@jpwesselink/playground-core-win32-arm64-msvc": "0.1.0-pr-7.b5def44"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "license": "MIT",
35
+ "engines": {
36
+ "node": ">=16.0.0"
37
+ }
38
+ }