From 04b145f4b4e274b6d2059e88895943cb9623c3f9 Mon Sep 17 00:00:00 2001 From: Luke Sheard Date: Mon, 21 Jan 2019 09:44:47 +0000 Subject: [PATCH 1/2] add cjs-assets for perspective --- .gitignore | 1 + packages/perspective/babel.config.js | 14 +++++++------- packages/perspective/package.json | 7 ++++--- .../perspective/src/config/perspective.config.js | 2 +- .../src/config/perspective.node.config.js | 2 +- .../src/loader/cross_origin_file_loader.js | 2 +- .../perspective/src/loader/file_worker_loader.js | 2 +- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 83ce9be473..fb2899ab11 100644 --- a/.gitignore +++ b/.gitignore @@ -121,6 +121,7 @@ website/static/css/material.dark.css # CPP Compile /src/include/boost +cjs obj packages/perspective/es5 cppbuild diff --git a/packages/perspective/babel.config.js b/packages/perspective/babel.config.js index 1e79088b01..10c0065ee7 100644 --- a/packages/perspective/babel.config.js +++ b/packages/perspective/babel.config.js @@ -1,22 +1,22 @@ module.exports = { - presets: [ + "presets": [ [ "@babel/preset-env", { - useBuiltIns: "usage" + "useBuiltIns": "usage" } ] ], - sourceType: "unambiguous", - plugins: [ + "sourceType": "unambiguous", + "plugins": [ "module:fast-async", - ["@babel/plugin-proposal-decorators", {legacy: true}], + ["@babel/plugin-proposal-decorators", {"legacy": true}], "transform-custom-element-classes", [ "@babel/plugin-transform-for-of", { - loose: true + "loose": true } ] ] -}; +} diff --git a/packages/perspective/package.json b/packages/perspective/package.json index ceb168b583..bc651ca8f7 100644 --- a/packages/perspective/package.json +++ b/packages/perspective/package.json @@ -3,14 +3,14 @@ "version": "0.2.12", "description": "Perspective.js", "main": "build/perspective.node.js", - "browser": "src/js/perspective.parallel.js", + "browser": "cjs/js/perspective.parallel.js", "publishConfig": { "access": "public" }, "files": [ "build/*", + "cjs/**/*", "index.d.ts", - "src/**/*", "webpack-plugin.js", "babel.config.js" ], @@ -19,7 +19,8 @@ "bench": "node ../../scripts/bench.js", "prebuild": "mkdir -p build && mkdir -p obj", "cpp": "npm-run-all build:cpp test:cpp", - "build": "npm-run-all build:webpack", + "build": "npm-run-all build:babel build:webpack", + "build:babel": "babel src/js --out-dir cjs/js", "build:webpack": "npm-run-all -p build:webpack:*", "build:webpack:umd": "webpack --color --config src/config/perspective.config.js", "build:webpack:node": "webpack --color --config src/config/perspective.node.config.js", diff --git a/packages/perspective/src/config/perspective.config.js b/packages/perspective/src/config/perspective.config.js index e22a691457..18e4d903c3 100644 --- a/packages/perspective/src/config/perspective.config.js +++ b/packages/perspective/src/config/perspective.config.js @@ -2,7 +2,7 @@ const path = require("path"); const common = require("./common.config.js"); module.exports = Object.assign({}, common({build_worker: true}), { - entry: "./src/js/perspective.parallel.js", + entry: "./cjs/js/perspective.parallel.js", output: { filename: "perspective.js", library: "perspective", diff --git a/packages/perspective/src/config/perspective.node.config.js b/packages/perspective/src/config/perspective.node.config.js index 9c174ab613..afeeecff02 100644 --- a/packages/perspective/src/config/perspective.node.config.js +++ b/packages/perspective/src/config/perspective.node.config.js @@ -2,7 +2,7 @@ const path = require("path"); const common = require("./common.config.js"); module.exports = Object.assign({}, common(), { - entry: "./src/js/perspective.node.js", + entry: "./cjs/js/perspective.node.js", target: "node", externals: [/^([a-z0-9]|\@(?!apache\-arrow)).*?(?!wasm)$/g], node: { diff --git a/packages/perspective/src/loader/cross_origin_file_loader.js b/packages/perspective/src/loader/cross_origin_file_loader.js index 8224bbf77e..a2e688bcb7 100644 --- a/packages/perspective/src/loader/cross_origin_file_loader.js +++ b/packages/perspective/src/loader/cross_origin_file_loader.js @@ -32,7 +32,7 @@ exports.pitch = function pitch(request) { validateOptions(schema, options, "Cross Origin File Loader"); var context = options.context || this.rootContext || (this.options && this.options.context); - var content = fs.readFileSync(request.replace("src/js", "build").replace("wasm.js", "wasm")); + var content = fs.readFileSync(request.replace("cjs/js", "build").replace("wasm.js", "wasm")); var url = loaderUtils.interpolateName(this, options.name, { context, content, diff --git a/packages/perspective/src/loader/file_worker_loader.js b/packages/perspective/src/loader/file_worker_loader.js index f56d54e4bc..299a8f46b7 100644 --- a/packages/perspective/src/loader/file_worker_loader.js +++ b/packages/perspective/src/loader/file_worker_loader.js @@ -52,7 +52,7 @@ exports.default = function loader(content) { inputPath = inputPath .replace(path.join("perspective", "build"), "perspective") .replace(/\.js/, ".worker.js") - .replace(/(src\/js)/, "build"); + .replace(/(cjs\/js)/, "build"); } content = fs.readFileSync(inputPath).toString(); if (!options.compiled) { From e014f76e651db017a8d742f61d3273e09cd1cfdc Mon Sep 17 00:00:00 2001 From: Andrew Stein Date: Wed, 23 Jan 2019 15:19:42 -0500 Subject: [PATCH 2/2] Added missing babel-cli --- package.json | 1 + yarn.lock | 40 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2d525b11ae..91b5ae37f1 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "babel-core": "^7.0.0-0", "babel-eslint": "^8.2.3", "babel-jest": "^23.6.0", + "@babel/cli": "^7.2.3", "chart.js": "^2.7.1", "codemirror": "^5.30.0", "codemirror-javascript": "^0.2.0", diff --git a/yarn.lock b/yarn.lock index 3add912a50..edf3790ffc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17,6 +17,23 @@ text-encoding-utf-8 "^1.0.2" tslib "1.9.0" +"@babel/cli@^7.2.3": + version "7.2.3" + resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.2.3.tgz#1b262e42a3e959d28ab3d205ba2718e1923cfee6" + integrity sha512-bfna97nmJV6nDJhXNPeEfxyMjWnt6+IjUAaDPiYRTBlm8L41n8nvw6UAqUCbvpFfU246gHPxW7sfWwqtF4FcYA== + dependencies: + commander "^2.8.1" + convert-source-map "^1.1.0" + fs-readdir-recursive "^1.1.0" + glob "^7.0.0" + lodash "^4.17.10" + mkdirp "^0.5.1" + output-file-sync "^2.0.0" + slash "^2.0.0" + source-map "^0.5.0" + optionalDependencies: + chokidar "^2.0.3" + "@babel/code-frame@7.0.0-beta.44": version "7.0.0-beta.44" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9" @@ -2850,7 +2867,7 @@ check-error@^1.0.2: resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" integrity sha1-V00xLt2Iu13YkS6Sht1sCu1KrII= -chokidar@^2.0.0, chokidar@^2.0.2: +chokidar@^2.0.0, chokidar@^2.0.2, chokidar@^2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.4.tgz#356ff4e2b0e8e43e322d18a372460bbcf3accd26" integrity sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ== @@ -3184,7 +3201,7 @@ commander@2.17.x, commander@~2.17.1: resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== -commander@2.x, commander@^2.19.0: +commander@2.x, commander@^2.19.0, commander@^2.8.1: version "2.19.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== @@ -4889,6 +4906,11 @@ fs-mkdirp-stream@^1.0.0: graceful-fs "^4.1.11" through2 "^2.0.3" +fs-readdir-recursive@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27" + integrity sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA== + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -7936,6 +7958,15 @@ osenv@^0.1.4: os-homedir "^1.0.0" os-tmpdir "^1.0.0" +output-file-sync@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/output-file-sync/-/output-file-sync-2.0.1.tgz#f53118282f5f553c2799541792b723a4c71430c0" + integrity sha512-mDho4qm7WgIXIGf4eYU1RHN2UU5tPfVYVSRwDJw0uTmj35DQUt/eNp19N7v6T3SrR0ESTEf2up2CGO73qI35zQ== + dependencies: + graceful-fs "^4.1.11" + is-plain-obj "^1.1.0" + mkdirp "^0.5.1" + overrider@^0: version "0.3.0" resolved "https://registry.yarnpkg.com/overrider/-/overrider-0.3.0.tgz#024cfb68d9f09b10109771f3d97f4517d05be36a" @@ -9727,6 +9758,11 @@ slash@^1.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= +slash@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== + slice-ansi@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d"