From e6f5da26ddc4fae85aac17e9aba2e9e011aa1b34 Mon Sep 17 00:00:00 2001 From: William San Date: Thu, 30 Jun 2022 00:52:32 -0400 Subject: [PATCH] Add build stuff Add to rollup config --- package-lock.json | 234 +++++++++++++++++- package.json | 2 + .../buildHelpers/createRollupConfig.js | 9 + packages/explorer/tsconfig.json | 1 + .../buildHelpers/createRollupConfig.js | 9 + packages/sandbox/tsconfig.json | 1 + 6 files changed, 254 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0b4d2bf5..d5f1e82d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,9 @@ "@changesets/changelog-github": "0.4.4", "@changesets/cli": "2.22.0", "@rollup/plugin-babel": "^5.3.1", + "@rollup/plugin-commonjs": "^22.0.1", "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.3.0", "@rollup/plugin-typescript": "^8.3.2", "@size-limit/preset-small-lib": "5.0.5", "@types/fs-extra": "^9.0.13", @@ -1294,6 +1296,33 @@ } } }, + "node_modules/@rollup/plugin-commonjs": { + "version": "22.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-22.0.1.tgz", + "integrity": "sha512-dGfEZvdjDHObBiP5IvwTKMVeq/tBZGMBHZFMdIV1ClMM/YoWS34xrHFGfag9SN2ZtMgNZRFruqvxZQEa70O6nQ==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.1.0", + "commondir": "^1.0.1", + "estree-walker": "^2.0.1", + "glob": "^7.1.6", + "is-reference": "^1.2.1", + "magic-string": "^0.25.7", + "resolve": "^1.17.0" + }, + "engines": { + "node": ">= 12.0.0" + }, + "peerDependencies": { + "rollup": "^2.68.0" + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, "node_modules/@rollup/plugin-json": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", @@ -1306,6 +1335,26 @@ "rollup": "^1.20.0 || ^2.0.0" } }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.3.0.tgz", + "integrity": "sha512-Lus8rbUo1eEcnS4yTFKLZrVumLPY+YayBdWXgFSHYhTT2iJbMhoaaBL3xl5NCdeRytErGr8tZ0L71BMRmnlwSw==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "deepmerge": "^4.2.2", + "is-builtin-module": "^3.1.0", + "is-module": "^1.0.0", + "resolve": "^1.19.0" + }, + "engines": { + "node": ">= 10.0.0" + }, + "peerDependencies": { + "rollup": "^2.42.0" + } + }, "node_modules/@rollup/plugin-typescript": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.3.3.tgz", @@ -1489,6 +1538,12 @@ "@babel/types": "^7.3.0" } }, + "node_modules/@types/estree": { + "version": "0.0.52", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.52.tgz", + "integrity": "sha512-BZWrtCU0bMVAIliIV+HJO1f1PR41M7NKjfxrFJwwhKI1KwhwOxYw1SXg9ao+CIMt774nFuGiG6eU+udtbEI9oQ==", + "dev": true + }, "node_modules/@types/fs-extra": { "version": "9.0.13", "dev": true, @@ -1553,6 +1608,15 @@ "@types/react": "*" } }, + "node_modules/@types/resolve": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/scheduler": { "version": "0.16.2", "dev": true, @@ -2526,6 +2590,18 @@ "dev": true, "license": "MIT" }, + "node_modules/builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/builtin-status-codes": { "version": "3.0.0", "dev": true, @@ -3337,6 +3413,15 @@ "dev": true, "license": "MIT" }, + "node_modules/deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/defaults": { "version": "1.0.3", "dev": true, @@ -5212,6 +5297,18 @@ "dev": true, "license": "MIT" }, + "node_modules/is-builtin-module": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.1.0.tgz", + "integrity": "sha512-OV7JjAgOTfAFJmHZLvpSTb4qi0nIILDV1gWPYDnDJUTNFM5aGlRAhk4QcT8i7TuAleeEV5Fdkqn3t4mS+Q11fg==", + "dev": true, + "dependencies": { + "builtin-modules": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/is-callable": { "version": "1.2.4", "dev": true, @@ -5326,6 +5423,12 @@ "node": ">=0.10.0" } }, + "node_modules/is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", + "dev": true + }, "node_modules/is-negative-zero": { "version": "2.0.2", "dev": true, @@ -5381,6 +5484,15 @@ "node": ">=0.10.0" } }, + "node_modules/is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "dependencies": { + "@types/estree": "*" + } + }, "node_modules/is-regex": { "version": "1.1.4", "dev": true, @@ -5709,6 +5821,15 @@ "node": ">=10" } }, + "node_modules/magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "dev": true, + "dependencies": { + "sourcemap-codec": "^1.4.8" + } + }, "node_modules/map-cache": { "version": "0.2.2", "dev": true, @@ -8098,6 +8219,12 @@ "dev": true, "license": "MIT" }, + "node_modules/sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "dev": true + }, "node_modules/spawndamnit": { "version": "2.0.0", "dev": true, @@ -9668,7 +9795,7 @@ }, "packages/explorer": { "name": "@apollo/explorer", - "version": "0.5.2", + "version": "0.6.0", "license": "MIT", "engines": { "node": ">=12.0", @@ -9693,7 +9820,7 @@ }, "packages/sandbox": { "name": "@apollo/sandbox", - "version": "0.0.0", + "version": "0.6.0", "license": "MIT", "engines": { "node": ">=12.0", @@ -10630,6 +10757,29 @@ "@rollup/pluginutils": "^3.1.0" } }, + "@rollup/plugin-commonjs": { + "version": "22.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-22.0.1.tgz", + "integrity": "sha512-dGfEZvdjDHObBiP5IvwTKMVeq/tBZGMBHZFMdIV1ClMM/YoWS34xrHFGfag9SN2ZtMgNZRFruqvxZQEa70O6nQ==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "commondir": "^1.0.1", + "estree-walker": "^2.0.1", + "glob": "^7.1.6", + "is-reference": "^1.2.1", + "magic-string": "^0.25.7", + "resolve": "^1.17.0" + }, + "dependencies": { + "estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + } + } + }, "@rollup/plugin-json": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", @@ -10639,6 +10789,20 @@ "@rollup/pluginutils": "^3.0.8" } }, + "@rollup/plugin-node-resolve": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.3.0.tgz", + "integrity": "sha512-Lus8rbUo1eEcnS4yTFKLZrVumLPY+YayBdWXgFSHYhTT2iJbMhoaaBL3xl5NCdeRytErGr8tZ0L71BMRmnlwSw==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "deepmerge": "^4.2.2", + "is-builtin-module": "^3.1.0", + "is-module": "^1.0.0", + "resolve": "^1.19.0" + } + }, "@rollup/plugin-typescript": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.3.3.tgz", @@ -10759,6 +10923,12 @@ "@babel/types": "^7.3.0" } }, + "@types/estree": { + "version": "0.0.52", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.52.tgz", + "integrity": "sha512-BZWrtCU0bMVAIliIV+HJO1f1PR41M7NKjfxrFJwwhKI1KwhwOxYw1SXg9ao+CIMt774nFuGiG6eU+udtbEI9oQ==", + "dev": true + }, "@types/fs-extra": { "version": "9.0.13", "dev": true, @@ -10813,6 +10983,15 @@ "@types/react": "*" } }, + "@types/resolve": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/scheduler": { "version": "0.16.2", "dev": true @@ -11467,6 +11646,12 @@ "version": "1.0.3", "dev": true }, + "builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", + "dev": true + }, "builtin-status-codes": { "version": "3.0.0", "dev": true @@ -12018,6 +12203,12 @@ "version": "0.1.4", "dev": true }, + "deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true + }, "defaults": { "version": "1.0.3", "dev": true, @@ -13270,6 +13461,15 @@ "version": "1.1.6", "dev": true }, + "is-builtin-module": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.1.0.tgz", + "integrity": "sha512-OV7JjAgOTfAFJmHZLvpSTb4qi0nIILDV1gWPYDnDJUTNFM5aGlRAhk4QcT8i7TuAleeEV5Fdkqn3t4mS+Q11fg==", + "dev": true, + "requires": { + "builtin-modules": "^3.0.0" + } + }, "is-callable": { "version": "1.2.4", "dev": true @@ -13338,6 +13538,12 @@ "is-extglob": "^2.1.1" } }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", + "dev": true + }, "is-negative-zero": { "version": "2.0.2", "dev": true @@ -13367,6 +13573,15 @@ "isobject": "^3.0.1" } }, + "is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "requires": { + "@types/estree": "*" + } + }, "is-regex": { "version": "1.1.4", "dev": true, @@ -13579,6 +13794,15 @@ "yallist": "^4.0.0" } }, + "magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "dev": true, + "requires": { + "sourcemap-codec": "^1.4.8" + } + }, "map-cache": { "version": "0.2.2", "dev": true @@ -15106,6 +15330,12 @@ "version": "0.4.1", "dev": true }, + "sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "dev": true + }, "spawndamnit": { "version": "2.0.0", "dev": true, diff --git a/package.json b/package.json index 13641ab9..addf9cc3 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,9 @@ "@changesets/changelog-github": "0.4.4", "@changesets/cli": "2.22.0", "@rollup/plugin-babel": "^5.3.1", + "@rollup/plugin-commonjs": "^22.0.1", "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.3.0", "@rollup/plugin-typescript": "^8.3.2", "@size-limit/preset-small-lib": "5.0.5", "@types/fs-extra": "^9.0.13", diff --git a/packages/explorer/buildHelpers/createRollupConfig.js b/packages/explorer/buildHelpers/createRollupConfig.js index 8ac1e2f7..287c0c42 100644 --- a/packages/explorer/buildHelpers/createRollupConfig.js +++ b/packages/explorer/buildHelpers/createRollupConfig.js @@ -1,3 +1,5 @@ +import commonjs from '@rollup/plugin-commonjs'; +import resolve from '@rollup/plugin-node-resolve'; import typescript from '@rollup/plugin-typescript'; import { terser } from 'rollup-plugin-terser'; import babel from '@rollup/plugin-babel'; @@ -54,8 +56,15 @@ function createUMDRollupConfig(options) { extensions: ['.js', '.jsx', '.ts', '.tsx'], babelHelpers: 'bundled', }), + resolve({ + jsnext: true, + main: true, + browser: true, + }), + commonjs(), json(), ], + context: 'this', }; } diff --git a/packages/explorer/tsconfig.json b/packages/explorer/tsconfig.json index 5209bda0..4d1f184e 100644 --- a/packages/explorer/tsconfig.json +++ b/packages/explorer/tsconfig.json @@ -3,6 +3,7 @@ "include": ["src", "src/index.ts", "buildHelpers"], "compilerOptions": { "outDir": "dist", + "target": "es6", "rootDir": "." } } diff --git a/packages/sandbox/buildHelpers/createRollupConfig.js b/packages/sandbox/buildHelpers/createRollupConfig.js index 48ad4411..42a9c085 100644 --- a/packages/sandbox/buildHelpers/createRollupConfig.js +++ b/packages/sandbox/buildHelpers/createRollupConfig.js @@ -1,3 +1,5 @@ +import commonjs from '@rollup/plugin-commonjs'; +import resolve from '@rollup/plugin-node-resolve'; import typescript from '@rollup/plugin-typescript'; import { terser } from 'rollup-plugin-terser'; import babel from '@rollup/plugin-babel'; @@ -54,8 +56,15 @@ function createUMDRollupConfig(options) { extensions: ['.js', '.jsx', '.ts', '.tsx'], babelHelpers: 'bundled', }), + resolve({ + jsnext: true, + main: true, + browser: true, + }), + commonjs(), json(), ], + context: 'this', }; } diff --git a/packages/sandbox/tsconfig.json b/packages/sandbox/tsconfig.json index 0e1beacc..18466ee6 100644 --- a/packages/sandbox/tsconfig.json +++ b/packages/sandbox/tsconfig.json @@ -3,6 +3,7 @@ "include": ["src", "src/index.ts", "buildHelpers"], "compilerOptions": { "outDir": "dist", + "target": "es6", "rootDir": "." } } \ No newline at end of file