cmj build

This commit is contained in:
Anton Lavrenov 2021-09-23 11:17:50 -05:00
parent 586ea3d860
commit cc5b67ed10
15 changed files with 102 additions and 7911 deletions

1
.gitignore vendored
View File

@ -18,6 +18,7 @@ src_old
*_cache
types
out.png
cmj
# Numerous always-ignore extensions
*.diff

7850
konva.js

File diff suppressed because it is too large Load Diff

13
konva.min.js vendored

File diff suppressed because one or more lines are too long

6
package-cmj.json Normal file
View File

@ -0,0 +1,6 @@
{
"type": "commonjs",
"main": "./index-node.js",
"browser": "./index.js",
"typings": "./index-types.d.ts"
}

View File

@ -6,25 +6,26 @@
"README.md",
"konva.js",
"konva.min.js",
"lib"
"lib",
"cmj"
],
"type": "module",
"main": "./lib/index-node.js",
"browser": "./lib/index.js",
"typings": "./lib/index-types.d.ts",
"type": "module",
"scripts": {
"start": "npm run test:watch",
"compile": "npm run clean && npm run tsc && cp ./src/index-types.d.ts ./lib/index-types.d.ts && npm run rollup",
"build": "npm run compile && cp ./src/index-types.d.ts ./lib && gulp build && node ./rename-imports.js",
"test:import": "npm run build && node ./test/import-test.js",
"compile": "npm run clean && npm run tsc && cp ./src/index-types.d.ts ./lib/index-types.d.ts && npm run rollup && cp ./package-cmj.json ./cmj/package.json && cp ./src/index-types.d.ts ./cmj/index-types.d.ts",
"build": "npm run compile && cp ./src/index-types.d.ts ./lib && gulp build && node ./rename-imports.mjs",
"test:import": "npm run build && node ./test/import-test.js &&node ./test/import-test.mjs",
"test": "npm run test:browser && npm run test:node",
"test:build": "parcel build ./test/unit-tests.html --dist-dir test-build --target none --public-url ./ --no-source-maps",
"test:browser": "npm run test:build && mocha-headless-chrome -f ./test-build/unit-tests.html -a disable-web-security",
"test:node": "env TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha -r ts-node/register test/unit/**/*.ts --exit && npm run test:import",
"test:watch": "rm -rf ./parcel-cache && parcel serve ./test/unit-tests.html ./test/manual-tests.html ./test/sandbox.html ./test/performance/bunnies.html",
"tsc": "tsc --removeComments",
"test:watch": "rm -rf ./parcel-cache && parcel serve ./test/unit-tests.html ./test/manual-tests.html",
"tsc": "tsc && tsc --build ./tsconfig-cmj.json",
"rollup": "rollup -c",
"clean": "rm -rf ./lib && rm -rf ./types && rm -rf ./es && rm -rf ./test-build",
"clean": "rm -rf ./lib && rm -rf ./types && rm -rf ./cmj && rm -rf ./test-build",
"watch": "rollup -c -w",
"size": "size-limit"
},
@ -59,12 +60,12 @@
}
],
"devDependencies": {
"@parcel/transformer-image": "2.0.0-beta.2",
"@size-limit/preset-big-lib": "^4.10.3",
"@types/mocha": "^8.2.2",
"@parcel/transformer-image": "^2.0.0-beta.2",
"@size-limit/preset-big-lib": "^5.0.4",
"@types/mocha": "^9.0.0",
"canvas": "^2.8.0",
"chai": "4.3.4",
"filehound": "^1.17.4",
"filehound": "^1.17.5",
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
"gulp-connect": "^5.7.0",
@ -74,20 +75,20 @@
"gulp-replace": "^1.1.3",
"gulp-typescript": "^5.0.1",
"gulp-uglify": "^3.0.2",
"gulp-uglify-es": "^2.0.0",
"gulp-uglify-es": "^3.0.0",
"gulp-util": "^3.0.8",
"mocha": "8.4.0",
"mocha-headless-chrome": "^3.1.0",
"parcel": "^2.0.0-beta.2",
"rollup": "^2.48.0",
"rollup": "^2.57.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-typescript2": "^0.30.0",
"size-limit": "^4.10.3",
"size-limit": "^5.0.4",
"ts-mocha": "^8.0.0",
"ts-node": "^9.1.1",
"typescript": "^4.2.4"
"typescript": "^4.4.3"
},
"keywords": [
"canvas",

View File

@ -19,7 +19,7 @@
document.getElementById('konva-container').appendChild(title);
});
</script>
<script>
<script type="module">
import './manual/Manual-test.ts';
import './manual/Blur-test.ts';

