Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
cache
Browse files Browse the repository at this point in the history
  • Loading branch information
githoniel committed May 11, 2021
1 parent def9bd6 commit 8abbf6a
Show file tree
Hide file tree
Showing 15 changed files with 515 additions and 370 deletions.
20 changes: 20 additions & 0 deletions .github/workflow/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'ci'
on:
push:
branches:
- '**'
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: bahmutov/npm-install@v1
- name: Run unit tests
- run: yarn lint
- run: yarn style
- run: yarn test
- run: yarn test:types
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}\\m.js"
}
]
}
13 changes: 13 additions & 0 deletions m.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// const Callable = require('./src/Callable');
// const createMap = require('./src/ChainedMap');
// const createChainable = require('./src/Chainable');

// const ChainedMap = createMap(createChainable(Object));
// const ChainedValueMap = createMap(createChainable(Callable));

// const parent = { parent: true };
// const map = new ChainedMap(parent);

// const t = map.end();

// debugger;
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@
"javascript-stringify": "^2.0.1"
},
"devDependencies": {
"@types/enhanced-resolve": "^3.0.6",
"@types/tapable": "^1.0.6",
"@types/webpack": "^5.0.0",
"auto-changelog": "^2.2.0",
"enhanced-resolve": "^5.8.2",
"eslint": "^7.5.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-prettier": "^6.11.0",
Expand Down
11 changes: 0 additions & 11 deletions renovate.json

This file was deleted.

4 changes: 3 additions & 1 deletion src/Optimization.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
const ChainedMap = require('./ChainedMap');
const ChainedValueMap = require('./ChainedValueMap');
const Plugin = require('./Plugin');

module.exports = class extends ChainedMap {
constructor(parent) {
super(parent);
this.minimizers = new ChainedMap(this);
this.splitChunks = new ChainedValueMap(this);
this.extend([
'minimize',
'splitChunks',
'runtimeChunk',
'emitOnErrors',
'moduleIds',
Expand Down Expand Up @@ -47,6 +48,7 @@ module.exports = class extends ChainedMap {
toConfig() {
return this.clean(
Object.assign(this.entries() || {}, {
splitChunks: this.splitChunks.entries(),
minimizer: this.minimizers.values().map((plugin) => plugin.toConfig()),
}),
);
Expand Down
1 change: 0 additions & 1 deletion src/Output.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ module.exports = class extends ChainedMap {
'umdNamedDefine',
'workerChunkLoading',
'enabledLibraryTypes',
'futureEmitAssets',
'environment',
'compareBeforeEmit',
'wasmLoading',
Expand Down
4 changes: 2 additions & 2 deletions src/Performance.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const ChainedMap = require('./ChainedMap');
const ChainedValueMap = require('./ChainedValueMap');

module.exports = class extends ChainedMap {
module.exports = class extends ChainedValueMap {
constructor(parent) {
super(parent);
this.extend(['assetFilter', 'hints', 'maxAssetSize', 'maxEntrypointSize']);
Expand Down
1 change: 0 additions & 1 deletion src/Resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ module.exports = class extends ChainedMap {
'cachePredicate',
'cacheWithContext',
'enforceExtension',
'enforceModuleExtension',
'symlinks',
'unsafeCache',
'preferRelative',
Expand Down
8 changes: 8 additions & 0 deletions test/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ test('node is value', () => {
expect(config.node.entries()).toStrictEqual(false);
});

test('performance is false', () => {
const config = new Config();
const instance = config.performance(false).end();

expect(instance).toBe(config);
expect(config.performance.entries()).toStrictEqual(false);
});

test('bail', () => {
const config = new Config();
const instance = config.bail(false);
Expand Down
5 changes: 2 additions & 3 deletions test/Optimization.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ test('toConfig empty', () => {
test('toConfig with values', () => {
const optimization = new Optimization();

optimization.minimizer('foo').use(StringifyPlugin).end().splitChunks({
chunks: 'all',
});
optimization.minimizer('foo').use(StringifyPlugin).end()
.splitChunks.set('chunks', 'all')

expect(optimization.toConfig()).toStrictEqual({
minimizer: [new StringifyPlugin()],
Expand Down
Loading

0 comments on commit 8abbf6a

Please sign in to comment.