Skip to content

Commit

Permalink
chore(bundle-source): consume @endo/evasive-transform
Browse files Browse the repository at this point in the history
This jettisons `src/transform.js` and consumes `@endo/evasive-transform` instead.
  • Loading branch information
boneskull committed Oct 21, 2023
1 parent 71c5db0 commit 93d3a29
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 145 deletions.
7 changes: 2 additions & 5 deletions packages/bundle-source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,17 @@
"lint:types": "tsc"
},
"dependencies": {
"@agoric/babel-generator": "^7.17.4",
"@babel/parser": "^7.17.3",
"@babel/traverse": "^7.17.3",
"@endo/base64": "^0.2.35",
"@endo/compartment-mapper": "^0.9.2",
"@endo/init": "^0.5.60",
"@endo/promise-kit": "^0.2.60",
"@endo/evasive-transform": "^0.1.3",
"@endo/where": "^0.3.5",
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"acorn": "^8.2.4",
"jessie.js": "^0.3.2",
"rollup": "^2.79.1",
"source-map": "^0.7.3"
"rollup": "^2.79.1"
},
"devDependencies": {
"@endo/lockdown": "^0.1.32",
Expand Down
6 changes: 3 additions & 3 deletions packages/bundle-source/src/nested-evaluate-and-get-exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import url from 'url';
import { rollup as rollup0 } from 'rollup';
import resolve0 from '@rollup/plugin-node-resolve';
import commonjs0 from '@rollup/plugin-commonjs';
import { transformSource } from './transform.js';
import { evadeCensor } from '@endo/evasive-transform';

const DEFAULT_FILE_PREFIX = '/bundled-source/...';

Expand Down Expand Up @@ -95,9 +95,9 @@ export async function bundleNestedEvaluateAndGetExports(
const useLocationUnmap =
moduleFormat === 'nestedEvaluate' && !fileName.startsWith('_virtual/');

const { code: transformedCode } = await transformSource(code, {
sourceMapUrl: pathname,
const { code: transformedCode } = await evadeCensor(code, {
sourceMap: chunk.map,
sourceUrl: pathname,
useLocationUnmap,
});
unsortedSourceBundle[shortName] = transformedCode;
Expand Down
131 changes: 0 additions & 131 deletions packages/bundle-source/src/transform.js

This file was deleted.

8 changes: 4 additions & 4 deletions packages/bundle-source/src/zip-base64.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { makeAndHashArchive } from '@endo/compartment-mapper/archive.js';
import { encodeBase64 } from '@endo/base64';
import { whereEndoCache } from '@endo/where';
import { makeReadPowers } from '@endo/compartment-mapper/node-powers.js';
import { transformSource } from './transform.js';
import { evadeCensor } from '@endo/evasive-transform';

const textEncoder = new TextEncoder();
const textDecoder = new TextDecoder();
Expand Down Expand Up @@ -119,10 +119,10 @@ export async function bundleZipBase64(
) {
const source = textDecoder.decode(sourceBytes);
let object;
({ code: object, map: sourceMap } = await transformSource(source, {
sourceType: 'module',
({ code: object, map: sourceMap } = await evadeCensor(source, {
sourceMap,
sourceMapUrl: new URL(specifier, location).href,
sourceUrl: new URL(specifier, location).href,
sourceType: 'module',
}));
const objectBytes = textEncoder.encode(object);
return { bytes: objectBytes, parser: 'mjs', sourceMap };
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf"
integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==

"@agoric/babel-generator@7.17.6", "@agoric/babel-generator@^7.17.4", "@agoric/babel-generator@^7.17.6":
"@agoric/babel-generator@7.17.6", "@agoric/babel-generator@^7.17.6":
version "7.17.6"
resolved "https://registry.yarnpkg.com/@agoric/babel-generator/-/babel-generator-7.17.6.tgz#75ff4629468a481d670b4154bcfade11af6de674"
integrity sha512-D2wnk5fGajxMN5SCRSaA/triQGEaEX2Du0EzrRqobuD4wRXjvtF1e7jC1PPOk/RC2bZ8/0fzp0CHOiB7YLwb5w==
Expand Down Expand Up @@ -11146,7 +11146,7 @@ source-map@0.6.1, source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==

source-map@0.7.4, source-map@^0.7.3:
source-map@0.7.4:
version "0.7.4"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656"
integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==
Expand Down

0 comments on commit 93d3a29

Please sign in to comment.