Skip to content

Commit

Permalink
fix: reorganise imports
Browse files Browse the repository at this point in the history
  • Loading branch information
e-moran committed Dec 13, 2024
1 parent d1bf29a commit bd773ee
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 50 deletions.
13 changes: 1 addition & 12 deletions analyze-wasm/edge-light.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { ArcjetLogger } from "@arcjet/protocol";

import { instantiate } from "./wasm/arcjet_analyze_js_req.component.js";
import type {
ImportObject,
Expand All @@ -18,11 +16,6 @@ import componentCoreWasm from "./wasm/arcjet_analyze_js_req.component.core.wasm?
import componentCore2Wasm from "./wasm/arcjet_analyze_js_req.component.core2.wasm?module";
import componentCore3Wasm from "./wasm/arcjet_analyze_js_req.component.core3.wasm?module";

interface AnalyzeContext {
log: ArcjetLogger;
characteristics: string[];
}

type DetectSensitiveInfoFunction =
typeof ArcjetJsReqSensitiveInformationIdentifier.detect;

Expand All @@ -40,10 +33,7 @@ async function moduleFromPath(path: string): Promise<WebAssembly.Module> {
throw new Error(`Unknown path: ${path}`);
}

export async function initializeWasm(
context: AnalyzeContext,
coreImports: ImportObject,
) {
export async function initializeWasm(coreImports: ImportObject) {
try {
return instantiate(moduleFromPath, coreImports);
} catch {
Expand All @@ -52,7 +42,6 @@ export async function initializeWasm(
}

export {
type AnalyzeContext,
type BotConfig,
type DetectedSensitiveInfoEntity,
type SensitiveInfoEntity,
Expand Down
8 changes: 0 additions & 8 deletions analyze-wasm/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { ArcjetLogger } from "@arcjet/protocol";

import { instantiate } from "./wasm/arcjet_analyze_js_req.component.js";
import type {
ImportObject,
Expand All @@ -18,11 +16,6 @@ import { wasm as componentCoreWasm } from "./wasm/arcjet_analyze_js_req.componen
import { wasm as componentCore2Wasm } from "./wasm/arcjet_analyze_js_req.component.core2.wasm?js";
import { wasm as componentCore3Wasm } from "./wasm/arcjet_analyze_js_req.component.core3.wasm?js";

interface AnalyzeContext {
log: ArcjetLogger;
characteristics: string[];
}

type DetectSensitiveInfoFunction =
typeof ArcjetJsReqSensitiveInformationIdentifier.detect;

Expand Down Expand Up @@ -63,7 +56,6 @@ export async function initializeWasm(coreImports: ImportObject) {
}

export {
type AnalyzeContext,
type BotConfig,
type DetectedSensitiveInfoEntity,
type SensitiveInfoEntity,
Expand Down
1 change: 1 addition & 0 deletions analyze-wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"pretest": "npm run build",
"test": "node --test"
},
"dependencies": {},
"devDependencies": {
"@arcjet/eslint-config": "1.0.0-alpha.34",
"@arcjet/rollup-config": "1.0.0-alpha.34",
Expand Down
8 changes: 0 additions & 8 deletions analyze-wasm/workerd.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { ArcjetLogger } from "@arcjet/protocol";

import { instantiate } from "./wasm/arcjet_analyze_js_req.component.js";
import type {
ImportObject,
Expand All @@ -18,11 +16,6 @@ import componentCoreWasm from "./wasm/arcjet_analyze_js_req.component.core.wasm"
import componentCore2Wasm from "./wasm/arcjet_analyze_js_req.component.core2.wasm";
import componentCore3Wasm from "./wasm/arcjet_analyze_js_req.component.core3.wasm";

interface AnalyzeContext {
log: ArcjetLogger;
characteristics: string[];
}

type DetectSensitiveInfoFunction =
typeof ArcjetJsReqSensitiveInformationIdentifier.detect;

Expand Down Expand Up @@ -50,7 +43,6 @@ export async function initializeWasm(coreImports: ImportObject) {
}

export {
type AnalyzeContext,
type BotConfig,
type DetectedSensitiveInfoEntity,
type SensitiveInfoEntity,
Expand Down
9 changes: 7 additions & 2 deletions analyze/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { initializeWasm } from "@arcjet/analyze-wasm";
import type {
AnalyzeContext,
BotConfig,
BotResult,
DetectedSensitiveInfoEntity,
Expand All @@ -10,8 +9,14 @@ import type {
SensitiveInfoEntities,
SensitiveInfoEntity,
SensitiveInfoResult,
ImportObject,
} from "@arcjet/analyze-wasm";
import type { ImportObject } from "@arcjet/analyze-wasm/wasm/arcjet_analyze_js_req.component";
import type { ArcjetLogger } from "@arcjet/protocol";

interface AnalyzeContext {
log: ArcjetLogger;
characteristics: string[];
}

type AnalyzeRequest = {
ip?: string;
Expand Down
20 changes: 0 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bd773ee

Please sign in to comment.