πŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more β†’
Socket
DemoInstallSign in
Socket

@endo/bundle-source

Package Overview
Dependencies
Maintainers
0
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@endo/bundle-source - npm Package Compare versions

Comparing version

to
3.5.0

27

package.json
{
"name": "@endo/bundle-source",
"version": "3.4.2",
"version": "3.5.0",
"description": "Create source bundles from ES Modules",

@@ -28,8 +28,8 @@ "type": "module",

"dependencies": {
"@endo/base64": "^1.0.8",
"@endo/compartment-mapper": "^1.3.1",
"@endo/evasive-transform": "^1.3.2",
"@endo/init": "^1.1.6",
"@endo/promise-kit": "^1.1.7",
"@endo/where": "^1.0.8",
"@endo/base64": "^1.0.9",
"@endo/compartment-mapper": "^1.4.0",
"@endo/evasive-transform": "^1.3.3",
"@endo/init": "^1.1.7",
"@endo/promise-kit": "^1.1.8",
"@endo/where": "^1.0.9",
"@rollup/plugin-commonjs": "^19.0.0",

@@ -39,12 +39,13 @@ "@rollup/plugin-json": "^6.1.0",

"acorn": "^8.2.4",
"rollup": "^2.79.1"
"rollup": "^2.79.1",
"ts-blank-space": "^0.4.1"
},
"devDependencies": {
"@endo/lockdown": "^1.0.12",
"@endo/ses-ava": "^1.2.7",
"@endo/zip": "^1.0.8",
"@endo/lockdown": "^1.0.13",
"@endo/ses-ava": "^1.2.8",
"@endo/zip": "^1.0.9",
"ava": "^6.1.3",
"c8": "^7.14.0",
"eslint": "^8.57.0",
"typescript": "~5.6.2"
"typescript": "~5.6.3"
},

@@ -90,3 +91,3 @@ "keywords": [],

},
"gitHead": "c242c28a68d1af29475150e44b5f3e9d0feda8cd"
"gitHead": "5486ed1f238104716b6a8321b977fbc508ef80e1"
}

@@ -60,2 +60,21 @@ # Bundle Source

