[7.x] Revert "Relative cache loader (#35406)" (#36023)

This reverts commit b037c4b5af.
This commit is contained in:
Spencer 2019-05-03 06:15:19 -07:00 committed by GitHub
parent 88bb450637
commit 61735cc4bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 28 additions and 53 deletions

2
.gitignore vendored
View file

@ -31,7 +31,7 @@ webpackstats.json
!/config/kibana.yml
coverage
selenium
.babel_register_cache.json
.babelcache.json
.webpack.babelcache
*.swp
*.swo

View file

@ -135,7 +135,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",

View file

@ -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'), '{}'),
]);
},
};

View file

@ -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'
},
});

View file

@ -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';
@ -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() {

View file

@ -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';
@ -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
@ -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.

View file

@ -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

View file

@ -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

View file

@ -6355,11 +6355,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"
@ -6521,18 +6516,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"
@ -11342,15 +11334,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"
@ -17155,14 +17138,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"
@ -19630,7 +19605,7 @@ pez@4.x.x:
hoek "5.x.x"
nigel "3.x.x"
pify@4.0.1, pify@^4.0.1:
pify@4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231"
integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==
@ -22815,7 +22790,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==