scratch-paint 4.1.54 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ /*!
2
+ Copyright (c) 2018 Jed Watson.
3
+ Licensed under the MIT License (MIT), see
4
+ http://jedwatson.github.io/classnames
5
+ */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scratch-paint.js","mappings":";AAAA","sources":["webpack://scratch-paint/webpack/universalModuleDefinition"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"prop-types\"), require(\"minilog\"), require(\"react\"), require(\"react-redux\"), require(\"react-intl\"), require(\"@scratch/scratch-svg-renderer\"), require(\"react-style-proptype\"), require(\"react-popover\"), require(\"react-responsive\"), require(\"redux\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"prop-types\", \"minilog\", \"react\", \"react-redux\", \"react-intl\", \"@scratch/scratch-svg-renderer\", \"react-style-proptype\", \"react-popover\", \"react-responsive\", \"redux\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"scratch-paint\"] = factory(require(\"prop-types\"), require(\"minilog\"), require(\"react\"), require(\"react-redux\"), require(\"react-intl\"), require(\"@scratch/scratch-svg-renderer\"), require(\"react-style-proptype\"), require(\"react-popover\"), require(\"react-responsive\"), require(\"redux\"));\n\telse\n\t\troot[\"scratch-paint\"] = factory(root[\"prop-types\"], root[\"minilog\"], root[\"react\"], root[\"react-redux\"], root[\"react-intl\"], root[\"@scratch/scratch-svg-renderer\"], root[\"react-style-proptype\"], root[\"react-popover\"], root[\"react-responsive\"], root[\"redux\"]);\n})(self, function(__WEBPACK_EXTERNAL_MODULE__863__, __WEBPACK_EXTERNAL_MODULE__749__, __WEBPACK_EXTERNAL_MODULE__629__, __WEBPACK_EXTERNAL_MODULE__850__, __WEBPACK_EXTERNAL_MODULE__923__, __WEBPACK_EXTERNAL_MODULE__962__, __WEBPACK_EXTERNAL_MODULE__17__, __WEBPACK_EXTERNAL_MODULE__53__, __WEBPACK_EXTERNAL_MODULE__582__, __WEBPACK_EXTERNAL_MODULE__0__) {\nreturn "],"names":[],"sourceRoot":""}
package/package.json CHANGED
@@ -1,19 +1,25 @@
1
1
  {
2
2
  "name": "scratch-paint",
3
- "version": "4.1.54",
3
+ "version": "4.2.0",
4
4
  "description": "Graphical User Interface for the Scratch 3.0 paint editor, which is used to make and edit sprites for use in projects.",
5
- "main": "./dist/scratch-paint.js",
5
+ "main": "./dist/web/scratch-paint.js",
6
6
  "browser": "./src/index.js",
7
+ "exports": {
8
+ "webpack": "./src/index.js",
9
+ "browser": "./src/index.js",
10
+ "node": "./dist/web/scratch-paint.js",
11
+ "default": "./dist/web/scratch-paint.js"
12
+ },
7
13
  "scripts": {
8
- "build": "npm run clean && webpack --progress --colors --bail",
14
+ "build": "npm run clean && webpack --progress --bail",
9
15
  "clean": "rimraf ./dist && mkdirp dist && rimraf ./playground && mkdirp playground",
10
16
  "i18n:push": "tx-push-src scratch-editor paint-editor ./translations/en.json",
11
17
  "i18n:src": "rimraf ./translations/messages && babel src > tmp.js && rimraf tmp.js && ./scripts/build-i18n-source.js ./translations/messages/ ./translations/",
12
18
  "lint": "eslint",
13
- "start": "webpack-dev-server",
19
+ "start": "webpack serve",
14
20
  "test": "npm run unit",
15
21
  "unit": "jest --reporters=default",
16
- "watch": "webpack --progress --colors --watch"
22
+ "watch": "webpack --progress --watch"
17
23
  },
18
24
  "author": "Massachusetts Institute of Technology",
19
25
  "license": "AGPL-3.0-only",
@@ -50,31 +56,29 @@
50
56
  "@babel/cli": "7.28.6",
51
57
  "@babel/core": "7.29.0",
52
58
  "@babel/node": "7.29.0",
53
- "@babel/preset-env": "7.29.3",
59
+ "@babel/preset-env": "7.29.5",
54
60
  "@babel/preset-react": "7.28.5",
55
61
  "@commitlint/cli": "17.8.1",
56
62
  "@commitlint/config-conventional": "17.8.1",
57
63
  "@testing-library/react": "8.0.9",
58
64
  "autoprefixer": "9.8.8",
59
65
  "babel-jest": "29.7.0",
60
- "babel-loader": "8.4.1",
66
+ "babel-loader": "9.2.1",
61
67
  "babel-plugin-react-intl": "3.5.1",
62
- "babel-plugin-transform-object-rest-spread": "6.26.0",
63
68
  "canvas": "3.2.3",
64
- "css-loader": "3.6.0",
69
+ "css-loader": "5.2.7",
65
70
  "eslint": "9.39.4",
66
71
  "eslint-config-scratch": "12.0.51",
67
72
  "gh-pages": "3.2.3",
68
73
  "globals": "16.5.0",
69
- "html-webpack-plugin": "3.2.0",
74
+ "html-webpack-plugin": "5.6.3",
70
75
  "husky": "8.0.3",
71
76
  "jest": "27.5.1",
72
77
  "jest-junit": "13.2.0",
73
78
  "json": "9.0.6",
74
- "lodash.defaultsdeep": "4.6.1",
75
79
  "mkdirp": "1.0.4",
76
80
  "postcss-import": "12.0.1",
77
- "postcss-loader": "3.0.0",
81
+ "postcss-loader": "4.3.0",
78
82
  "postcss-simple-vars": "5.0.2",
79
83
  "raf": "3.4.1",
80
84
  "react-test-renderer": "18.3.1",
@@ -84,15 +88,13 @@
84
88
  "rimraf": "2.7.1",
85
89
  "scratch-l10n": "6.1.75",
86
90
  "scratch-semantic-release-config": "4.0.1",
91
+ "scratch-webpack-configuration": "3.1.2",
87
92
  "semantic-release": "25.0.3",
88
- "style-loader": "1.3.0",
89
- "svg-url-loader": "3.0.3",
93
+ "style-loader": "4.0.0",
90
94
  "tap": "21.7.2",
91
- "uglifyjs-webpack-plugin": "2.2.0",
92
- "url-loader": "2.3.0",
93
- "webpack": "4.47.0",
94
- "webpack-cli": "3.3.12",
95
- "webpack-dev-server": "3.11.3"
95
+ "webpack": "5.105.4",
96
+ "webpack-cli": "5.1.4",
97
+ "webpack-dev-server": "5.2.0"
96
98
  },
