jso-protector 0.2.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/CHANGELOG.md +960 -0
- package/LICENSE +90 -0
- package/MIGRATION.md +207 -0
- package/README.md +1477 -0
- package/RELEASE.md +82 -0
- package/SECURITY.md +71 -0
- package/ai-cli.js +392 -0
- package/ai.js +176 -0
- package/bin/jso-protector.js +12066 -0
- package/browserify.d.ts +10 -0
- package/browserify.js +88 -0
- package/bun.d.ts +10 -0
- package/bun.js +41 -0
- package/ci/Jenkinsfile +82 -0
- package/ci/argo-workflows.yaml +121 -0
- package/ci/azure-pipelines.yml +56 -0
- package/ci/bitbucket-pipelines.yml +43 -0
- package/ci/buildkite.yml +50 -0
- package/ci/circleci.yml +60 -0
- package/ci/drone.yml +67 -0
- package/ci/github-actions.yml +51 -0
- package/ci/gitlab-ci.yml +39 -0
- package/ci/gocd.yaml +79 -0
- package/ci/teamcity.kts +79 -0
- package/ci/tekton.yaml +106 -0
- package/ci/verify-package.js +748 -0
- package/ci/verify-publish-metadata.js +147 -0
- package/ci/verify-templates.js +195 -0
- package/ci/woodpecker.yml +53 -0
- package/compliance/cli.js +204 -0
- package/compliance/evidence-forwarder.js +209 -0
- package/compliance/pci-dss-v4/controls.json +75 -0
- package/compliance/pci-dss-v4/index.js +2613 -0
- package/config/named-sets.js +185 -0
- package/esbuild.d.ts +16 -0
- package/esbuild.js +190 -0
- package/examples/README.md +78 -0
- package/examples/browserify/build.js +20 -0
- package/examples/bun/package.json +13 -0
- package/examples/bun/scripts/protect-release.js +28 -0
- package/examples/cli-basic/jso.config.cjs +23 -0
- package/examples/cli-basic/jso.config.json +15 -0
- package/examples/cli-basic/package.json +14 -0
- package/examples/cli-basic/scripts/build.js +10 -0
- package/examples/curl/README.md +55 -0
- package/examples/curl/protect.sh +106 -0
- package/examples/esbuild/build.js +19 -0
- package/examples/grunt/Gruntfile.js +29 -0
- package/examples/gulp/gulpfile.js +19 -0
- package/examples/helm/Chart.yaml +27 -0
- package/examples/helm/README.md +69 -0
- package/examples/helm/templates/_helpers.tpl +23 -0
- package/examples/helm/templates/_podtemplate.tpl +64 -0
- package/examples/helm/templates/job.yaml +39 -0
- package/examples/helm/templates/secret.yaml +17 -0
- package/examples/helm/values.yaml +54 -0
- package/examples/kubernetes/job.yaml +123 -0
- package/examples/metro.config.js +11 -0
- package/examples/nextjs/next.config.js +11 -0
- package/examples/node-api/protect-release.js +28 -0
- package/examples/node-api/release-summary.js +59 -0
- package/examples/parcel/package.json +13 -0
- package/examples/parcel/scripts/protect-release.js +28 -0
- package/examples/payment-page-script-inventory.json +62 -0
- package/examples/payment-page-security-headers.json +46 -0
- package/examples/pre-commit/.pre-commit-config.yaml +33 -0
- package/examples/pre-commit/README.md +45 -0
- package/examples/react-native/README.md +208 -0
- package/examples/react-native/metro.config.js +11 -0
- package/examples/rollup/rollup.config.js +20 -0
- package/examples/rspack/rspack.config.js +28 -0
- package/examples/turbopack/package.json +13 -0
- package/examples/turbopack/scripts/protect-release.js +28 -0
- package/examples/vite/vite.config.js +18 -0
- package/examples/webpack/webpack.config.js +21 -0
- package/examples/webpack-loader/webpack.config.js +22 -0
- package/governance/index.d.ts +18 -0
- package/governance/index.js +309 -0
- package/grunt.d.ts +4 -0
- package/grunt.js +111 -0
- package/gulp.d.ts +10 -0
- package/gulp.js +106 -0
- package/index.d.ts +879 -0
- package/index.js +607 -0
- package/jso.config.example.json +29 -0
- package/jso.config.schema.json +548 -0
- package/metro.d.ts +43 -0
- package/metro.js +117 -0
- package/next.d.ts +24 -0
- package/next.js +64 -0
- package/package.json +241 -0
- package/parcel.d.ts +10 -0
- package/parcel.js +40 -0
- package/react-native.d.ts +2 -0
- package/react-native.js +3 -0
- package/release-signer.js +245 -0
- package/rollup.d.ts +13 -0
- package/rollup.js +71 -0
- package/rspack-loader.d.ts +13 -0
- package/rspack-loader.js +11 -0
- package/rspack.d.ts +11 -0
- package/rspack.js +9 -0
- package/runtime/ai-script-governance.js +379 -0
- package/runtime/countermeasures.js +0 -0
- package/runtime/data-exfiltration-guard.d.ts +7 -0
- package/runtime/data-exfiltration-guard.js +161 -0
- package/runtime/environment-integrity.js +389 -0
- package/runtime/managed-integrity.d.ts +4 -0
- package/runtime/managed-integrity.js +108 -0
- package/runtime/third-party-inventory.js +437 -0
- package/turbopack.d.ts +10 -0
- package/turbopack.js +41 -0
- package/vite.d.ts +16 -0
- package/vite.js +78 -0
- package/watermark.js +126 -0
- package/webpack-loader.d.ts +15 -0
- package/webpack-loader.js +97 -0
- package/webpack.d.ts +13 -0
- package/webpack.js +143 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Ed25519-signed release manifests for jso-protector.
|
|
4
|
+
//
|
|
5
|
+
// After a successful obfuscation run, this module produces a small
|
|
6
|
+
// signed attestation file (".manifest.sig") that proves:
|
|
7
|
+
//
|
|
8
|
+
// - the artifact came from a build with the holder of the private key
|
|
9
|
+
// - which BuildId / PolymorphismFingerprint was used
|
|
10
|
+
// - the exact SHA-256 of each protected output file
|
|
11
|
+
// - the ReleaseLabel and a UTC timestamp
|
|
12
|
+
//
|
|
13
|
+
// Verification is the inverse: given a .manifest.sig and the matching
|
|
14
|
+
// public key, confirm the signature, then re-hash each referenced file
|
|
15
|
+
// on disk and confirm the hashes still match. A failure on either step
|
|
16
|
+
// means the artifact was tampered with after signing.
|
|
17
|
+
//
|
|
18
|
+
// This is the SLSA-style attestation pattern adapted for an obfuscation
|
|
19
|
+
// pipeline. Enterprises typically want to publish their public key in
|
|
20
|
+
// their security.txt or repo, then anyone can verify "this protected
|
|
21
|
+
// JS came from our official CI" without trusting our service.
|
|
22
|
+
//
|
|
23
|
+
// Why Ed25519:
|
|
24
|
+
// - 64-byte signatures, 32-byte keys, fast verify
|
|
25
|
+
// - Node has built-in support (crypto.generateKeyPairSync('ed25519')
|
|
26
|
+
// since Node 12.0); no third-party dependency
|
|
27
|
+
// - Recommended over RSA for new designs in 2024+
|
|
28
|
+
//
|
|
29
|
+
// File formats:
|
|
30
|
+
//
|
|
31
|
+
// <output>/<name>.manifest.json existing protection manifest
|
|
32
|
+
// <output>/<name>.manifest.json.sig the new signed envelope:
|
|
33
|
+
//
|
|
34
|
+
// {
|
|
35
|
+
// "v": 1,
|
|
36
|
+
// "signedAt": "2026-05-27T00:00:00Z",
|
|
37
|
+
// "manifest": { // canonical subset we sign
|
|
38
|
+
// "buildId": "...",
|
|
39
|
+
// "polymorphismFingerprint": "...",
|
|
40
|
+
// "label": "...",
|
|
41
|
+
// "files": [
|
|
42
|
+
// { "name": "app.js", "sha256": "<hex>" },
|
|
43
|
+
// { "name": "lib/dep.js", "sha256": "<hex>" }
|
|
44
|
+
// ]
|
|
45
|
+
// },
|
|
46
|
+
// "publicKey": "<base64 SPKI DER>",
|
|
47
|
+
// "signature": "<base64 64-byte Ed25519 sig over canonical(manifest)>"
|
|
48
|
+
// }
|
|
49
|
+
//
|
|
50
|
+
// The signature is over a CANONICAL JSON encoding of the `manifest`
|
|
51
|
+
// subobject. Canonical = sorted keys, no whitespace, no trailing
|
|
52
|
+
// newline. This way the same logical manifest always produces the same
|
|
53
|
+
// bytes to sign and the same bytes to verify, regardless of which JSON
|
|
54
|
+
// library the caller used.
|
|
55
|
+
|
|
56
|
+
const crypto = require("node:crypto");
|
|
57
|
+
const fs = require("node:fs");
|
|
58
|
+
const path = require("node:path");
|
|
59
|
+
|
|
60
|
+
const VERSION = 1;
|
|
61
|
+
|
|
62
|
+
// ---- canonical JSON --------------------------------------------------------
|
|
63
|
+
//
|
|
64
|
+
// JSON has no canonical form by default — key ordering, whitespace, and
|
|
65
|
+
// number formatting all vary. We pick a deterministic shape so the bytes
|
|
66
|
+
// you sign now match the bytes a verifier produces later. Sort keys
|
|
67
|
+
// alphabetically, no whitespace, JSON.stringify number formatting.
|
|
68
|
+
function canonicalize(value) {
|
|
69
|
+
if (Array.isArray(value)) {
|
|
70
|
+
return "[" + value.map(canonicalize).join(",") + "]";
|
|
71
|
+
}
|
|
72
|
+
if (value && typeof value === "object") {
|
|
73
|
+
const keys = Object.keys(value).sort();
|
|
74
|
+
return "{" + keys.map(k =>
|
|
75
|
+
JSON.stringify(k) + ":" + canonicalize(value[k])
|
|
76
|
+
).join(",") + "}";
|
|
77
|
+
}
|
|
78
|
+
return JSON.stringify(value);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ---- key generation --------------------------------------------------------
|
|
82
|
+
//
|
|
83
|
+
// generateKeyPair() produces a fresh Ed25519 key pair as two PEM files.
|
|
84
|
+
// We write PEM (not DER) because most users already have PEM tooling
|
|
85
|
+
// (ssh-keygen, openssl, hashicorp Vault) and pasting a PEM into a CI
|
|
86
|
+
// secret store is the path of least surprise.
|
|
87
|
+
function generateKeyPair() {
|
|
88
|
+
const { publicKey, privateKey } = crypto.generateKeyPairSync("ed25519");
|
|
89
|
+
return {
|
|
90
|
+
publicKeyPem: publicKey.export({ type: "spki", format: "pem" }),
|
|
91
|
+
privateKeyPem: privateKey.export({ type: "pkcs8", format: "pem" }),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ---- sign ------------------------------------------------------------------
|
|
96
|
+
//
|
|
97
|
+
// signRelease takes the parts of a build and a path to a PEM private
|
|
98
|
+
// key, returns the JSON envelope object (caller writes it to disk).
|
|
99
|
+
function signRelease(parts, privateKeyPem) {
|
|
100
|
+
if (!parts || !Array.isArray(parts.files)) {
|
|
101
|
+
throw new Error("signRelease: parts.files is required (array of { name, sha256 })");
|
|
102
|
+
}
|
|
103
|
+
const keyObj = crypto.createPrivateKey({ key: privateKeyPem, format: "pem" });
|
|
104
|
+
if (keyObj.asymmetricKeyType !== "ed25519") {
|
|
105
|
+
throw new Error("signRelease: private key is not Ed25519 (got " + keyObj.asymmetricKeyType + ")");
|
|
106
|
+
}
|
|
107
|
+
const manifest = {
|
|
108
|
+
buildId: parts.buildId || null,
|
|
109
|
+
polymorphismFingerprint: parts.polymorphismFingerprint || null,
|
|
110
|
+
label: parts.label || null,
|
|
111
|
+
files: parts.files.map(f => ({ name: f.name, sha256: f.sha256 })),
|
|
112
|
+
};
|
|
113
|
+
const canonical = canonicalize(manifest);
|
|
114
|
+
// Ed25519 in Node: pass key + Buffer to crypto.sign(null, ...) — the
|
|
115
|
+
// algorithm name MUST be null for EdDSA (the algorithm is baked into
|
|
116
|
+
// the key type).
|
|
117
|
+
const sig = crypto.sign(null, Buffer.from(canonical, "utf8"), keyObj);
|
|
118
|
+
|
|
119
|
+
const pubObj = crypto.createPublicKey(keyObj);
|
|
120
|
+
return {
|
|
121
|
+
v: VERSION,
|
|
122
|
+
signedAt: new Date().toISOString(),
|
|
123
|
+
manifest: manifest,
|
|
124
|
+
publicKey: pubObj.export({ type: "spki", format: "der" }).toString("base64"),
|
|
125
|
+
signature: sig.toString("base64"),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ---- verify ----------------------------------------------------------------
|
|
130
|
+
//
|
|
131
|
+
// Two-stage verification. Stage 1 confirms the signature is valid for
|
|
132
|
+
// the embedded manifest under the supplied (or embedded) public key.
|
|
133
|
+
// Stage 2 (optional, on by default) re-hashes the referenced files on
|
|
134
|
+
// disk and confirms the hashes still match — this is what catches
|
|
135
|
+
// post-signing tampering of the protected artifacts themselves.
|
|
136
|
+
//
|
|
137
|
+
// Returns: { valid, stage1, stage2, mismatches: [...], error: string? }
|
|
138
|
+
//
|
|
139
|
+
// valid: overall pass/fail
|
|
140
|
+
// stage1: signature verified against (manifest, publicKey)
|
|
141
|
+
// stage2: every referenced file's on-disk sha256 matched the manifest
|
|
142
|
+
// mismatches: list of { name, expected, actual } when stage2 fails
|
|
143
|
+
//
|
|
144
|
+
// `expectedPublicKeyPem` is optional. When provided, we verify the
|
|
145
|
+
// embedded public key matches the one the caller trusts (so a sneaky
|
|
146
|
+
// envelope can't substitute its own key with a self-signed manifest).
|
|
147
|
+
function verifyRelease(envelope, opts) {
|
|
148
|
+
opts = opts || {};
|
|
149
|
+
const result = {
|
|
150
|
+
valid: false, stage1: false, stage2: false,
|
|
151
|
+
mismatches: [], error: null,
|
|
152
|
+
};
|
|
153
|
+
if (!envelope || typeof envelope !== "object") {
|
|
154
|
+
result.error = "envelope is not an object";
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
if (envelope.v !== VERSION) {
|
|
158
|
+
result.error = "unsupported envelope version: " + envelope.v;
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
if (!envelope.signature || !envelope.publicKey || !envelope.manifest) {
|
|
162
|
+
result.error = "envelope missing signature / publicKey / manifest";
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Pin to a trusted public key when the caller supplied one.
|
|
167
|
+
let pubKey;
|
|
168
|
+
if (opts.expectedPublicKeyPem) {
|
|
169
|
+
pubKey = crypto.createPublicKey({ key: opts.expectedPublicKeyPem, format: "pem" });
|
|
170
|
+
const embeddedDerB64 = envelope.publicKey;
|
|
171
|
+
const trustedDerB64 = pubKey.export({ type: "spki", format: "der" }).toString("base64");
|
|
172
|
+
if (embeddedDerB64 !== trustedDerB64) {
|
|
173
|
+
result.error = "embedded public key does not match --public-key";
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
pubKey = crypto.createPublicKey({
|
|
178
|
+
key: Buffer.from(envelope.publicKey, "base64"),
|
|
179
|
+
format: "der", type: "spki",
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Stage 1: signature verification over canonical manifest.
|
|
184
|
+
const canonical = canonicalize(envelope.manifest);
|
|
185
|
+
let stage1ok = false;
|
|
186
|
+
try {
|
|
187
|
+
stage1ok = crypto.verify(null,
|
|
188
|
+
Buffer.from(canonical, "utf8"),
|
|
189
|
+
pubKey,
|
|
190
|
+
Buffer.from(envelope.signature, "base64"));
|
|
191
|
+
} catch (e) {
|
|
192
|
+
result.error = "verify failed: " + e.message;
|
|
193
|
+
return result;
|
|
194
|
+
}
|
|
195
|
+
result.stage1 = stage1ok;
|
|
196
|
+
if (!stage1ok) {
|
|
197
|
+
result.error = "signature does not match manifest";
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Stage 2 (optional): re-hash files on disk.
|
|
202
|
+
if (opts.fileRoot && Array.isArray(envelope.manifest.files)) {
|
|
203
|
+
for (const f of envelope.manifest.files) {
|
|
204
|
+
const p = path.join(opts.fileRoot, f.name);
|
|
205
|
+
if (!fs.existsSync(p)) {
|
|
206
|
+
result.mismatches.push({ name: f.name, expected: f.sha256, actual: null, missing: true });
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
const actual = sha256OfFile(p);
|
|
210
|
+
if (actual !== f.sha256) {
|
|
211
|
+
result.mismatches.push({ name: f.name, expected: f.sha256, actual: actual });
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
result.stage2 = result.mismatches.length === 0;
|
|
215
|
+
result.valid = result.stage1 && result.stage2;
|
|
216
|
+
if (!result.valid && !result.error) {
|
|
217
|
+
result.error = "one or more files were modified after signing";
|
|
218
|
+
}
|
|
219
|
+
} else {
|
|
220
|
+
// No file root means signature-only verification.
|
|
221
|
+
result.stage2 = true; // n/a
|
|
222
|
+
result.valid = result.stage1;
|
|
223
|
+
}
|
|
224
|
+
return result;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function sha256OfFile(p) {
|
|
228
|
+
const h = crypto.createHash("sha256");
|
|
229
|
+
h.update(fs.readFileSync(p));
|
|
230
|
+
return h.digest("hex");
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function sha256OfBuffer(buf) {
|
|
234
|
+
return crypto.createHash("sha256").update(buf).digest("hex");
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
module.exports = {
|
|
238
|
+
VERSION,
|
|
239
|
+
canonicalize,
|
|
240
|
+
generateKeyPair,
|
|
241
|
+
signRelease,
|
|
242
|
+
verifyRelease,
|
|
243
|
+
sha256OfFile,
|
|
244
|
+
sha256OfBuffer,
|
|
245
|
+
};
|
package/rollup.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ProtectionOptions } from "./index";
|
|
2
|
+
|
|
3
|
+
export interface JsoProtectorPluginOptions extends ProtectionOptions {
|
|
4
|
+
removeSourceMaps?: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare function jsoProtector(options?: JsoProtectorPluginOptions): {
|
|
8
|
+
name: "jso-protector";
|
|
9
|
+
generateBundle(outputOptions: unknown, bundle: Record<string, unknown>): Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { jsoProtector };
|
|
13
|
+
export default jsoProtector;
|
package/rollup.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { assertSizeBudgets, buildItemsManifest, buildProtectionItemsFromInputItems, composeProtectionItemOutput, createProtectionConfig, isExcluded, protectItems, writeManifest } = require("./index.js");
|
|
4
|
+
|
|
5
|
+
function jsoProtector(options = {}) {
|
|
6
|
+
let config = null;
|
|
7
|
+
const removeSourceMaps = options.removeSourceMaps !== false;
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
name: "jso-protector",
|
|
11
|
+
async generateBundle(outputOptions, bundle) {
|
|
12
|
+
if (!config) {
|
|
13
|
+
const outDir = outputOptions && outputOptions.dir ? outputOptions.dir : "dist";
|
|
14
|
+
config = createProtectionConfig({
|
|
15
|
+
input: outDir,
|
|
16
|
+
output: outDir,
|
|
17
|
+
...options
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const chunks = Object.values(bundle).filter((entry) => (
|
|
22
|
+
entry &&
|
|
23
|
+
entry.type === "chunk" &&
|
|
24
|
+
typeof entry.code === "string" &&
|
|
25
|
+
entry.fileName &&
|
|
26
|
+
entry.fileName.endsWith(".js") &&
|
|
27
|
+
shouldProtectAsset(entry.fileName, config, options)
|
|
28
|
+
));
|
|
29
|
+
|
|
30
|
+
if (!chunks.length) return;
|
|
31
|
+
|
|
32
|
+
const inputItems = chunks.map((chunk) => ({
|
|
33
|
+
FileName: chunk.fileName,
|
|
34
|
+
FileCode: chunk.code
|
|
35
|
+
}));
|
|
36
|
+
const protection = buildProtectionItemsFromInputItems(config, inputItems);
|
|
37
|
+
const result = await protectItems(config, protection.items);
|
|
38
|
+
const manifest = buildItemsManifest(config, inputItems, result, (fileName) => fileName, protection.transforms);
|
|
39
|
+
assertSizeBudgets(manifest, config);
|
|
40
|
+
|
|
41
|
+
for (const chunk of chunks) {
|
|
42
|
+
chunk.code = composeProtectionItemOutput(chunk.fileName, result, protection.transforms, config);
|
|
43
|
+
if (removeSourceMaps) {
|
|
44
|
+
chunk.map = null;
|
|
45
|
+
delete bundle[`${chunk.fileName}.map`];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (config.manifest) {
|
|
50
|
+
writeManifest(config.manifest, manifest);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function normalizeName(name) {
|
|
57
|
+
return String(name || "").replace(/\\/g, "/");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function shouldProtectAsset(fileName, config, options) {
|
|
61
|
+
const normalized = normalizeName(fileName);
|
|
62
|
+
const include = Array.isArray(config.include) && config.include.length ? config.include : options.include;
|
|
63
|
+
if (Array.isArray(include) && include.length && !isExcluded(normalized, include)) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return !isExcluded(normalized, config.exclude || []);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
module.exports = jsoProtector;
|
|
70
|
+
module.exports.jsoProtector = jsoProtector;
|
|
71
|
+
module.exports.default = jsoProtector;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JsoProtectorWebpackLoaderOptions } from "./webpack-loader";
|
|
2
|
+
|
|
3
|
+
export interface JsoProtectorRspackLoaderOptions extends JsoProtectorWebpackLoaderOptions {}
|
|
4
|
+
|
|
5
|
+
declare function jsoProtectorRspackLoader(
|
|
6
|
+
this: unknown,
|
|
7
|
+
source: string | Buffer,
|
|
8
|
+
sourceMap?: unknown,
|
|
9
|
+
meta?: unknown
|
|
10
|
+
): void;
|
|
11
|
+
|
|
12
|
+
export { jsoProtectorRspackLoader };
|
|
13
|
+
export default jsoProtectorRspackLoader;
|
package/rspack-loader.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const webpackLoader = require("./webpack-loader.js");
|
|
4
|
+
|
|
5
|
+
function jsoProtectorRspackLoader(source, sourceMap, meta) {
|
|
6
|
+
return webpackLoader.call(this, source, sourceMap, meta);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
module.exports = jsoProtectorRspackLoader;
|
|
10
|
+
module.exports.jsoProtectorRspackLoader = jsoProtectorRspackLoader;
|
|
11
|
+
module.exports.default = jsoProtectorRspackLoader;
|
package/rspack.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { JsoProtectorWebpackPluginOptions } from "./webpack";
|
|
2
|
+
|
|
3
|
+
export interface JsoProtectorRspackPluginOptions extends JsoProtectorWebpackPluginOptions {}
|
|
4
|
+
|
|
5
|
+
declare class JsoProtectorRspackPlugin {
|
|
6
|
+
constructor(options?: JsoProtectorRspackPluginOptions);
|
|
7
|
+
apply(compiler: unknown): void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { JsoProtectorRspackPlugin };
|
|
11
|
+
export default JsoProtectorRspackPlugin;
|
package/rspack.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const WebpackProtector = require("./webpack.js");
|
|
4
|
+
|
|
5
|
+
class JsoProtectorRspackPlugin extends WebpackProtector {}
|
|
6
|
+
|
|
7
|
+
module.exports = JsoProtectorRspackPlugin;
|
|
8
|
+
module.exports.JsoProtectorRspackPlugin = JsoProtectorRspackPlugin;
|
|
9
|
+
module.exports.default = JsoProtectorRspackPlugin;
|