* add scratch-svg-renderer adaptors to benchmark vm
* disable benchmark with monitor error
* fixup! add scratch-svg-renderer adaptors to benchmark vm
* fixup! disable benchmark with monitor error
require.resolve is a nodejs api that resolves as node resolves. An
enhanced-resolve instance, the library webpack uses, could resolve as
webpack will or we can use some slightly more manual definitions here
for exposing parts of scratch on the global object for the playground's
benchmark to use.
Use src/index.js as the entry by default in tools building scratch-vm
into a larger package. This saves file space by excluding extra webpack
boilerplate and may allow for deeper optimizations.
Depend on script dependencies for downstream webpack. For another
package to build in scratch-vm's dependencies without them already
being built into a consumed webpack build they need to be listed as
dependencies. This can benefit large projects that reuse the same
dependencies multiple times. Node will still use the main entry point
and its webpack build leaves the dependencies as external references so
it may reuse common modules in Node as well as in a build a browser
environment.
The recent changes to the renderer's build output packaging broke this
repository's playground / benchmark suite. These changes aren't the only
way to fix the issue, but this is consistent with the way that the
storage module was already being loaded.
UMD output seems to be working well for the storage module; this change
adjusts the web-targeted build outputs of this module to use it as well.
Also, common output properties are now specified in the base config and
removed from each individual config.
Build a page with webpack that loads a project and automatically runs
it, collecting performance information for a set amount of time,
stopping and displaying the results.
* Playground: use UMD to load storage as global
It appears that `expose-loader` is not compatible with WebPack's UMD
exporter, so the VM playground broke when I converted `scratch-storage`
to use UMD. This change causes the playground to load `scratch-storage`
as an independent script and relies on its UMD loader to expose it as a
global. Bonus points: we get better source mapping this way.
* Playground: tell eslint about global ScratchStorage
The previous configuration mixed Webpack output with static content in
order to create the playground. This change moves that static content
from `/playground/` into `/src/playground/` and adds a Webpack rule to
copy it into the playground as part of the build.
On the surface this might seem unnecessary, but it provides at least two
benefits:
- It's no longer possible to accidentally load stale build output
through `webpack-dev-server` in the event of a misconfiguration. This
was very easy in the previous configuration, and might in fact be the
only way that `webpack-dev-server` ever worked for this repository.
- It's simpler to ensure that various rules apply to the hand-authored
content and not build outputs. This includes lint rules, `.gitignore`,
IDE symbol search paths, etc.
* `module.loaders` -> `module.rules`
* loaders need `-loader` suffix
* `json-loader` is enabled by default
* `UglifyJsPlugin`'s `compress.warning` setting is false by default
* Move Node output: /dist.js => /dist/node/scratch-vm.js
* Move web output: /vm{.js,.min.js} => /dist/web/scratch-vm{.js,.min.js}
* Update build output references in package.json and the playground's index.html
* Move the VirtualMachine class out of index.js into its own file, referenced by index.js. The VirtualMachine class is otherwise unchanged.
* Add .gitattributes rules for new file types which were added to this repository without specifying their text/binary attributes
* Turn on source maps in webpack and add corresponding .gitignore rule