Skip to content

Commit

Permalink
[6.x] Create vendor dll for the client modules (#22618) (#26707)
Browse files Browse the repository at this point in the history
* chore(NA): merge and solve conflicts with 6.x when backporting.

* chore(NA): updated kbn pm file.
  • Loading branch information
mistic authored Dec 5, 2018
1 parent 7ed713e commit 42102ba
Show file tree
Hide file tree
Showing 91 changed files with 17,565 additions and 17,096 deletions.
26 changes: 26 additions & 0 deletions .ci/packer_cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

set -e

# run setup script that gives us node, yarn, and bootstraps the project
source src/dev/ci_setup/setup.sh;

# download es snapshots
node scripts/es snapshot --download-only;

# download reporting browsers
cd "x-pack";
yarn gulp prepare;
cd -;

# archive cacheable directories
mkdir -p "$HOME/.kibana/bootstrap_cache"
tar -cf "$HOME/.kibana/bootstrap_cache/master.tar" \
node_modules \
packages/*/node_modules \
x-pack/node_modules \
x-pack/plugins/*/node_modules \
x-pack/plugins/reporting/.chromium \
x-pack/plugins/reporting/.phantom \
test/plugin_functional/plugins/*/node_modules \
.es;
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ bower_components
/.es
/plugins
/optimize
/dlls
/src/fixtures/vislib/mock_data
/src/ui/public/angular-bootstrap
/src/ui/public/flot-charts
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ node_modules
!/src/dev/notice/__fixtures__/node_modules
trash
/optimize
/dlls
target
/build
.jruby
Expand Down
2 changes: 0 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,6 @@ The `config/kibana.yml` file stores user configuration directives. Since this fi

#### Potential Optimization Pitfalls

In development mode, Kibana runs a customized version of [Webpack](http://webpack.github.io/) with some optimizations enabled to make building the browser bundles as fast as possible. These optimizations make the build process about 2x as fast for initial builds, and about 7x faster for rebuilds, but are labeled "unsafe" by Webpack because they can sometimes cause changes to go unnoticed by the compiler. If you experience any of the scenarios below either restart the dev server, or add `optimize.unsafeCache: false` to your `config/kibana.dev.yml` file to disable these optimizations completely.

- Webpack is trying to include a file in the bundle that I deleted and is now complaining about it is missing
- A module id that used to resolve to a single file now resolves to a directory, but webpack isn't adapting
- (if you discover other scenarios, please send a PR!)
Expand Down
3 changes: 3 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Kibana source code with Kibana X-Pack source code
Copyright 2012-2018 Elasticsearch B.V.

---
This product has relied on ASTExplorer that is licensed under MIT.

---
This product includes code that was extracted from [email protected]
which is available under an "MIT" license
Expand Down
55 changes: 29 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"extraPatterns": [
"build",
"optimize",
"dlls",
".eslintcache"
]
}
Expand Down Expand Up @@ -87,21 +88,23 @@
"url": "https://github.com/elastic/kibana.git"
},
"resolutions": {
"**/@types/node": "8.10.21",
"**/@types/node": "8.10.38",
"@types/react": "16.3.14"
},
"workspaces": {
"packages": [
"packages/*",
"x-pack",
"x-pack/plugins/*"
"x-pack/plugins/*",
"test/plugin_functional/plugins/*"
],
"nohoist": [
"**/@types/*",
"**/@types/*/**",
"**/grunt-*",
"**/grunt-*/**",
"x-pack/typescript"
"x-pack/typescript",
"kbn_tp_*/**"
]
},
"dependencies": {
Expand All @@ -111,14 +114,14 @@
"@elastic/good": "8.1.1-kibana1",
"@elastic/numeral": "2.3.2",
"@elastic/ui-ace": "0.2.3",
"@kbn/babel-code-parser": "1.0.0",
"@kbn/babel-preset": "1.0.0",
"@kbn/config-schema": "1.0.0",
"@kbn/i18n": "1.0.0",
"@kbn/interpreter": "1.0.0",
"@kbn/pm": "1.0.0",
"@kbn/test-subj-selector": "0.2.1",
"@kbn/ui-framework": "1.0.0",
"JSONStream": "1.1.1",
"abortcontroller-polyfill": "^1.1.9",
"angular": "1.6.9",
"angular-aria": "1.6.6",
Expand All @@ -129,19 +132,19 @@
"angular-sortable-view": "0.0.15",
"ansicolors": "0.3.2",
"autoprefixer": "^9.1.0",
"babel-core": "6.21.0",
"babel-loader": "7.1.2",
"babel-polyfill": "6.20.0",
"babel-register": "6.18.0",
"babel-core": "6.26.3",
"babel-loader": "7.1.5",
"babel-polyfill": "6.26.0",
"babel-register": "6.26.0",
"bluebird": "2.9.34",
"boom": "^7.2.0",
"brace": "0.11.1",
"cache-loader": "1.0.3",
"cache-loader": "1.2.2",
"chalk": "^2.4.1",
"color": "1.0.3",
"commander": "2.8.1",
"compare-versions": "3.1.0",
"css-loader": "0.28.7",
"css-loader": "1.0.0",
"custom-event-polyfill": "^0.3.0",
"d3": "3.5.6",
"d3-cloud": "1.2.1",
Expand All @@ -152,8 +155,7 @@
"encode-uri-query": "1.0.0",
"execa": "^0.10.0",
"expiry-js": "0.1.7",
"extract-text-webpack-plugin": "3.0.1",
"file-loader": "1.1.4",
"file-loader": "2.0.0",
"font-awesome": "4.4.0",
"getos": "^3.1.0",
"glob": "^7.1.2",
Expand All @@ -179,10 +181,11 @@
"leaflet-vega": "^0.8.6",
"leaflet.heat": "0.2.0",
"less": "2.7.1",
"less-loader": "4.0.5",
"less-loader": "4.1.0",
"lodash": "npm:@elastic/[email protected]",
"lru-cache": "4.1.1",
"markdown-it": "^8.4.1",
"mini-css-extract-plugin": "0.4.4",
"minimatch": "^3.0.4",
"mkdirp": "0.5.1",
"moment": "^2.20.1",
Expand All @@ -194,7 +197,7 @@
"opn": "^5.4.0",
"oppsy": "^2.0.0",
"pegjs": "0.9.0",
"postcss-loader": "2.0.6",
"postcss-loader": "3.0.0",
"prop-types": "15.5.8",
"proxy-from-env": "1.0.0",
"pug": "^2.0.3",
Expand Down Expand Up @@ -227,8 +230,7 @@
"semver": "^5.5.0",
"socket.io": "^2.1.1",
"stream-stream": "^1.2.6",
"style-loader": "0.19.0",
"symbol-observable": "^1.2.0",
"style-loader": "0.23.1",
"tar": "2.2.0",
"tinygradient": "0.3.0",
"tinymath": "1.1.0",
Expand All @@ -240,17 +242,17 @@
"type-detect": "^4.0.8",
"uglifyjs-webpack-plugin": "^1.2.7",
"ui-select": "0.19.6",
"url-loader": "0.5.9",
"url-loader": "1.1.2",
"uuid": "3.0.1",
"val-loader": "^1.1.0",
"val-loader": "^1.1.1",
"validate-npm-package-name": "2.2.2",
"vega-lib": "^3.3.1",
"vega-lite": "^2.4.0",
"vega-schema-url-parser": "1.0.0",
"vega-tooltip": "^0.9.14",
"vision": "^5.3.3",
"webpack": "3.6.0",
"webpack-merge": "4.1.0",
"webpack": "4.23.1",
"webpack-merge": "4.1.4",
"whatwg-fetch": "^2.0.3",
"wreck": "^14.0.2",
"x-pack": "6.6.0",
Expand All @@ -267,7 +269,7 @@
"@kbn/plugin-generator": "1.0.0",
"@kbn/test": "1.0.0",
"@octokit/rest": "^15.10.0",
"@types/angular": "^1.6.50",
"@types/angular": "1.6.50",
"@types/angular-mocks": "^1.7.0",
"@types/babel-core": "^6.25.5",
"@types/bluebird": "^3.1.1",
Expand Down Expand Up @@ -300,7 +302,7 @@
"@types/minimatch": "^2.0.29",
"@types/moment-timezone": "^0.5.8",
"@types/mustache": "^0.8.31",
"@types/node": "^8.10.20",
"@types/node": "^8.10.38",
"@types/opn": "^5.1.0",
"@types/podium": "^1.0.0",
"@types/prop-types": "^15.5.3",
Expand Down Expand Up @@ -365,7 +367,7 @@
"has-ansi": "^3.0.0",
"image-diff": "1.6.0",
"intl-messageformat-parser": "^1.4.0",
"istanbul-instrumenter-loader": "3.0.0",
"istanbul-instrumenter-loader": "3.0.1",
"jest": "^23.5.0",
"jest-cli": "^23.5.0",
"jest-raw-loader": "^1.0.1",
Expand All @@ -389,10 +391,11 @@
"murmurhash3js": "3.0.1",
"mutation-observer": "^1.0.3",
"nock": "8.0.0",
"node-sass": "^4.9.0",
"node-sass": "^4.9.4",
"normalize-path": "^3.0.0",
"pixelmatch": "4.0.2",
"postcss": "^7.0.2",
"pkg-up": "^2.0.0",
"postcss": "^7.0.5",
"prettier": "^1.14.3",
"proxyquire": "1.7.11",
"regenerate": "^1.4.0",
Expand All @@ -403,7 +406,7 @@
"supertest-as-promised": "^4.0.2",
"tree-kill": "^1.1.0",
"ts-jest": "^23.1.4",
"ts-loader": "^3.5.0",
"ts-loader": "^5.2.2",
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/elastic-datemath/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-env": "^1.6.1"
"babel-preset-env": "^1.7.0"
},
"dependencies": {
"moment": "^2.13.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-babel-code-parser/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@kbn/babel-preset/node_preset"]
}
19 changes: 19 additions & 0 deletions packages/kbn-babel-code-parser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# @kbn/babel-code-parser