View File

@ -24,35 +24,7 @@
<body>
Some text
<div id="container"></div>
<script src="../src/index.ts"></script>
<script>
// noprotect
class Ktest {
constructor() {
this.testLayer = new Konva.Group();
this.image = (() => {
const img = new Image();
img.onerror = () => console.error(`Failed to load image`);
img.src = 'https://www.webkit.org/blog-files/acid3-100.png';
return img;
})();
}
redraw() {
console.log('redraw()');
for (let n = 0; n < 20; ++n) {
const g = this.testLayer;
g.destroyChildren();
for (let i = 0; i < 10; ++i) {
const icon = new Konva.Image({ image: this.image });
g.add(icon);
}
}
}
}
const ktest = new Ktest();
setInterval(() => ktest.redraw(), 500);
</script>
<script src="../src/index.ts" type="module"></script>
<script></script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<script>
mocha.setup('bdd');
</script>
<script>
<script type="module">
// CORE
import './unit/Animation-test.ts';
import './unit/Canvas-test.ts';

View File

@ -2,7 +2,7 @@ import { assert } from 'chai';
import { addStage, Konva, cloneAndCompareLayer } from './test-utils';
describe.only('Arrow', function () {
describe('Arrow', function () {
// ======================================================
it('add arrow', function () {
var stage = addStage();

View File

@ -1,5 +1,5 @@
import { assert } from 'chai';
import { Shape } from '../../src/Shape.js';
import { Shape } from '../../src/Shape';
import {
addStage,
@ -1018,56 +1018,12 @@ describe('Node', function () {
animation: 'standing',
animations: {
standing: [
0,
0,
49,
109,
52,
0,
49,
109,
105,
0,
49,
109,
158,
0,
49,
109,
210,
0,
49,
109,
262,
0,
49,
109,
0, 0, 49, 109, 52, 0, 49, 109, 105, 0, 49, 109, 158, 0, 49, 109,
210, 0, 49, 109, 262, 0, 49, 109,
],
kicking: [
0,
109,
45,
98,
45,
109,
45,
98,
95,
109,
63,
98,
156,
109,
70,
98,
229,
109,
60,
98,
287,
109,
41,
98,
0, 109, 45, 98, 45, 109, 45, 98, 95, 109, 63, 98, 156, 109, 70, 98,
229, 109, 60, 98, 287, 109, 41, 98,
],
},
frameRate: 10,

View File

@ -10,8 +10,8 @@ Konva.enableTrace = true;
Konva.showWarnings = true;
import { imagediff } from './imagediff';
import { Layer } from '../../src/Layer.js';
import { Stage } from '../../src/Stage.js';
import { Layer } from '../../src/Layer';
import { Stage } from '../../src/Stage';
// reset some data
beforeEach(function () {

13
tsconfig-cmj.json Normal file
View File

@ -0,0 +1,13 @@
{
"compilerOptions": {
"outDir": "cmj",
"module": "CommonJS",
"target": "ES2015",
"noEmitOnError": true,
"lib": ["ES2015", "dom"],
"moduleResolution": "node",
"declaration": true,
"removeComments": true
},
"include": ["./src/*.ts"],
}

View File

@ -7,6 +7,7 @@
"lib": ["ES2015", "dom"],
"moduleResolution": "node",
"declaration": true,
"removeComments": true
// "noImplicitAny": true,
// "strict": true
},