@sigil-dev/plugin-namepool 0.8.2
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 +1 -0
- package/index.ts +17 -0
- package/package.json +14 -0
- package/tsconfig.json +30 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Sigil plugin for having uniueqe instance names
|
package/index.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// packages/grimoire/src/plugins/namepool.ts
|
|
2
|
+
import type {
|
|
3
|
+
GrimoirePlugin,
|
|
4
|
+
WorkerDescriptor,
|
|
5
|
+
WorkerEnv,
|
|
6
|
+
} from "@sigil/grimoire";
|
|
7
|
+
|
|
8
|
+
export function namepool(options: { names: string[] }): GrimoirePlugin {
|
|
9
|
+
return {
|
|
10
|
+
name: "namepool",
|
|
11
|
+
onWorkerSpawn(worker: WorkerDescriptor): WorkerEnv {
|
|
12
|
+
const name =
|
|
13
|
+
options.names[worker.globalIndex] ?? `${worker.mode}-${worker.index}`;
|
|
14
|
+
return { name };
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sigil-dev/plugin-namepool",
|
|
3
|
+
"module": "index.ts",
|
|
4
|
+
"version": "0.8.2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"devDependencies": {
|
|
8
|
+
"@types/bun": "latest"
|
|
9
|
+
},
|
|
10
|
+
"peerDependencies": {
|
|
11
|
+
"typescript": "^5",
|
|
12
|
+
"@sigil-dev/grimoire": "0.8.2"
|
|
13
|
+
}
|
|
14
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Environment setup & latest features
|
|
4
|
+
"lib": ["ESNext"],
|
|
5
|
+
"target": "ESNext",
|
|
6
|
+
"module": "Preserve",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"jsx": "react-jsx",
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"types": ["bun"],
|
|
11
|
+
|
|
12
|
+
// Bundler mode
|
|
13
|
+
"moduleResolution": "bundler",
|
|
14
|
+
"allowImportingTsExtensions": true,
|
|
15
|
+
"verbatimModuleSyntax": true,
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
|
|
18
|
+
// Best practices
|
|
19
|
+
"strict": true,
|
|
20
|
+
"skipLibCheck": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true,
|
|
22
|
+
"noUncheckedIndexedAccess": true,
|
|
23
|
+
"noImplicitOverride": true,
|
|
24
|
+
|
|
25
|
+
// Some stricter flags (disabled by default)
|
|
26
|
+
"noUnusedLocals": false,
|
|
27
|
+
"noUnusedParameters": false,
|
|
28
|
+
"noPropertyAccessFromIndexSignature": false
|
|
29
|
+
}
|
|
30
|
+
}
|