aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/release/acorn.sh97
-rwxr-xr-xtest/release/buble.sh44
-rwxr-xr-xtest/release/butternut.sh44
-rwxr-xr-xtest/release/rollup-es.sh83
-rwxr-xr-xtest/release/rollup-ts.sh45
-rwxr-xr-xtest/release/sucrase.sh90
6 files changed, 403 insertions, 0 deletions
diff --git a/test/release/acorn.sh b/test/release/acorn.sh
new file mode 100755
index 00000000..99e5c93d
--- /dev/null
+++ b/test/release/acorn.sh
@@ -0,0 +1,97 @@
+#!/bin/sh
+
+alias uglify-js=$PWD/bin/uglifyjs
+UGLIFY_OPTIONS=$@
+
+minify_in_situ() {
+ DIRS="$1"
+ echo '> uglify-js' $DIRS $UGLIFY_OPTIONS
+ for i in `find $DIRS -name '*.js'`
+ do
+ echo "$i"
+ uglify-js "$i" $UGLIFY_OPTIONS -o "$i"
+ done
+}
+
+rm -rf tmp/acorn \
+&& git clone https://github.com/acornjs/acorn.git tmp/acorn \
+&& cd tmp/acorn \
+&& rm -rf .git/hooks \
+&& git checkout 74b59384320ced82e09da2e8fdbed16810f7379a \
+&& patch -l -p1 <<EOF
+diff --git a/acorn-loose/rollup.config.js b/acorn-loose/rollup.config.js
+index d2389b2..c37882b 100644
+--- a/acorn-loose/rollup.config.js
++++ b/acorn-loose/rollup.config.js
+@@ -1,2 +0,0 @@
+-import buble from "rollup-plugin-buble"
+-
+@@ -23 +20,0 @@ export default {
+- buble({transforms: {dangerousForOf: true}})
+diff --git a/acorn-walk/rollup.config.js b/acorn-walk/rollup.config.js
+index 67dd613..8c28807 100644
+--- a/acorn-walk/rollup.config.js
++++ b/acorn-walk/rollup.config.js
+@@ -1,2 +0,0 @@
+-import buble from "rollup-plugin-buble"
+-
+@@ -19 +16,0 @@ export default {
+- buble({transforms: {dangerousForOf: true}})
+diff --git a/acorn/rollup.config.bin.js b/acorn/rollup.config.bin.js
+index 8a082b0..b3eda60 100644
+--- a/acorn/rollup.config.bin.js
++++ b/acorn/rollup.config.bin.js
+@@ -1,2 +0,0 @@
+-import buble from "rollup-plugin-buble"
+-
+@@ -11 +9 @@ export default {
+- plugins: [buble()]
++ plugins: []
+diff --git a/acorn/rollup.config.js b/acorn/rollup.config.js
+index c775a0c..cfd4c68 100644
+--- a/acorn/rollup.config.js
++++ b/acorn/rollup.config.js
+@@ -1,2 +0,0 @@
+-import buble from "rollup-plugin-buble"
+-
+@@ -19 +16,0 @@ export default {
+- buble({transforms: {dangerousForOf: true}})
+diff --git a/package.json b/package.json
+index 382f59e..4612a75 100644
+--- a/package.json
++++ b/package.json
+@@ -24,4 +24 @@
+- "prepare": "npm run test",
+- "test": "node test/run.js && node test/lint.js",
+- "pretest": "npm run build:main && npm run build:loose",
+- "test:test262": "node bin/run_test262.js",
++ "test": "node test/run.js",
+@@ -32,2 +29 @@
+- "build:bin": "rollup -c acorn/rollup.config.bin.js",
+- "lint": "eslint acorn/src/ acorn-walk/src/ acorn-loose/src/"
++ "build:bin": "rollup -c acorn/rollup.config.bin.js"
+@@ -36,6 +31,0 @@
+- "eslint": "^4.10.0",
+- "eslint-config-standard": "^10.2.1",
+- "eslint-plugin-import": "^2.2.0",
+- "eslint-plugin-node": "^5.2.1",
+- "eslint-plugin-promise": "^3.5.0",
+- "eslint-plugin-standard": "^3.0.1",
+@@ -43,4 +32,0 @@
+- "rollup-plugin-buble": "^0.19.0",
+- "test262": "git+https://github.com/tc39/test262.git#a6c819ad0f049f23f1a37af6b89dbb79fe3b9216",
+- "test262-parser-runner": "^0.5.0",
+- "test262-stream": "^1.2.1",
+EOF
+ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi
+minify_in_situ "acorn/src" \
+&& minify_in_situ "acorn-loose/src" \
+&& minify_in_situ "acorn-walk/src" \
+&& rm -rf node_modules \
+&& npm install \
+&& rm -rf acorn/dist acorn-loose/dist acorn-walk/dist \
+&& npm run build \
+&& minify_in_situ "acorn/dist" \
+&& minify_in_situ "acorn-loose/dist" \
+&& minify_in_situ "acorn-walk/dist" \
+&& npm test
diff --git a/test/release/buble.sh b/test/release/buble.sh
new file mode 100755
index 00000000..6a14ecad
--- /dev/null
+++ b/test/release/buble.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+alias uglify-js=$PWD/bin/uglifyjs
+UGLIFY_OPTIONS=$@
+
+minify_in_situ() {
+ DIRS="$1"
+ echo '> uglify-js' $DIRS $UGLIFY_OPTIONS
+ for i in `find $DIRS -name '*.js'`
+ do
+ echo "$i"
+ uglify-js "$i" $UGLIFY_OPTIONS -o "$i"
+ done
+}
+
+rm -rf tmp/buble \
+&& git clone https://github.com/bublejs/buble.git tmp/buble \
+&& cd tmp/buble \
+&& rm -rf .git/hooks \
+&& git checkout dcc5ab02c9af6ddaad94e587c4911677340ec100 \
+&& patch -l -p1 <<EOF
+--- a/package.json
++++ b/package.json
+@@ -29 +28,0 @@
+- "prepublish": "npm test",
+@@ -67,3 +66 @@
+- "source-map-support": "^0.5.16",
+- "test262": "git+https://github.com/tc39/test262.git#4f1155c566a222238fd86f179c6635ecb4c289bb",
+- "test262-stream": "^1.3.0"
++ "source-map-support": "^0.5.16"
+--- a/src/program/BlockStatement.js
++++ b/src/program/BlockStatement.js
+@@ -309 +309 @@ export default class BlockStatement extends Node {
+- let cont = false; // TODO implement proper continue...
++ let cont = !declarations; // TODO implement proper continue...
+EOF
+ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi
+minify_in_situ "src" \
+&& rm -rf node_modules \
+&& npm ci \
+&& rm -rf dist \
+&& npm run build \
+&& minify_in_situ "dist" \
+&& node_modules/.bin/mocha
diff --git a/test/release/butternut.sh b/test/release/butternut.sh
new file mode 100755
index 00000000..b62c9371
--- /dev/null
+++ b/test/release/butternut.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+alias uglify-js=$PWD/bin/uglifyjs
+UGLIFY_OPTIONS=$@
+
+minify_in_situ() {
+ DIRS="$1"
+ echo '> uglify-js' $DIRS $UGLIFY_OPTIONS
+ for i in `find $DIRS -name '*.js'`
+ do
+ echo "$i"
+ uglify-js "$i" $UGLIFY_OPTIONS -o "$i"
+ done
+}
+
+rm -rf tmp/butternut \
+&& git clone https://github.com/Rich-Harris/butternut.git tmp/butternut \
+&& cd tmp/butternut \
+&& rm -rf .git/hooks \
+&& patch -l -p1 <<EOF
+--- a/package.json
++++ b/package.json
+@@ -25 +24,0 @@
+- "prepublish": "npm run test:min",
+--- a/rollup.config.js
++++ b/rollup.config.js
+@@ -1 +0,0 @@
+-import buble from 'rollup-plugin-buble';
+@@ -28,6 +26,0 @@ const config = {
+- buble({
+- include: ['src/**', 'node_modules/acorn/**'],
+- transforms: {
+- dangerousForOf: true
+- }
+- }),
+EOF
+ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi
+minify_in_situ "src" \
+&& rm -rf node_modules \
+&& npm install \
+&& rm -rf dist \
+&& npm run build \
+&& minify_in_situ "dist" \
+&& node_modules/.bin/mocha test/test.js
diff --git a/test/release/rollup-es.sh b/test/release/rollup-es.sh
new file mode 100755
index 00000000..f9443ff8
--- /dev/null
+++ b/test/release/rollup-es.sh
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+alias uglify-js=$PWD/bin/uglifyjs
+UGLIFY_OPTIONS=$@
+
+minify_in_situ() {
+ DIRS="$1"
+ echo '> uglify-js' $DIRS $UGLIFY_OPTIONS
+ for i in `find $DIRS -name '*.js'`
+ do
+ echo "$i"
+ uglify-js "$i" $UGLIFY_OPTIONS -o "$i"
+ done
+}
+
+rm -rf tmp/rollup \
+&& git clone https://github.com/rollup/rollup.git tmp/rollup \
+&& cd tmp/rollup \
+&& rm -rf .git/hooks \
+&& git checkout 3d80c06f895eab41e648ee99786fa68c72458b80 \
+&& patch -l -p1 <<EOF
+--- a/package.json
++++ b/package.json
+@@ -23 +22,0 @@
+- "prepublishOnly": "npm run lint && npm run test:only && npm run test:leak",
+--- a/rollup.config.js
++++ b/rollup.config.js
+@@ -1,5 +1,4 @@
+ import { readFileSync } from 'fs';
+-import buble from 'rollup-plugin-buble';
+ import resolve from 'rollup-plugin-node-resolve';
+ import commonjs from 'rollup-plugin-commonjs';
+ import json from 'rollup-plugin-json';
+@@ -25,12 +24,6 @@ export default [
+ input: 'src/node-entry.js',
+ plugins: [
+ json(),
+- buble({
+- include: ['src/**', 'node_modules/acorn/**'],
+- target: {
+- node: '4'
+- }
+- }),
+ resolve(),
+ commonjs()
+ ],
+@@ -48,12 +41,6 @@ export default [
+ input: 'src/browser-entry.js',
+ plugins: [
+ json(),
+- buble({
+- include: ['src/**', 'node_modules/acorn/**'],
+- target: {
+- node: '4'
+- }
+- }),
+ resolve(),
+ commonjs(),
+ {
+@@ -80,7 +67,6 @@ export default [
+ plugins: [
+ string({ include: '**/*.md' }),
+ json(),
+- buble({ target: { node: 4 } }),
+ commonjs({
+ include: 'node_modules/**'
+ }),
+--- a/test/mocha.opts
++++ b/test/mocha.opts
+@@ -1,2 +1 @@
+---require buble/register
+ test/test.js
+EOF
+ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi
+minify_in_situ "bin" \
+&& minify_in_situ "browser" \
+&& minify_in_situ "src" \
+&& rm -rf node_modules \
+&& npm ci \
+&& rm -rf dist \
+&& npm run build \
+&& minify_in_situ "dist" \
+&& node_modules/.bin/mocha
diff --git a/test/release/rollup-ts.sh b/test/release/rollup-ts.sh
new file mode 100755
index 00000000..d1888a5c
--- /dev/null
+++ b/test/release/rollup-ts.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+alias uglify-js=$PWD/bin/uglifyjs
+UGLIFY_OPTIONS=$@
+
+minify_in_situ() {
+ DIRS="$1"
+ echo '> uglify-js' $DIRS $UGLIFY_OPTIONS
+ for i in `find $DIRS -name '*.js'`
+ do
+ echo "$i"
+ uglify-js "$i" $UGLIFY_OPTIONS -o "$i"
+ done
+ for i in `find $DIRS -name '*.ts' | grep -v '\.d\.ts'`
+ do
+ echo "$i"
+ node_modules/.bin/esbuild --loader=ts --target=node14 < "$i" \
+ | uglify-js $UGLIFY_OPTIONS -o "$i"
+ done
+}
+
+rm -rf tmp/rollup \
+&& git clone --depth 1 --branch v2.39.1 https://github.com/rollup/rollup.git tmp/rollup \
+&& cd tmp/rollup \
+&& rm -rf .git/hooks \
+&& patch -l -p1 <<EOF
+--- a/package.json
++++ b/package.json
+@@ -27,4 +26,0 @@
+- "postinstall": "husky install",
+- "postpublish": "pinst --enable",
+- "prepare": "npm run build",
+- "prepublishOnly": "pinst --disable && npm ci && npm run lint:nofix && npm run security && npm run build:bootstrap && npm run test:all",
+EOF
+ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi
+npm install esbuild-wasm@0.8.56 \
+&& minify_in_situ "cli" \
+&& minify_in_situ "src" \
+&& rm -rf node_modules \
+&& npm ci \
+&& rm -rf dist \
+&& npm run build \
+&& minify_in_situ "dist" \
+&& node_modules/.bin/mocha test/test.js \
+&& node_modules/.bin/mocha test/browser/index.js
diff --git a/test/release/sucrase.sh b/test/release/sucrase.sh
new file mode 100755
index 00000000..4ac04d9d
--- /dev/null
+++ b/test/release/sucrase.sh
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+alias uglify-js=$PWD/bin/uglifyjs
+UGLIFY_OPTIONS=$@
+
+minify_in_situ() {
+ DIRS="$1"
+ echo '> uglify-js' $DIRS $UGLIFY_OPTIONS
+ for i in `find $DIRS -name '*.js'`
+ do
+ echo "$i"
+ uglify-js "$i" $UGLIFY_OPTIONS -o "$i"
+ done
+ for i in `find $DIRS -name '*.mjs'`
+ do
+ echo "$i"
+ uglify-js "$i" $UGLIFY_OPTIONS -o "$i"
+ done
+ for i in `find $DIRS -name '*.ts' | grep -v '\.d\.ts'`
+ do
+ echo "$i"
+ node_modules/.bin/esbuild --loader=ts --target=node14 < "$i" \
+ | uglify-js $UGLIFY_OPTIONS -o "$i"
+ done
+}
+
+rm -rf tmp/sucrase \
+&& git clone https://github.com/alangpierce/sucrase.git tmp/sucrase \
+&& cd tmp/sucrase \
+&& rm -rf .git/hooks \
+&& git checkout 38b66f3009feb76750a799deea211adcc83574f1 \
+&& patch -l -p1 <<EOF
+--- a/package.json
++++ b/package.json
+@@ -25 +24,0 @@
+- "prepublishOnly": "yarn clean && yarn build",
+@@ -65 +63,0 @@
+- "test262-harness": "^6.5.0",
+--- a/script/build.ts
++++ b/script/build.ts
+@@ -16 +15,0 @@ async function main(): Promise<void> {
+- () => buildBenchmark(),
+@@ -18,5 +16,0 @@ async function main(): Promise<void> {
+- () => buildIntegration("./integrations/gulp-plugin"),
+- () => buildIntegration("./integrations/jest-plugin"),
+- () => buildIntegration("./integrations/webpack-loader"),
+- () => buildIntegration("./integrations/webpack-object-rest-spread-plugin"),
+- () => buildWebsite(),
+@@ -66,3 +59,0 @@ async function buildSucrase(): Promise<void> {
+- // Also add in .d.ts files from tsc, which only need to be compiled once.
+- await run(\`\${TSC} --project ./src --outDir ./dist-types\`);
+- await mergeDirectoryContents("./dist-types/src", "./dist");
+@@ -70 +61 @@ async function buildSucrase(): Promise<void> {
+- await run("yarn link");
++ await run("npm link");
+--- a/src/identifyShadowedGlobals.ts
++++ b/src/identifyShadowedGlobals.ts
+@@ -23,0 +24 @@ export default function identifyShadowedGlobals(
++export { identifyShadowedGlobals as HACK };
+--- a/src/parser/tokenizer/state.ts
++++ b/src/parser/tokenizer/state.ts
+@@ -100,0 +101 @@ export default class State {
++export { State as HACK };
+--- a/src/transformers/JSXTransformer.ts
++++ b/src/transformers/JSXTransformer.ts
+@@ -253,0 +254 @@ export default class JSXTransformer extends Transformer {
++export { JSXTransformer as HACK };
+--- a/src/util/getClassInfo.ts
++++ b/src/util/getClassInfo.ts
+@@ -164,0 +165 @@ export default function getClassInfo(
++export { getClassInfo as HACK };
+--- a/src/util/getDeclarationInfo.ts
++++ b/src/util/getDeclarationInfo.ts
+@@ -40,0 +41 @@ export default function getDeclarationInfo(tokens: TokenProcessor): DeclarationI
++export { getDeclarationInfo as HACK };
+--- a/src/util/getJSXPragmaInfo.ts
++++ b/src/util/getJSXPragmaInfo.ts
+@@ -14,0 +15 @@ export default function getJSXPragmaInfo(options: Options): JSXPragmaInfo {
++export { getJSXPragmaInfo as HACK };
+EOF
+ERR=$?; if [ "$ERR" != "0" ]; then echo "Error: $ERR"; exit $ERR; fi
+npm install esbuild-wasm@0.8.56 \
+&& minify_in_situ "src" \
+&& rm -rf node_modules \
+&& npm install \
+&& npm run clean \
+&& npm run build \
+&& minify_in_situ "dist" \
+&& minify_in_situ "dist-self-build" \
+&& npm run test-only