Skip to content

Commit

Permalink
Merge pull request #392 from jpmorganchase/perspective-cjs
Browse files Browse the repository at this point in the history
Output CJS files perspective package
  • Loading branch information
texodus authored Jan 23, 2019
2 parents d580705 + f078f4d commit f7b5762
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 16 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@apache-arrow/es5-esm": "^0.3.1",
"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",
Expand Down
14 changes: 7 additions & 7 deletions packages/perspective/babel.config.js
Original file line number Diff line number Diff line change
@@ -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
}
]
]
};
}
7 changes: 4 additions & 3 deletions packages/perspective/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/perspective/src/config/perspective.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/perspective/src/config/perspective.node.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/perspective/src/loader/file_worker_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
40 changes: 38 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]":
version "7.0.0-beta.44"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9"
Expand Down Expand Up @@ -3104,7 +3121,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==
Expand Down Expand Up @@ -3445,7 +3462,7 @@ [email protected], commander@~2.17.1:
resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==

[email protected], commander@^2.19.0:
[email protected], 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==
Expand Down Expand Up @@ -5475,6 +5492,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-write-stream-atomic@^1.0.8:
version "1.0.10"
resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9"
Expand Down Expand Up @@ -8881,6 +8903,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"
Expand Down Expand Up @@ -10872,6 +10903,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==

[email protected]:
version "1.0.0"
resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d"
Expand Down

0 comments on commit f7b5762

Please sign in to comment.