Simple abstraction over the `@babel/parser` and the `@babel/traverse` in order
to build a code parser on top.

We have two main functions `parseSingleFile` (sync and sync version) and the
`parseEntries` (only async version). The first one just parse one entry file
and the second one parses recursively all the files from a list of
start entry points.

Then we have `visitors` and `strategies`. The first ones are basically the
`visitors` to use into the ast from the `@babel/traverse`. They are the only
way to collect info when using the `parseSingleFile`. The `strategies` are
meant to be used with the `parseEntries` and configures the info we want
to collect from our parsed code. After each loop, one per entry file, the
`parseEntries` method will call the given `strategy` expecting that
`strategy` would call the desired visitors, assemble the important
information to collect and adds them to the final results.

26 changes: 26 additions & 0 deletions packages/kbn-babel-code-parser/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@kbn/babel-code-parser",
"description": "babel code parser for Kibana",
"private": true,
"version": "1.0.0",
"main": "./target/index.js",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/elastic/kibana/tree/master/packages/kbn-babel-code-parser"
},
"scripts": {
"build": "babel src --out-dir target --quiet",
"kbn:bootstrap": "yarn build",
"kbn:watch": "yarn build --watch"
},
"devDependencies": {
"babel-cli": "^6.26.0"
},
"dependencies": {
"@kbn/babel-preset": "1.0.0",
"@babel/parser": "^7.1.3",
"@babel/traverse": "^7.1.4",
"lodash": "^4.17.11"
}
}
36 changes: 36 additions & 0 deletions packages/kbn-babel-code-parser/src/can_require.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export function canRequire(cwd, entry) {
try {
// We will try to test if we can resolve
// this entry through the require.resolve
// setting as the start looking path the
// given cwd. Require.resolve will keep
// looking recursively as normal starting
// from that location.
return require.resolve(entry, {
paths: [
cwd
]
});
} catch (e) {
return false;
}
}
Loading

0 comments on commit 42102ba

Please sign in to comment.