warden.rn 1.0.0 → 1.0.1

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.
@@ -0,0 +1,37 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "type": "node",
9
+ "request": "launch",
10
+ "name": "Launch Program",
11
+ "skipFiles": [
12
+ "<node_internals>/**"
13
+ ],
14
+ "program": "/Users/ru1n/proj/rabby-mobile/apps/mobile/node_modules/react-native/cli.js",
15
+ // "args": [
16
+ // "start"
17
+ // ],
18
+ "args": [
19
+ "bundle",
20
+ "--platform",
21
+ "android",
22
+ "--dev",
23
+ "false",
24
+ "--entry-file",
25
+ "index.js",
26
+ "--bundle-output",
27
+ "android/app/src/main/assets/index.android.bundle",
28
+ "--assets-dest",
29
+ "android/app/src/main/res/"
30
+ ],
31
+ "cwd": "/Users/ru1n/proj/rabby-mobile/apps/mobile",
32
+ "env": {
33
+ "NODE_OPTIONS": "--max-old-space-size=32768"
34
+ }
35
+ }
36
+ ]
37
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ // See https://go.microsoft.com/fwlink/?LinkId=733558
3
+ // for the documentation about the tasks.json format
4
+ "version": "2.0.0",
5
+ "tasks": [
6
+ {
7
+ "label": "startRN",
8
+ "type": "shell",
9
+ "command": "cd /Users/ru1n/proj/rabby-mobile/apps/mobile && npx react-native start",
10
+ "problemMatcher": []
11
+ },
12
+ {
13
+ "label": "bundleRN",
14
+ "type": "shell",
15
+ "command": "cd /Users/ru1n/proj/rabby-mobile/apps/mobile && npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ && cd android && ./gradlew assembleDebug && adb install -r ./app/build/outputs/apk/debug/app-debug.apk",
16
+ "problemMatcher": []
17
+ },
18
+ {
19
+ "label": "openPolicy",
20
+ "type": "shell",
21
+ "command": "cursor /Users/ru1n/proj/rabby-mobile/Warden-RN/policy.json",
22
+ "problemMatcher": []
23
+ },
24
+ {
25
+ "label": "openBundle",
26
+ "type": "shell",
27
+ "command": "cursor /Users/ru1n/proj/rabby-mobile/apps/mobile/android/app/src/main/assets/index.android.bundle",
28
+ "problemMatcher": []
29
+ }
30
+ ]
31
+ }
package/README.MD CHANGED
@@ -4,10 +4,7 @@
4
4
  如果有多个serializer,需要将WardenSerializer置于最外层
5
5
  ```js
6
6
  serializer: {
7
- customSerializer: createWardenSerializer(createSentryMetroSerializer(), {
8
- // ... 配置项
9
- }),
7
+ customSerializer: createWardenSerializer(createSentryMetroSerializer()),
10
8
  },
11
- ```
12
- ## 配置
13
9
 
10
+ ```
package/package.json CHANGED
@@ -1,30 +1,26 @@
1
1
  {
2
- "name": "warden.rn",
3
- "version": "1.0.0",
4
- "description": "",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "files": [
10
- "dist/**/*.js",
11
- "dist/**/*.d.ts"
12
- ],
13
- "keywords": [],
14
- "author": "",
15
- "license": "ISC",
16
- "type": "commonjs",
17
- "devDependencies": {
18
- "@types/babel__generator": "^7.27.0",
19
- "@types/babel__traverse": "^7.28.0",
20
- "@types/node": "^25.0.3",
21
- "metro": "^0.83.3"
22
- },
23
- "dependencies": {
24
- "@ampproject/remapping": "^2.3.0",
25
- "@babel/generator": "^7.28.5",
26
- "@babel/parser": "^7.28.5",
27
- "@babel/traverse": "^7.28.5",
28
- "@babel/types": "^7.28.5"
29
- }
2
+ "name": "warden.rn",
3
+ "version": "1.0.1",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "type": "commonjs",
13
+ "devDependencies": {
14
+ "@types/babel__generator": "7.27.0",
15
+ "@types/babel__traverse": "7.28.0",
16
+ "@types/node": "25.0.3",
17
+ "metro": "0.83.3"
18
+ },
19
+ "dependencies": {
20
+ "@ampproject/remapping": "2.3.0",
21
+ "@babel/generator": "7.28.5",
22
+ "@babel/parser": "7.28.5",
23
+ "@babel/traverse": "7.28.5",
24
+ "@babel/types": "7.28.5"
25
+ }
30
26
  }
@@ -1,9 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.protectRequire = protectRequire;
4
- const parser_1 = require("@babel/parser");
5
- const t = require("@babel/types");
6
- function protectRequire(fn, deps) {
1
+ import { parseExpression } from "@babel/parser";
2
+ import { NodePath } from "@babel/traverse";
3
+ import * as t from "@babel/types";
4
+
5
+ export function protectRequire(
6
+ fn: NodePath<t.FunctionExpression>,
7
+ deps: number[]
8
+ ) {
7
9
  const require = fn.node.params[1];
8
10
  if (!t.isIdentifier(require)) {
9
11
  throw new Error(`require must be an identifier`);
@@ -19,6 +21,7 @@ function protectRequire(fn, deps) {
19
21
  throw new Error(`importAll must be an identifier`);
20
22
  return;
21
23
  }
24
+
22
25
  const template = `
23
26
  () => {
24
27
  const __r0 = ${JSON.stringify(deps)};
@@ -44,7 +47,9 @@ function protectRequire(fn, deps) {
44
47
  ${require.name}.importAll = __r3;
45
48
  }
46
49
  `;
47
- const ppFn = (0, parser_1.parseExpression)(template);
48
- fn.node.body.body.unshift(t.expressionStatement(t.callExpression(ppFn, [])));
50
+ const ppFn = parseExpression(template);
51
+
52
+ fn.node.body.body.unshift(
53
+ t.expressionStatement(t.callExpression(ppFn, []))
54
+ );
49
55
  }
50
- //# sourceMappingURL=deps.js.map