UNPKG

20.8 kBMarkdownView Raw
1# 0.7.0
2
3- Internal reworking splitting out multiple caches and making them less dependent on each other
4- Use webpack 4's new tapable plugin interface to avoid the deprecation message on .plugin
5- Replace default data serializer, append, with append-2 for performance and stability
6- Use brief (chalk) colored log messages
7
8## 0.7.X Patches
9
10- `0.7.0-beta.4` Replace debug process exit with unfrozen error in source transform (#293)
11- `0.7.0-beta.3` Monkey patch mini-css CssDependency to update its module's hash (#339)
12- `0.7.0-beta.2` Fix import context block chunk name support (#327), Add parity compilation cache check
13- `0.7.0-beta.1` Ensure file and context dependencies are absolute paths (#330), better json error messaging (#307), always chalk log to stderr
14- `0.7.0-beta.0` Update README
15- `0.7.0-alpha.4` Add chalk logging with shorter messages, iterate fix on data deleted from md5 cache (#330)
16- `0.7.0-alpha.3` Update file path naming standards, fix watchRun compiler misnover (#320)
17- `0.7.0-alpha.2` Fix Source freezing with typescript (#291) (@kristenmills)
18- `0.7.0-alpha.1` Remove deprecated recordsPath support, more narrow dependency transform generation, add cacache serializer and append-2 serializer as the new default.
19
20## Support
21
22- webpack 3 and 4
23- node 8 and later
24
25## Release Features
26
27### Cleaner Separation of Concerns
28
29Separate different parts of the cache into subcaches.
30
31- AssetCache: stores the collection of Assets for the compiler
32- EnhancedResolverCache: cached results from enhanced-resolver
33- Md5Cache: performs file and context hashing together as well as store values
34- ModuleCache: stores the modules as frozen and thawed by other plugins
35- ModuleResolverCache: stores resolver data collected from enhanced-resolver for a module
36
37Each Cache handles a set of singles to: reset their cache, read from an existing cache, verify the cache is correct, and write out changes to the cache.
38
39### Stability
40
41The current 'data' serializer, `append`, is being replaced by `append-2`. This second version "appends" at the folder level instead of the file level. This make the source easier to understand and write and more likely to hold less bugs. It also happens to be faster than `append` thanks to being easier to write, it's easier to write optimizations for.
42
43# 0.6.0
44
45- Thaw dependency instances to their original type
46- Naturally thaw NormalModule and ContextModule
47- Relate the config hash to the cache directory and frozen items to the compiler context path
48- Write items immediately adjacent to each other in AppendSerializer, without filler
49
50## 0.6.X Patches
51
52- `0.6.7` Add MiniCssExtract support, add graceful failure when module does not freeze all dependencies
53- `0.6.6` Add local module support and fix webpack 4 json, wasm, and module build hash support
54- `0.6.5` Fix dynamic import (@faceyspacey, @matthewborden) (#300), fix .split issue (@toriningen) (#289), fix README typo (@Zakjholt, @koningskristof)
55- `0.6.4` Use general dependency -> block cycle test to avoid max call stack (#283)
56- `0.6.3` Add safety net to module dependency freezing
57- `0.6.2` Rebuild activeExports when thawing instead of serializing it
58- `0.6.1` Fix freezing sourceless modules (#270), fix freezing json and wasm parsers and generators (#276)
59- `0.6.0` Additional protection against source path being locked when copied
60- `0.6.0-alpha.8` Protect append serializer from rename and unlink errors on Windows
61- `0.6.0-alpha.7` Move babel dependencies to development
62- `0.6.0-alpha.6` Fix unneeded rebuilding performance regressions
63- `0.6.0-alpha.5` Naturally thaw NormalModule and ContextModule
64- `0.6.0-alpha.4` Add webpack 4 beta support
65- `0.6.0-alpha.3` Fix dependency thawing performance regression
66- `0.6.0-alpha.2` Fix missed preload path relation thawing
67
68## Release Features
69
70### The original debt, hybrid dependencies
71
72Remove the need to depend on webpack record ids feature and to manually invalidate frozen modules due to module id or used harmony export changes.
73
74From hard-source's beginning it froze dependencies as hybrid or abstract dependencies. Thawed they represented the other modules the a frozen module depended on. They made the frozen module's representation of the output brittle. A change in id, used harmony exports, and some other dependency elements meant the frozen module had to thrown away so a new webpack NormalModule could be built and its source rendered. Fixing this debt, the frozen module can re-render as how NormalModule does when a module id or used harmony exports changed.
75
76This improves rebuild time when used exports of a harmony dependency change or webpack assigns a different id to a built module. As well this improves hard-source relability in relation to webpack as it removes the need for the special case logic in hard-source that would invalidates modules in these cases.
77
78### The derived debt, non-core modules
79
80Thaw cached NormalModule and ContextModule data into webpack's NormalModule and ContextModule types.
81
82With hybrid dependencies custom module types were needed to be able to use the hybrid dependencies and custom source type. The hybrid modules let webpack trace dependencies through them but left HardSource to pick a lot of work to make sure the custom modules were not returned from webpack hooks if they were out of date. In many cases with webpack 2 and later, to make this work they'd need an additional build in webpack so they the normal process of creating a module would replace a module HardSource returned incorrectly because it could not check that the module was out of date until a later stage in the build.
83
84With this new thawing HardSource is making iterative webpack builds look internally in its data more like the first build that was cached.
85
86### Relative Cache
87
88Relate cached items to the cache directory and compiler contxt path. A relative cache is a portable cache. The cache built on one computer can be used on another system or in a cloned copy of the project with a different root directory on the same system.
89
90Relate paths in the config hash to the cache directory as the config contains the context path that becomes the compiler context. Two versions of a config may only differ by the context path. Using a different context relative to the root of the project or the cacheDirectory will not be able to use the cached items in the matching config hash's build because the items when their paths are made absolute during the build will be not correct.
91
92Relate frozen items to the compiler context. When thawed the items will have their paths made absolute again so their internal state matches their previous state where paths are absolute during webpack's runtime.
93
94Make resolver request fields relative to the context if they are absolute paths. Most path fields in frozen items can be known ahead of time to be absolute paths. So making the paths relative and absolute while freezing and thawing is straight forward. The request part of resolutions is not straight forward. Sometimes the request path is relative, and sometimes it is absolute. An absolute path cannot be frozen so the absolute path must be made relative. But an original relative request must not be made absolute when thawed. To answer this, make only absolute paths relative and leave the request path as is when thawed. To use these thawed resolutions two checks may be made into the cache. First an unmodified lookup and second a modified lookup with the input made relative as if it was being frozen. This way enhanced-resolve cached items and NormalModule and ContextModule resolver items can be frozen and thawed reliably.
95
96### No wasted space in AppendSerializer
97
98Log new values to byte positions instead of block positions. Removing the filler space in incomplete blocks, this decreases the space AppendSerializer uses and can have a small improvement to write and read performance.
99
100# 0.5.0
101
102- Internal plugins for freezing and thawing modules, dependencies, and assets
103- Use AppendSerializer by default
104- Improved ES2015 support
105- Environment hash defaults to package-lock.json and yarn.lock if they exist
106
107## 0.5.X Patches
108
109- `0.5.16` Fix baseMap redundancy logic (#246), fix options passing for cheap-eval devtool (#241)
110- `0.5.15` Safety check that `sourceMap.map` is in cache before use (@abogaart)
111- `0.5.14` Improve AppendSerializer performance reading and writing
112- `0.5.13` Improve AppendSerializer performance on lots of writes
113- `0.5.12` Fix sourcesContext is undefined (@piecyk)
114- `0.5.11` Fix relative context module's identifier and id assignment
115- `0.5.10` Fix contextTimstamp typo and hash regression, fix bad compilerContext when logging freezing errors (#230)
116- `0.5.9` Fix context dependency validation (#182) and worker-loader cache prefix search (#201)
117- `0.5.8`
118 - Fix memory usage related to HarmonyExportImportedSpecifierDependency
119 - Reduce memory usage in frozen modules and source maps
120 - Reduce memory usage writing to and reading from disk
121 - Fix using preloaded modules in the memory cache
122- `0.5.7` Fix a large memory usage related to HarmonyExportImportedSpecifierDependency (#205)
123- `0.5.6` Add module freeze error logging
124- `0.5.5` Fix contextStampm, return context object in synchronous branch
125- `0.5.4` Improve cache read and write performance related to promises, fix AppendSerializer compacting
126- `0.5.3` Improve AppendSerializer performance
127- `0.5.2` Fix nested AsyncDependenciesBlock origins for Stats support
128
129## Release Features
130
131The first step to providing meaningful third party hard-source plugins for deeper integration with advanced webpack plugins, this version adds internally used plugins for freezing and thawing modules, etc. These plugins are accessible externally but are prefixed with `--` to help indicate that you should avoid using them in the meantime. You are welcome to make plugins that use these hooks but the interface may change. Internal and external plugin interface changes will only occur during minor version releases before version 1.
132
133As an important example of the utility of the plugin interface modules that are put into a ConcatenatedModule are now cached, helping decreasing build times using that plugin.
134
135# 0.4.0
136
137- Low level resolution cache
138- Missing resolution attempt check
139- Expose a 'hard-source-cache-factory' plugin hook on the compiler
140- Cache module resolutions in a cache serializer
141- Expose a 'hard-source-log' plugin hook on the compiler
142- Default options
143
144## 0.4.X Patches
145
146- `0.4.15` Deserialize objects from their caches before use (@ettavolt)
147- `0.4.14` Publish index.js and lib, omitting tests
148- `0.4.13` Add AppendSerializer
149- `0.4.12` Fix harmony module export * from ... (@filipesilva)
150- `0.4.11` Fix ContextDependency non-regexp use and fix child compiler cache prefix search
151- `0.4.10` Bump webpack version to help with nested dependency issues (@rowan)
152- `0.4.9` Fetch loader options for rule based options in webpack > 2
153- `0.4.8` Fix error in loader rule optimization use during watch mode
154- `0.4.7` Support webpack 3's loader rules optimization
155- `0.4.6` Support direct use of SourceMapDevToolPlugin
156- `0.4.5` Add webpack 3 support. Add initial ModuleConcatenationPlugin support
157- `0.4.4` Fix configHash default value
158- `0.4.3` Fix #105. Cache assets in memory as well as disk
159- `0.4.2` Tune default options
160- `0.4.1` Add Appveyor CI
161
162## Release Features
163
164### Low level resolution cache
165
166Prior versions of hard-source cache resolution values the NormalModuleFactory creates and a similar data for the ContextModuleFactory. These higher level resolutions provide a lot of hard-sources performance gain by reusing those values when resolving modules as long as an assumption holds. The file or context the resolution points at must still exist. The low level resolution cache takes this further caching the work resolving files, loaders, and contexts. These cached resolutions can be reused between multiple module resolutions as they may share files or loaders. Two modules with the same file but different loaders go through separate NormalModuleFactory resolutions meaning they hit the lower level resolvers. This new cache provides some performance gains in regards to the reused values.
167
168### Missing resolution attempt check
169
170Highly related to the low level resolution cache is the missing resolution attempt check that can be made. When the low level resolvers try to find the resource for a request it can optionally build an array of missing paths that it tried. Caching that information hard-source now provides a stronger assurance that what should have been built is. Seeing any of those missing attempts now existing means the old resolution is invalid and any related NormalModuleFactory resolution is also invalid. During the new build, hard-source will let the normal resolutions occur and store the new information.
171
172### `'hard-source-cache-factory'` plugin
173
174Leading up to changing the default cache serializer (#53), hard-source has its first plugin hook to make it more flexible. The `'hard-source-cache-factory'` plugin hook on the webpack compiler lets a users determine how the cache is write to and read from disk. Documentation on this is in the `lib/cache-serializer-factory.js` module.
175
176With this hook a working additional serializer and plugin is available to replace the leveldb default serializer with a json serializer. This serializer is primarily available for debugging the contents of the cache as they're directly human readable.
177
178To use this plugin you can add it to your config
179
180```js
181plugins: [
182 // other plugins
183 new HardSourceWebpackPlugin.HardSourceJsonSerializerPlugin(),
184```
185
186As a step to #53 a patch version with a replacement to the leveldb will come out during `v0.4.x` that will become the default in `v0.5.0`.
187
188### Cache module resolutions in a cache serializer
189
190Up until this version the NormalModuleFactory resolutions were using some old code to write and read its cache. That has been replaced with a cache serializer like the other caches. This has little effect on reading but provides a small performance gain when writing changes to the cache from the build. The cache serializers are able to write out changes instead of needing to write out the whole cache. This may a small measurable impact on large project where they were writing out the whole module resolution cache.
191
192### `'hard-source-log'` plugin
193
194A second plugin hook in this release, `'hard-source-log'` presents a way to control the logging output from hard-source. Two obvious uses is a plugin to silence its output or another to write the output to disk. Documentation on this plugin hook can be found in `lib/logger-factory.js`.
195
196With a plugin approach to logging, more logging of lower levels (debug, log) will be added that a plugin will optionally enable for writting out. This additional logging will cover when and why modules are invalidated, timing and other information to help debug hard-source.
197
198### Default options
199
200Past versions required at least the `cacheDirectory` and `recordsPath` options, along with recommending the `configHash` option. This release sets defaults for these making hard-source easier to use.
201
202- `cacheDirectory` defaults to `'node_modules/.cache/hard-source/[confighash]'`
203- `recordsPath` defaults to `'node_modules/.cache/hard-source/[confighash]/records.json'`
204- `configHash` defaults to `require('node-object-hash')({sort: false}).hash`
205
206# 0.3.0
207
208- Internal env-hash implementation relying on file hashes
209- Support context dependencies and ContextModule
210- Preload the memory cache for faster builds
211
212The `env-hash` implementation is more generalized than the npm env-hash implementation that was previously used. That one focused on hashing modified time values of folders and files to be as fast as possible. This new one is a little slower hashing files and files of folders but supports use cases like reusing a cache from a prior build on a CI environment. While the CI environment would have all new modified times, if the files' content didn't change the hash of those files will be the same letting the old cache be used.
213
214Context dependencies and ContextModules are now supported. This information is stored in the cache and deserialized like file dependencies and NormalModules. This will allow projects with ContextModules and NormalModules with context dependencies to gain the caching benefit they were previously missing.
215
216Webpack's memory cache allows webpack to make assumptions about previously built modules and skip build steps it would otherwise perform on those modules. That cache is now filled with up to date modules from the HardSource cache letting builds with webpack or the first build with a webpack server to gain the performance those assumptions support.
217
218## 0.3.X Patches
219
220- `0.3.13` Support change to error rendering in webpack 2
221- `0.3.12` Support different resolutions in different child compilations
222- `0.3.11` Support optional dependencies
223- `0.3.10` Fix webpack typo'd dependency (HarmonyCompatiblilityDependency)
224- `0.3.9` Support webpack.IgnorePlugin
225- `0.3.8` Support webpack 2.2.0 stable release
226- `0.3.7` Support webpack 2.2.0-rc.4 (by @swernerx)
227- `0.3.6` Allow webpack 2 rc versions in package peer dependencies
228- `0.3.5` Support out of order harmony import specifiers
229- `0.3.4` Support webpack 2.2.0-rc.0
230- `0.3.3` Support webpack 2.1.0-beta.28
231- `0.3.1` Fix false positive invalidation against modules like Delegated and External
232
233# 0.2.0
234
235Builds and stores checksums of files built by webpack to better determine when to rebuild modules. This helps HardSource rebuild less in CI environments.
236
237Code contributed by:
238
239- @nikhilmat
240
241## 0.2.X Patches
242
243- `0.2.7` Fix resolve cache invalidation, use resource instead of userRequest
244- `0.2.6` Don't log version mismatch message on first build without a cache
245- `0.2.5` Stamp cache with library version and fix serializing `loc` strings
246- `0.2.4` Fix out of date harmony module tree shaking keys
247- `0.2.3` Fix context depending modules rebuild check
248- `0.2.2` Flatten dependency loc data for HarmonyImportSpecifier
249- `0.2.1` Support functions as option to environmentHash
250
251# 0.1.0
252
253HardSource grew through its `0.0.X` versions up to this point. It currently supports:
254
255- Webpack 1 AMD and CommonJS modules
256- Webpack 2 Harmony modules with tree shaking
257- Module warnings and errors
258- Child Compiler use with plugins like ExtractTextWebpackPlugin and HtmlWebpackPlugin
259- Webpack builtin plugins like DllPlugin and UglifyJSPlugin
260- Module cache busting when dependencies move
261- Multiple caches through the configHash option
262- Full cache invalidation through dependency hash comparison
263
264## 0.1.X Patches
265
266- `0.1.4` Consider AMDDefineDependencies as a HardNullDependency like ConstDependency
267- `0.1.3` Fix normal module resolver plugin that didn't pass on resolve errors
268- `0.1.2` Ignore ExtractText root modules so that child compilers always run and output assets
269
270# 0.0.X
271
272- `0.0.44` Prefix module cache identifier by child compiler subcache name
273- `0.0.43` Flatten dependency `loc` field (HMR fix for 0.0.41)
274- `0.0.42` Support out of order harmony module export specifier dependencies
275- `0.0.41` Freeze and thaw module warnings and errors (by @Strate)
276- `0.0.40` Support latest webpack 2 beta (2.1.0-beta.25)
277- `0.0.38` Add `configHash` option
278- `0.0.37` Add a little logic to avoid re-serializing already serialized modules
279- `0.0.36` Freeze and thaw some common fields that weren't before
280- `0.0.35` Use additional pass in compilation instead of pre-emptive pass. Fixes use with HMR
281- `0.0.34` Correctly thaw harmony specifier dependencies
282- `0.0.33` Add HardModule.libIdent to support DllPlugin
283- `0.0.32` Fix webpack 2 dependency warnings
284- `0.0.30` Fix asset thawing and unnecessary dependency invalidation
285- `0.0.28` Help ensure cacheDirectory is used as users expect
286- `0.0.27` Use pre-emptive compile when supporting isUsed (webpack 2)
287- `0.0.26` Invalidate modules based on webpack 2 tree shaking
288- `0.0.23` Fix to error in resolve invalidation
289- `0.0.19` Store separate non-devtool related base map for Uglify support
290- `0.0.18` Invalidate modules depending on a now invalid resolve value
291- `0.0.17` Support webpack-isomorphic-tools
292- `0.0.16` Incomplete resolve invalidation
293- `0.0.15` Invalidate whole cache when environment (node_modules, etc) change
294- `0.0.13` Freeze and thaw module's `_source` used by Stats
295- `0.0.11` Store modules in a leveldb store
296- `0.0.10` Store assets separate for performance
297- `0.0.9` Support ExtractText and Uglify
298- `0.0.8` relative `cacheDirectory` support
299- `0.0.7` Support Harmony modules by disabling tree shaking
300- `0.0.5` First ReadME, travis badge, cacheDirectory change
301- `0.0.4` Add source map tests, improve source map thawing
302- `0.0.3` Add tests