New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@masknet/compartment

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@masknet/compartment - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

dist/index.d.ts

@@ -1,2 +0,2 @@

export type { Binding, ImportBinding, ExportBinding, CompartmentOptions, ModuleDescriptor, ModuleDescriptor_Source, ModuleDescriptor_ModuleInstance, ModuleDescriptor_FullSpecReference, ModuleDescriptor_StaticModuleRecord, ModuleNamespace, ThirdPartyStaticModuleRecord, ThirdPartyStaticModuleRecordInitializeContext, } from './types.js';
export type { Binding, ImportBinding, ExportBinding, CompartmentOptions, ModuleDescriptor, ModuleDescriptor_Source, ModuleDescriptor_ModuleInstance, ModuleDescriptor_FullSpecReference, ModuleDescriptor_StaticModuleRecord, ModuleNamespace, SyntheticModuleRecord, SyntheticModuleRecordInitializeContext, } from './types.js';
export { Compartment } from './compartment.js';

@@ -3,0 +3,0 @@ export { StaticModuleRecord } from './StaticModuleRecord.js';

@@ -28,5 +28,5 @@ import type { Compartment } from './compartment.js';

}
export interface ThirdPartyStaticModuleRecord {
export interface SyntheticModuleRecord {
bindings?: Array<Binding>;
initialize(environment: object, context: ThirdPartyStaticModuleRecordInitializeContext): void | Promise<void>;
initialize(environment: object, context: SyntheticModuleRecordInitializeContext): void | Promise<void>;
needsImportMeta?: boolean | undefined;

@@ -36,3 +36,3 @@ needsImport?: boolean | undefined;

export declare type ModuleNamespace = Record<string, unknown>;
export interface ThirdPartyStaticModuleRecordInitializeContext {
export interface SyntheticModuleRecordInitializeContext {
importMeta?: object;

@@ -50,3 +50,3 @@ import?(spec: string, options?: ImportCallOptions): Promise<ModuleNamespace>;

export interface ModuleDescriptor_StaticModuleRecord {
record: StaticModuleRecord | ThirdPartyStaticModuleRecord | string;
record: StaticModuleRecord | SyntheticModuleRecord | string;
importMeta?: object | undefined;

@@ -53,0 +53,0 @@ }

@@ -1,8 +0,8 @@

import type { ModuleDescriptor, ModuleDescriptor_FullSpecReference, ModuleNamespace, ThirdPartyStaticModuleRecord } from '../types.js';
import type { ModuleDescriptor, ModuleDescriptor_FullSpecReference, ModuleNamespace, SyntheticModuleRecord } from '../types.js';
export declare function createModuleCache(): {
moduleMap: Record<string, ModuleDescriptor>;
addNamespace: (fullSpec: string, namespace: ModuleNamespace) => void;
addModuleRecord: (fullSpec: string, record: ThirdPartyStaticModuleRecord, extraImportMeta?: object) => void;
addModuleRecord: (fullSpec: string, record: SyntheticModuleRecord, extraImportMeta?: object) => void;
addAlias: (fullSpec: string, alias: ModuleDescriptor_FullSpecReference) => void;
};
//# sourceMappingURL=createModuleCache.d.ts.map

@@ -23,3 +23,3 @@ import { brandCheck_Compartment } from '../compartment.js';

else if (typeof record !== 'object' || record === null) {
throw new TypeError('ModuleDescriptor must be either a string, StaticModuleRecord or ThirdPartyStaticModuleRecord');
throw new TypeError('ModuleDescriptor must be either a string, StaticModuleRecord or SyntheticModuleRecord');
}

@@ -38,3 +38,3 @@ else if (record instanceof StaticModuleRecord) {

if (typeof initialize !== 'function')
throw new TypeError('ThirdPartyStaticModuleRecord.initialize must be a function');
throw new TypeError('SyntheticModuleRecord.initialize must be a function');
}

@@ -41,0 +41,0 @@ const copy = { record, importMeta: normalizeImportMeta(importMeta) };

{
"name": "@masknet/compartment",
"version": "0.1.0",
"version": "0.1.1",
"type": "module",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -11,3 +11,3 @@ import { makeBorrowedGlobalThis, makeGlobalThis } from './makeGlobalThis.js'

type ModuleDescriptor,
type ThirdPartyStaticModuleRecordInitializeContext,
type SyntheticModuleRecordInitializeContext,
} from './types.js'

@@ -196,3 +196,3 @@ import { normalizeModuleDescriptor } from './utils/normalize.js'

(_export, _context) => {
const context: ThirdPartyStaticModuleRecordInitializeContext | undefined =
const context: SyntheticModuleRecordInitializeContext | undefined =
needsImport || needsImportMeta ? {} : undefined

@@ -199,0 +199,0 @@ if (needsImport) context!.import = _context.import

@@ -12,4 +12,4 @@ export type {

ModuleNamespace,
ThirdPartyStaticModuleRecord,
ThirdPartyStaticModuleRecordInitializeContext,
SyntheticModuleRecord,
SyntheticModuleRecordInitializeContext,
} from './types.js'

@@ -16,0 +16,0 @@ export { Compartment } from './compartment.js'

@@ -30,5 +30,5 @@ // https://github.com/tc39/proposal-compartments/blob/775024d93830ee6464363b4b373d9353425a0776/README.md

}
export interface ThirdPartyStaticModuleRecord {
export interface SyntheticModuleRecord {
bindings?: Array<Binding>
initialize(environment: object, context: ThirdPartyStaticModuleRecordInitializeContext): void | Promise<void>
initialize(environment: object, context: SyntheticModuleRecordInitializeContext): void | Promise<void>
needsImportMeta?: boolean | undefined

@@ -39,3 +39,3 @@ needsImport?: boolean | undefined

export type ModuleNamespace = Record<string, unknown>
export interface ThirdPartyStaticModuleRecordInitializeContext {
export interface SyntheticModuleRecordInitializeContext {
importMeta?: object

@@ -60,3 +60,3 @@ import?(spec: string, options?: ImportCallOptions): Promise<ModuleNamespace>

export interface ModuleDescriptor_StaticModuleRecord {
record: StaticModuleRecord | ThirdPartyStaticModuleRecord | string
record: StaticModuleRecord | SyntheticModuleRecord | string
importMeta?: object | undefined

@@ -103,3 +103,3 @@ }

| { type: 'instance'; moduleInstance: ModuleNamespace }
| { type: 'record'; module: ThirdPartyStaticModuleRecord; extraImportMeta: object | null | undefined }
| { type: 'record'; module: SyntheticModuleRecord; extraImportMeta: object | null | undefined }

@@ -106,0 +106,0 @@ /** @internal */

@@ -5,3 +5,3 @@ import type {

ModuleNamespace,
ThirdPartyStaticModuleRecord,
SyntheticModuleRecord,
} from '../types.js'

@@ -15,3 +15,3 @@

}
function addModuleRecord(fullSpec: string, record: ThirdPartyStaticModuleRecord, extraImportMeta?: object) {
function addModuleRecord(fullSpec: string, record: SyntheticModuleRecord, extraImportMeta?: object) {
moduleMap[fullSpec] = { record, importMeta: extraImportMeta }

@@ -18,0 +18,0 @@ }

@@ -7,3 +7,3 @@ import { brandCheck_Compartment } from '../compartment.js'

ModuleDescriptor_StaticModuleRecord,
ThirdPartyStaticModuleRecord,
SyntheticModuleRecord,
ModuleDescriptor_ModuleInstance,

@@ -38,5 +38,3 @@ Binding,

} else if (typeof record !== 'object' || record === null) {
throw new TypeError(
'ModuleDescriptor must be either a string, StaticModuleRecord or ThirdPartyStaticModuleRecord',
)
throw new TypeError('ModuleDescriptor must be either a string, StaticModuleRecord or SyntheticModuleRecord')
} else if (record instanceof StaticModuleRecord) {

@@ -46,3 +44,3 @@ throw new TypeError('StaticModuleRecord is not supported')

const { initialize, needsImportMeta, needsImport, bindings } = record
const _: ThirdPartyStaticModuleRecord = (normalizedRecord = {
const _: SyntheticModuleRecord = (normalizedRecord = {
initialize,

@@ -55,3 +53,3 @@ needsImportMeta: Boolean(needsImportMeta),

if (typeof initialize !== 'function')
throw new TypeError('ThirdPartyStaticModuleRecord.initialize must be a function')
throw new TypeError('SyntheticModuleRecord.initialize must be a function')
}

@@ -58,0 +56,0 @@ const copy: ModuleDescriptor_StaticModuleRecord = { record, importMeta: normalizeImportMeta(importMeta) }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc