Skip to content

Commit

Permalink
Revert "Relative cache loader (#35406)" (#36022)
Browse files Browse the repository at this point in the history
This reverts commit b0e2ab0.
  • Loading branch information
Spencer authored May 3, 2019
1 parent 0153e59 commit 1e57e65
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ webpackstats.json
!/config/kibana.yml
coverage
selenium
.babel_register_cache.json
.babelcache.json
.webpack.babelcache
*.swp
*.swo
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
"bluebird": "3.5.3",
"boom": "^7.2.0",
"brace": "0.11.1",
"cache-loader": "^3.0.0",
"cache-loader": "1.2.2",
"chalk": "^2.4.1",
"color": "1.0.3",
"commander": "2.8.1",
Expand Down
2 changes: 1 addition & 1 deletion src/dev/build/tasks/create_empty_dirs_and_files_task.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const CreateEmptyDirsAndFilesTask = {
await Promise.all([
mkdirp(build.resolvePath('plugins')),
mkdirp(build.resolvePath('data')),
write(build.resolvePath('optimize/.babel_register_cache.json'), '{}'),
write(build.resolvePath('optimize/.babelcache.json'), '{}'),
]);
},
};
1 change: 0 additions & 1 deletion src/dev/build/tasks/optimize_task.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const OptimizeBuildTask = {
cwd: build.resolvePath('.'),
env: {
FORCE_DLL_CREATION: 'true',
KBN_CACHE_LOADER_WRITABLE: 'true',
NODE_OPTIONS: '--max-old-space-size=2048'
},
});
Expand Down
8 changes: 1 addition & 7 deletions src/legacy/ui/ui_bundles/ui_bundles_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import del from 'del';
import { makeRe } from 'minimatch';
import mkdirp from 'mkdirp';

import { IS_KIBANA_DISTRIBUTABLE } from '../../utils';

import { UiBundle } from './ui_bundle';
import { appEntryTemplate } from './app_entry_template';

Expand Down Expand Up @@ -170,11 +168,7 @@ export class UiBundlesController {
}

getCacheDirectory(...subPath) {
return this.resolvePath(
'../../built_assets/.cache/ui_bundles',
!IS_KIBANA_DISTRIBUTABLE ? this.hashBundleEntries() : '',
...subPath
);
return this.resolvePath('../.cache', this.hashBundleEntries(), ...subPath);
}

getDescription() {
Expand Down
11 changes: 6 additions & 5 deletions src/optimize/base_optimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import { writeFile } from 'fs';
import os from 'os';
import path from 'path';
import Boom from 'boom';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import TerserPlugin from 'terser-webpack-plugin';
Expand Down Expand Up @@ -213,13 +212,15 @@ export default class BaseOptimizer {
* of Kibana and just make compressing and extracting it more difficult.
*/
const maybeAddCacheLoader = (cacheName, loaders) => {
if (IS_KIBANA_DISTRIBUTABLE) {
return loaders;
}

return [
{
loader: 'cache-loader',
options: {
cacheContext: fromRoot('.'),
cacheDirectory: this.uiBundles.getCacheDirectory(cacheName),
readOnly: process.env.KBN_CACHE_LOADER_WRITABLE ? false : IS_KIBANA_DISTRIBUTABLE
cacheDirectory: this.uiBundles.getCacheDirectory(cacheName)
}
},
...loaders
Expand Down Expand Up @@ -268,7 +269,7 @@ export default class BaseOptimizer {
filename: '[name].bundle.js',
sourceMapFilename: '[file].map',
publicPath: PUBLIC_PATH_PLACEHOLDER,
devtoolModuleFilenameTemplate: info => `${ path.relative(fromRoot('.'), info.absoluteResourcePath) }`,
devtoolModuleFilenameTemplate: '[absolute-resource-path]',

// When the entry point is loaded, assign it's exported `plugin`
// value to a key on the global `__kbnBundles__` object.
Expand Down
12 changes: 9 additions & 3 deletions src/optimize/dynamic_dll_plugin/dll_config_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,19 @@ function generateDLL(config) {
// Self calling function with the equivalent logic
// from maybeAddCacheLoader one from base optimizer
use: ((babelLoaderCacheDirPath, loaders) => {
// Only deactivate cache-loader and thread-loader on
// distributable. It is valid when running from source
// both with dev or prod bundles or even when running
// kibana for dev only.
if (IS_KIBANA_DISTRIBUTABLE) {
return loaders;
}

return [
{
loader: 'cache-loader',
options: {
cacheContext: fromRoot('.'),
cacheDirectory: babelLoaderCacheDirPath,
readOnly: process.env.KBN_CACHE_LOADER_WRITABLE ? false : IS_KIBANA_DISTRIBUTABLE
cacheDirectory: babelLoaderCacheDirPath
}
},
...loaders
Expand Down
2 changes: 1 addition & 1 deletion src/setup_node_env/babel_register/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var resolve = require('path').resolve;
// this must happen before `require('@babel/register')` and can't be changed
// once the module has been loaded
if (!process.env.BABEL_CACHE_PATH) {
process.env.BABEL_CACHE_PATH = resolve(__dirname, '../../../optimize/.babel_register_cache.json');
process.env.BABEL_CACHE_PATH = resolve(__dirname, '../../../optimize/.babelcache.json');
}

// paths that @babel/register should ignore
Expand Down
41 changes: 8 additions & 33 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6617,11 +6617,6 @@ buffer-indexof@^1.0.0:
resolved "https://registry.yarnpkg.com/buffer-indexof/-/buffer-indexof-1.1.1.tgz#52fabcc6a606d1a00302802648ef68f639da268c"
integrity sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==

buffer-json@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/buffer-json/-/buffer-json-2.0.0.tgz#f73e13b1e42f196fe2fd67d001c7d7107edd7c23"
integrity sha512-+jjPFVqyfF1esi9fvfUs3NqM0pH1ziZ36VP4hmA/y/Ssfo/5w5xHKfTw9BwQjoJ1w/oVtpLomqwUHKdefGyuHw==

buffer-xor@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9"
Expand Down Expand Up @@ -6783,18 +6778,15 @@ cache-base@^1.0.1:
union-value "^1.0.0"
unset-value "^1.0.0"

cache-loader@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/cache-loader/-/cache-loader-3.0.0.tgz#041cd9dd1cab1f40c12eda24017fa9988b01f064"
integrity sha512-VaSDv1VxKUc04aandtAJ85+CvdGrGYCPExAxNOVedt3tElJRj/xhS4tHw3Ifw7m+mbltzbBzU/6aLQA8gYIYJQ==
cache-loader@1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/cache-loader/-/cache-loader-1.2.2.tgz#6d5c38ded959a09cc5d58190ab5af6f73bd353f5"
integrity sha512-rsGh4SIYyB9glU+d0OcHwiXHXBoUgDhHZaQ1KAbiXqfz1CDPxtTboh1gPbJ0q2qdO8a9lfcjgC5CJ2Ms32y5bw==
dependencies:
buffer-json "^2.0.0"
find-cache-dir "^2.1.0"
loader-utils "^1.1.0"
mkdirp "^0.5.1"
neo-async "^2.6.0"
normalize-path "^3.0.0"
schema-utils "^1.0.0"
neo-async "^2.5.0"
schema-utils "^0.4.2"

cacheable-request@^2.1.1:
version "2.1.4"
Expand Down Expand Up @@ -11623,15 +11615,6 @@ find-cache-dir@^2.0.0:
make-dir "^1.0.0"
pkg-dir "^3.0.0"

find-cache-dir@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7"
integrity sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==
dependencies:
commondir "^1.0.1"
make-dir "^2.0.0"
pkg-dir "^3.0.0"

find-index@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/find-index/-/find-index-0.1.1.tgz#675d358b2ca3892d795a1ab47232f8b6e2e0dde4"
Expand Down Expand Up @@ -17421,14 +17404,6 @@ make-dir@^1.0.0, make-dir@^1.3.0:
dependencies:
pify "^3.0.0"

make-dir@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5"
integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==
dependencies:
pify "^4.0.1"
semver "^5.6.0"

make-error@^1.3.5:
version "1.3.5"
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8"
Expand Down Expand Up @@ -19906,7 +19881,7 @@ phin@^2.9.1:
resolved "https://registry.yarnpkg.com/phin/-/phin-2.9.3.tgz#f9b6ac10a035636fb65dfc576aaaa17b8743125c"
integrity sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==

[email protected], pify@^4.0.1:
[email protected]:
version "4.0.1"
resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231"
integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==
Expand Down Expand Up @@ -23075,7 +23050,7 @@ schema-utils@^0.3.0:
dependencies:
ajv "^5.0.0"

schema-utils@^0.4.0, schema-utils@^0.4.4, schema-utils@^0.4.5:
schema-utils@^0.4.0, schema-utils@^0.4.2, schema-utils@^0.4.4, schema-utils@^0.4.5:
version "0.4.7"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187"
integrity sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ==
Expand Down

0 comments on commit 1e57e65

Please sign in to comment.