@mbsks/rspfx-manifest-server 0.0.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 RSPFX contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # @mbsks/rspfx-manifest-server
2
+
3
+ Development certificates for [RSPFX](https://github.com/master8848/rspfx) — an SPFx-compatible build toolchain powered by Rspack.
4
+
5
+ Generates and caches the self-signed TLS key/cert pair used by the local HTTPS dev server (the compiler-rspack dev server; serving itself is handled there, not here). Certificates live in `~/.rspfx/certs` and are reused across runs.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm i @mbsks/rspfx-manifest-server
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { ensureCertificates } from '@mbsks/rspfx-manifest-server';
17
+
18
+ const { key, cert } = await ensureCertificates('.rspfx/certs');
19
+ ```
20
+
21
+ ## API
22
+
23
+ - `ensureCertificates(dir)` — generate/load self-signed key + cert (writes `key.pem`, `cert.pem`, and `cert.pem.trust.txt` with trust instructions)
24
+
25
+ ## Links
26
+
27
+ - [RSPFX documentation](https://github.com/master8848/rspfx/tree/main/docs)
28
+ - License: MIT
@@ -0,0 +1,5 @@
1
+ export declare function ensureCertificates(certsDir: string): Promise<{
2
+ key: string;
3
+ cert: string;
4
+ }>;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsDA,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAqCjG"}
package/dist/index.js ADDED
@@ -0,0 +1,55 @@
1
+ import { readFile, mkdir, writeFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { createRequire } from 'node:module';
4
+ import { createLogger } from '@mbsks/rspfx-diagnostics';
5
+ const TRUST_NOTES = [
6
+ 'RSPFX development certificate (self-signed, 825 days)',
7
+ '',
8
+ 'key.pem / cert.pem are used by the local HTTPS dev server for localhost and 127.0.0.1.',
9
+ '',
10
+ 'To make browsers and SharePoint trust this certificate, import cert.pem into the',
11
+ 'trusted root store of your OS or browser, then restart the browser:',
12
+ '',
13
+ ' macOS: sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain cert.pem',
14
+ ' Windows: certutil -addstore -user Root cert.pem',
15
+ ' Linux: import cert.pem into the browser or system trust store',
16
+ ''
17
+ ].join('\n');
18
+ const require = createRequire(import.meta.url);
19
+ const selfsigned = require('selfsigned');
20
+ const logger = createLogger('rspfx');
21
+ export async function ensureCertificates(certsDir) {
22
+ const keyPath = path.join(certsDir, 'key.pem');
23
+ const certPath = path.join(certsDir, 'cert.pem');
24
+ try {
25
+ const [key, cert] = await Promise.all([readFile(keyPath, 'utf8'), readFile(certPath, 'utf8')]);
26
+ return { key, cert };
27
+ }
28
+ catch {
29
+ // fall through to generation
30
+ }
31
+ await mkdir(certsDir, { recursive: true });
32
+ const pems = selfsigned.generate([{ name: 'commonName', value: 'localhost' }], {
33
+ keySize: 2048,
34
+ days: 825,
35
+ algorithm: 'sha256',
36
+ extensions: [
37
+ { name: 'extKeyUsage', serverAuth: true },
38
+ {
39
+ name: 'subjectAltName',
40
+ altNames: [
41
+ { type: 2, value: 'localhost' },
42
+ { type: 7, ip: '127.0.0.1' }
43
+ ]
44
+ }
45
+ ]
46
+ });
47
+ await Promise.all([
48
+ writeFile(keyPath, pems.private, { mode: 0o600 }),
49
+ writeFile(certPath, pems.cert),
50
+ writeFile(path.join(certsDir, 'cert.pem.trust.txt'), TRUST_NOTES)
51
+ ]);
52
+ logger.info(`Generated self-signed dev certificate in ${certsDir}. See cert.pem.trust.txt for trust instructions.`);
53
+ return { key: pems.private, cert: pems.cert };
54
+ }
55
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,WAAW,GAAG;IAClB,uDAAuD;IACvD,EAAE;IACF,wFAAwF;IACxF,EAAE;IACF,kFAAkF;IAClF,qEAAqE;IACrE,EAAE;IACF,2GAA2G;IAC3G,oDAAoD;IACpD,oEAAoE;IACpE,EAAE;CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AA6Bb,MAAM,OAAO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ACF;KACF,CACF,CAAC;IACF,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QACjD,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC;QAC9B,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,EAAE,WAAW,CAAC;KAClE,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CACT,4CAA4C,QAAQ,kDAAkD,CACvG,CAAC;IACF,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;AAChD,CAAC"}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@mbsks/rspfx-manifest-server",
3
+ "version": "0.0.3",
4
+ "private": false,
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "license": "MIT",
18
+ "dependencies": {
19
+ "selfsigned": "^2.4.1",
20
+ "@mbsks/rspfx-diagnostics": "0.0.3",
21
+ "@mbsks/rspfx-core": "0.0.3"
22
+ },
23
+ "description": "RSPFX HTTPS manifest server for the SharePoint workbench (:4321)",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/master8848/rspfx.git"
27
+ },
28
+ "scripts": {
29
+ "build": "tsc -p tsconfig.build.json",
30
+ "typecheck": "tsc --noEmit -p tsconfig.json",
31
+ "test": "vitest run"
32
+ }
33
+ }