## TypeScript type erasure
TypeScript modules with the `.ts`, `.mts`, and `.cts` extensions in
packages that are not under a `node_modules` directory are automatically
converted to JavaScript through type erasure using
[`ts-blank-space`](https://bloomberg.github.io/ts-blank-space/).
This will not function for packages that are published as their original
TypeScript sources, as is consistent with `node
--experimental-strip-types`.
This will also not function properly for TypeScript modules that have
[runtime impacting syntax](https://github.com/bloomberg/ts-blank-space/blob/main/docs/unsupported_syntax.md),
such as `enum`.
This also does not support importing a `.ts` file using the corresponding
imaginary, generated module with a `.js` extension.
Use this feature in conjunction with
[`--allowImportingTsExtensions`](https://www.typescriptlang.org/tsconfig/#allowImportingTsExtensions).
## Source maps

@@ -62,0 +81,0 @@

@@ -17,9 +17,19 @@ export function makeBundlingKit({ pathResolve, userInfo, computeSha512, platform, env }: {

parserForLanguage: Readonly<{
readonly mjs: import("../../../node_modules/@endo/compartment-mapper/src/types.js").ParserImplementation;
readonly cjs: import("../../../node_modules/@endo/compartment-mapper/src/types.js").ParserImplementation;
readonly json: import("../../../node_modules/@endo/compartment-mapper/src/types.js").ParserImplementation;
readonly text: import("../../../node_modules/@endo/compartment-mapper/src/types.js").ParserImplementation;
readonly bytes: import("../../../node_modules/@endo/compartment-mapper/src/types.js").ParserImplementation;
readonly mjs: import("@endo/compartment-mapper/archive-parsers.js").ParserImplementation;
readonly cjs: import("@endo/compartment-mapper/archive-parsers.js").ParserImplementation;
readonly json: import("@endo/compartment-mapper/archive-parsers.js").ParserImplementation;
readonly text: import("@endo/compartment-mapper/archive-parsers.js").ParserImplementation;
readonly bytes: import("@endo/compartment-mapper/archive-parsers.js").ParserImplementation;
}>;
workspaceLanguageForExtension: {
mts: string;
cts: string;
};
workspaceModuleLanguageForExtension: {
ts: string;
};
workspaceCommonjsLanguageForExtension: {
ts: string;
};
};
//# sourceMappingURL=endo.d.ts.map

@@ -128,6 +128,9 @@ // @ts-nocheck

let parserForLanguage = transparentParserForLanguage;
let moduleTransforms = {};
if (!noTransforms) {
parserForLanguage = transformingParserForLanguage;
moduleTransforms = {
...moduleTransforms,
async mjs(

@@ -166,2 +169,28 @@ sourceBytes,

const mtsParser = {
async parse(sourceBytes, ...rest) {
const { default: tsBlankSpace } = await import('ts-blank-space');
const sourceText = textDecoder.decode(sourceBytes);
const objectText = tsBlankSpace(sourceText);
const objectBytes = textEncoder.encode(objectText);
return parserForLanguage.mjs.parse(objectBytes, ...rest);
},
heuristicImports: false,
synchronous: false,
};
const ctsParser = {
async parse(sourceBytes, ...rest) {
const { default: tsBlankSpace } = await import('ts-blank-space');
const sourceText = textDecoder.decode(sourceBytes);
const objectText = tsBlankSpace(sourceText);
const objectBytes = textEncoder.encode(objectText);
return parserForLanguage.cjs.parse(objectBytes, ...rest);
},
heuristicImports: true,
synchronous: false,
};
parserForLanguage = { ...parserForLanguage, mts: mtsParser, cts: ctsParser };
const sourceMapHook = (sourceMap, sourceDescriptor) => {

@@ -171,3 +200,15 @@ sourceMapJobs.add(writeSourceMap(sourceMap, sourceDescriptor));

return { sourceMapHook, sourceMapJobs, moduleTransforms, parserForLanguage };
const workspaceLanguageForExtension = { mts: 'mts', cts: 'cts' };
const workspaceModuleLanguageForExtension = { ts: 'mts' };
const workspaceCommonjsLanguageForExtension = { ts: 'cts' };
return {
sourceMapHook,
sourceMapJobs,
moduleTransforms,
parserForLanguage,
workspaceLanguageForExtension,
workspaceModuleLanguageForExtension,
workspaceCommonjsLanguageForExtension,
};
};

@@ -57,19 +57,26 @@ // @ts-nocheck

const { sourceMapHook, sourceMapJobs, moduleTransforms, parserForLanguage } =
makeBundlingKit(
{
pathResolve,
userInfo,
platform,
env,
computeSha512,
},
{
cacheSourceMaps,
noTransforms,
elideComments,
commonDependencies,
dev,
},
);
const {
sourceMapHook,
sourceMapJobs,
moduleTransforms,
parserForLanguage,
workspaceLanguageForExtension,
workspaceCommonjsLanguageForExtension,
workspaceModuleLanguageForExtension,
} = makeBundlingKit(
{
pathResolve,
userInfo,
platform,
env,
computeSha512,
},
{
cacheSourceMaps,
noTransforms,
elideComments,
commonDependencies,
dev,
},
);

@@ -81,2 +88,5 @@ const source = await makeBundle(powers, entry, {

parserForLanguage,
workspaceLanguageForExtension,
workspaceCommonjsLanguageForExtension,
workspaceModuleLanguageForExtension,
moduleTransforms,

@@ -83,0 +93,0 @@ sourceMapHook,

@@ -59,18 +59,25 @@ // @ts-nocheck

const { sourceMapHook, sourceMapJobs, moduleTransforms, parserForLanguage } =
makeBundlingKit(
{
pathResolve,
userInfo,
platform,
env,
computeSha512,
},
{
cacheSourceMaps,
noTransforms,
elideComments,
commonDependencies,
},
);
const {
sourceMapHook,
sourceMapJobs,
moduleTransforms,
parserForLanguage,
workspaceLanguageForExtension,
workspaceCommonjsLanguageForExtension,
workspaceModuleLanguageForExtension,
} = makeBundlingKit(
{
pathResolve,
userInfo,
platform,
env,
computeSha512,
},
{
cacheSourceMaps,
noTransforms,
elideComments,
commonDependencies,
},
);

@@ -81,2 +88,5 @@ const compartmentMap = await mapNodeModules(powers, entry, {

commonDependencies,
workspaceLanguageForExtension,
workspaceCommonjsLanguageForExtension,
workspaceModuleLanguageForExtension,
});

@@ -83,0 +93,0 @@

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