97
99
  "config": {
98
100
  "commitizen": {
package/webpack.config.js CHANGED
@@ -1,133 +1,66 @@
1
- const defaultsDeep = require('lodash.defaultsdeep');
2
1
  const path = require('path');
3
2
 
4
- // Plugins
5
3
  const HtmlWebpackPlugin = require('html-webpack-plugin');
6
- const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
4
+ const ScratchWebpackConfigBuilder = require('scratch-webpack-configuration');
7
5
 
8
- // PostCss
9
- const autoprefixer = require('autoprefixer');
10
- const postcssVars = require('postcss-simple-vars');
11
- const postcssImport = require('postcss-import');
6
+ const baseConfig = new ScratchWebpackConfigBuilder({
7
+ rootPath: __dirname,
8
+ enableReact: true
9
+ })
10
+ .setTarget('browserslist')
11
+ .addModuleRule({
12
+ test: /\.(svg|png)$/i,
13
+ resourceQuery: /^$/,
14
+ type: 'asset'
15
+ });
12
16
 
13
- const base = {
14
- mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
15
- devtool: 'cheap-module-source-map',
16
- module: {
17
- rules: [{
18
- test: /\.jsx?$/,
19
- loader: 'babel-loader',
20
- include: [
21
- path.resolve(__dirname, 'src'),
22
- path.join(__dirname, 'node_modules/react-intl'),
23
- path.join(__dirname, 'node_modules/intl-messageformat'),
24
- path.join(__dirname, 'node_modules/intl-messageformat-parser'),
25
- // scratch-svg-renderer's published bundle ships modern JS
26
- // that webpack 4's default parser can't read; transpile it
27
- // here. The library output externalizes the same package, so
28
- // this is only on the path for the playground bundle.
29
- path.join(__dirname, 'node_modules/@scratch/scratch-svg-renderer')
30
- ],
31
- options: {
32
- plugins: ['transform-object-rest-spread'],
33
- presets: [
34
- ['@babel/preset-env', {
35
- targets: ['last 3 versions', 'Safari >= 8', 'iOS >= 8']}],
36
- '@babel/preset-react']
37
- }
38
- },
39
- {
40
- test: /\.css$/,
41
- use: [{
42
- loader: 'style-loader'
43
- }, {
44
- loader: 'css-loader',
45
- options: {
46
- modules: {
47
- localIdentName: '[name]_[local]_[hash:base64:5]'
48
- },
49
- importLoaders: 1,
50
- localsConvention: 'camelCase'
51
- }
52
- }, {
53
- loader: 'postcss-loader',
54
- options: {
55
- ident: 'postcss',
56
- plugins: function () {
57
- return [
58
- postcssImport,
59
- postcssVars,
60
- autoprefixer()
61
- ];
62
- }
63
- }
64
- }]
65
- },
66
- {
67
- test: /\.png$/i,
68
- loader: 'url-loader'
69
- },
70
- {
71
- test: /\.svg$/,
72
- loader: 'svg-url-loader?noquotes'
73
- }]
74
- },
75
- optimization: {
76
- minimizer: [
77
- new UglifyJsPlugin({
78
- include: /\.min\.js$/
79
- })
80
- ]
81
- },
82
- plugins: []
83
- };
84
-
85
- module.exports = [
86
- // For the playground
87
- defaultsDeep({}, base, {
88
- devServer: {
89
- contentBase: path.resolve(__dirname, 'playground'),
90
- host: '0.0.0.0',
91
- port: process.env.PORT || 8078
92
- },
17
+ const playgroundConfig = baseConfig.clone()
18
+ .merge({
93
19
  entry: {
94
20
  playground: './src/playground/playground.jsx'
95
21
  },
96
22
  output: {
97
- path: path.resolve(__dirname, 'playground'),
98
- filename: '[name].js'
99
- },
100
- plugins: base.plugins.concat([
101
- new HtmlWebpackPlugin({
102
- template: 'src/playground/index.ejs',
103
- title: 'Scratch 3.0 Paint Editor Playground'
104
- })
105
- ])
106
- }),
107
- // For use as a library
108
- defaultsDeep({}, base, {
109
- externals: {
110
- '@scratch/scratch-svg-renderer': '@scratch/scratch-svg-renderer',
111
- 'minilog': 'minilog',
112
- 'prop-types': 'prop-types',
113
- 'react': 'react',
114
- 'react-dom': 'react-dom',
115
- 'react-intl': 'react-intl',
116
- 'react-intl-redux': 'react-intl-redux',
117
- 'react-popover': 'react-popover',
118
- 'react-redux': 'react-redux',
119
- 'react-responsive': 'react-responsive',
120
- 'react-style-proptype': 'react-style-proptype',
121
- 'react-tooltip': 'react-tooltip',
122
- 'redux': 'redux'
23
+ path: path.resolve(__dirname, 'playground')
123
24
  },
25
+ devServer: {
26
+ host: '0.0.0.0'
27
+ }
28
+ })
29
+ .enableDevServer(process.env.PORT || 8078)
30
+ .addPlugin(new HtmlWebpackPlugin({
31
+ template: 'src/playground/index.ejs',
32
+ title: 'Scratch 3.0 Paint Editor Playground'
33
+ }));
34
+
35
+ const libraryConfig = baseConfig.clone()
36
+ .merge({
124
37
  entry: {
125
38
  'scratch-paint': './src/index.js'
126
39
  },
127
40
  output: {
128
- path: path.resolve(__dirname, 'dist'),
129
- filename: '[name].js',
130
- libraryTarget: 'commonjs2'
41
+ library: {
42
+ name: 'scratch-paint',
43
+ type: 'umd2'
44
+ }
131
45
  }
132
46
  })
47
+ .addExternals([
48
+ '@scratch/scratch-svg-renderer',
49
+ 'minilog',
50
+ 'prop-types',
51
+ 'react',
52
+ 'react-dom',
53
+ 'react-intl',
54
+ 'react-intl-redux',
55
+ 'react-popover',
56
+ 'react-redux',
57
+ 'react-responsive',
58
+ 'react-style-proptype',
59
+ 'react-tooltip',
60
+ 'redux'
61
+ ]);
62
+
63
+ module.exports = [
64
+ playgroundConfig.get(),
65
+ libraryConfig.get()
133
66
  ];