Commit 21c2b4eb authored by rockyl's avatar rockyl

。。。

parent f4df8017
{"id":"svga","url":"svga.bbb584f45f3ee647d0611653cb854c5d5bb8fb47.js"}
\ No newline at end of file
{"id":"svga","url":"svga.min.d3b9a98c65e2f0b7bb96128bc59f79a5e1af57d4.js","url_dbg":"svga.f66ee70b5b7daa6a7e61e12ad56ad7f61c2b0bd8.js"}
\ No newline at end of file
{
"name": "renderingengine-svga",
"name": "engine-svga",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
......@@ -16,12 +16,15 @@
"typescript": "^3.7.3"
},
"scripts": {
"declare": "node scripts/declare.js src/svga/index.ts",
"rollup": "rollup -c -o dist/svga.js",
"rollup:prod": "rollup -c -o dist/svga.js --environment BUILD:production",
"rollup:debug": "rollup -c -m ",
"preprocess": "node scripts/pre-process.js svga dist/svga.js",
"build": "rm -rf dist&&yarn rollup:prod && yarn preprocess && ali-oss-publish -c oss.config.js -e dist",
"build:debug": "rm -rf dist&&yarn rollup && yarn preprocess && ali-oss-publish -c oss.config.js -e dist"
"dts": "node scripts/declare.js src/svga/index.ts",
"dev": "rollup -c -m -w",
"build": "rollup -c -o dist/svga.js",
"build:prod": "rollup -c -o dist/svga.min.js --environment BUILD:production",
"preprocess:prod": "node scripts/pre-process.js svga dist/svga.min.js prod",
"preprocess:debug": "node scripts/pre-process.js svga dist/svga.js",
"pack:prod": "yarn build:prod && yarn preprocess:prod",
"pack:debug": "yarn build && yarn preprocess:debug",
"upload": "ali-oss-publish -c oss.config.js -e dist",
"publish": "rm -rf dist && yarn pack:debug && yarn pack:prod && yarn upload"
}
}
......@@ -8,7 +8,7 @@ const progress = require('rollup-plugin-progress');
const typescript = require('rollup-plugin-typescript');
const {uglify} = require('rollup-plugin-uglify');
const options = {
export default {
input: 'src/index.ts',
output: [
{
......@@ -22,17 +22,12 @@ const options = {
],
plugins: [
progress(),
resolve({}),
typescript({
//useTsconfigDeclarationDir: true,
}),
resolve({}),
commonjs(),
process.env.BUILD === 'production' && uglify({})
],
external: ['tslib'],
};
if(process.env.BUILD === 'production'){
options.plugins.push(uglify({}));
}
export default options;
......@@ -49,7 +49,7 @@ ${allExports}
}
`;
fs.writeFileSync('debug/svga.d.ts', content);
fs.writeFileSync('svga.d.ts', content);
}
compile(process.argv.slice(2), {
......
......@@ -6,7 +6,7 @@ const crypto = require('crypto');
const fs = require('fs');
const path = require('path');
const [_, __, id, fileName] = process.argv;
const [_, __, id, fileName, isProd] = process.argv;
const stream = fs.createReadStream(fileName);
const fsHash = crypto.createHash('sha1');
......@@ -26,10 +26,16 @@ function loadComplete(md5) {
const newFileName = fileName.substr(0, extIndex + 1) + md5 + fileName.substr(extIndex);
fs.renameSync(fileName, newFileName);
let manifest = {
let manifest;
if (fs.existsSync('manifest.json')) {
manifest = JSON.parse(fs.readFileSync('manifest.json', 'utf-8'));
} else {
manifest = {
id,
url: path.basename(newFileName),
};
}
manifest[isProd ? 'url' : 'url_dbg'] = path.basename(newFileName);
fs.writeFileSync('manifest.json', JSON.stringify(manifest));
}
......@@ -37,7 +37,7 @@ export class Svga extends MovieClip {
needLoad = false;
}
}
if(needLoad){
if (needLoad) {
engine.globalLoader['loadSvga'](value)
.then(mv => {
this.init(mv);
......@@ -47,9 +47,17 @@ export class Svga extends MovieClip {
}
}
private _dataInitialized(){
setTimeout(()=>{
if(this.autoPlay){
protected __cloneSelf() {
return new Svga();
}
clone(withEvents = false, withScripts = false) {
return super.clone(withEvents, withScripts, false);
}
private _dataInitialized() {
setTimeout(() => {
if (this.autoPlay) {
this.play();
}
})
......
This diff is collapsed.
This diff is collapsed.
declare module svga{
export class BezierPath {
_d: any;
_transform: any;
_styles: any;
_shape: any;
constructor(d?: any, transform?: any, styles?: any);
}
export class FrameEntity {
alpha: number;
transform: {
a: number;
b: number;
c: number;
d: number;
tx: number;
ty: number;
};
layout: {
x: number;
y: number;
width: number;
height: number;
};
nx: number;
ny: number;
/**
* BezierPath
*/
maskPath: any;
/**
* Object[]
*/
shapes: any[];
constructor(spec: any);
static lastShapes: any;
}
export class SpriteEntity {
/**
* string
*/
matteKey: any;
/**
* string
*/
imageKey: any;
/**
* FrameEntity[]
*/
frames: any[];
constructor(spec: any);
}
export function asPromise(fn: Function, ctx: any, ...args: any[]): Promise<any>;
export namespace asPromise {
export { writeFloatLE, writeFloatBE, readFloatLE, readFloatBE, writeDoubleLE, writeDoubleBE, readDoubleLE, readDoubleBE };
}
export { writeFloatLE, writeFloatBE, readFloatLE, readFloatBE, writeDoubleLE, writeDoubleBE, readDoubleLE, readDoubleBE };
export var writeFloatLE: any;
export var writeFloatBE: any;
export var readFloatLE: any;
export var readFloatBE: any;
export var writeDoubleLE: any;
export var writeDoubleBE: any;
export var readDoubleLE: any;
export var readDoubleBE: any;
export const proto: any;
export const ProtoMovieEntity: any;
export function assign(obj: any, objO: any): any;
export function shrinkBuf(buf: any, size: any): any;
export const utils: {
assign: typeof assign;
shrinkBuf: typeof shrinkBuf;
Buf8: any;
Buf16: any;
Buf32: any;
arraySet: any;
flattenChunks: any;
}
export {};
export function string2buf(str: any): any;
export function buf2binstring(buf: any, len?: any): any;
export function binstring2buf(str: any): any;
export function buf2string(buf: any, max: any): any;
export function utf8border(buf: any, max: any): any;
export const strings: {
utf8border: typeof utf8border;
buf2string: typeof buf2string;
binstring2buf: typeof binstring2buf;
buf2binstring: typeof buf2binstring;
string2buf: typeof string2buf;
}
export {};
export function adler32(adler: any, buf: any, len: any, pos: any): number;
export function crc32(crc: any, buf: any, len: any, pos: any): number;
export function inflateResetKeep(strm: any): number;
export function inflateReset(strm: any): number;
export function inflateReset2(strm: any, windowBits: any): number;
export function inflateInit2(strm: any, windowBits: any): any;
export function inflateInit(strm: any): any;
export function inflate(strm: any, flush: any): any;
export function inflateEnd(strm: any): number;
export function inflateGetHeader(strm: any, head: any): number;
export function inflateSetDictionary(strm: any, dictionary: any): number;
export const _default: {
inflateReset: typeof inflateReset;
inflateReset2: typeof inflateReset2;
inflateResetKeep: typeof inflateResetKeep;
inflateInit: typeof inflateInit;
inflateInit2: typeof inflateInit2;
inflate: typeof inflate;
inflateEnd: typeof inflateEnd;
inflateGetHeader: typeof inflateGetHeader;
inflateSetDictionary: typeof inflateSetDictionary;
inflateInfo: string;
}
export const _default: {
Z_NO_FLUSH: number;
Z_PARTIAL_FLUSH: number;
Z_SYNC_FLUSH: number;
Z_FULL_FLUSH: number;
Z_FINISH: number;
Z_BLOCK: number;
Z_TREES: number;
Z_OK: number;
Z_STREAM_END: number;
Z_NEED_DICT: number;
Z_ERRNO: number;
Z_STREAM_ERROR: number;
Z_DATA_ERROR: number;
Z_BUF_ERROR: number;
Z_NO_COMPRESSION: number;
Z_BEST_SPEED: number;
Z_BEST_COMPRESSION: number;
Z_DEFAULT_COMPRESSION: number;
Z_FILTERED: number;
Z_HUFFMAN_ONLY: number;
Z_RLE: number;
Z_FIXED: number;
Z_DEFAULT_STRATEGY: number;
Z_BINARY: number;
Z_TEXT: number;
Z_UNKNOWN: number;
Z_DEFLATED: number;
}
export const _default: {
2: string;
1: string;
0: string;
'-1': string;
'-2': string;
'-3': string;
'-4': string;
'-5': string;
'-6': string;
}
export function ZStream(): void;
export function GZheader(): void;
export function inflate(input: any, options: any): any;
export const _default: {
inflate: typeof inflate;
}
export const _default: (data: any, cb: any, failure: any) => void;
export class Parser {
/**
* url: 资源路径
* success(VideoEntity videoItem)
*/
load(url: any, success: any, failure: any): void;
loadViaWorker(url: any, success: any, failure: any): void;
}
export class Svga extends MovieClip {
private _source;
autoPlay: boolean;
get source(): string;
set source(v: string);
private _setSource;
protected __cloneSelf(): Svga;
clone(withEvents?: boolean, withScripts?: boolean): any;
private _dataInitialized;
}
}
......@@ -81,23 +81,11 @@
resolved "https://registry.npm.taobao.org/@types/long/download/@types/long-4.0.0.tgz?cache=0&sync_timestamp=1572463917434&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Flong%2Fdownload%2F%40types%2Flong-4.0.0.tgz#719551d2352d301ac8b81db732acb6bdc28dbdef"
integrity sha1-cZVR0jUtMBrIuB23Mqy2vcKNve8=
"@types/node@*":
version "12.12.21"
resolved "https://registry.npm.taobao.org/@types/node/download/@types/node-12.12.21.tgz?cache=0&sync_timestamp=1576679981554&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-12.12.21.tgz#aa44a6363291c7037111c47e4661ad210aded23f"
integrity sha1-qkSmNjKRxwNxEcR+RmGtIQre0j8=
"@types/node@^10.1.0":
version "10.17.11"
resolved "https://registry.npm.taobao.org/@types/node/download/@types/node-10.17.11.tgz?cache=0&sync_timestamp=1576679981554&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fnode%2Fdownload%2F%40types%2Fnode-10.17.11.tgz#46ba035fb917b31c948280dbea22ab8838f386a4"
integrity sha1-RroDX7kXsxyUgoDb6iKriDjzhqQ=
"@types/resolve@0.0.8":
version "0.0.8"
resolved "https://registry.npm.taobao.org/@types/resolve/download/@types/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194"
integrity sha1-8mB00jjgJlnjI84aE9BB7uKA4ZQ=
dependencies:
"@types/node" "*"
ansi-styles@^3.2.1:
version "3.2.1"
resolved "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
......@@ -105,10 +93,17 @@ ansi-styles@^3.2.1:
dependencies:
color-convert "^1.9.0"
builtin-modules@^3.1.0:
version "3.1.0"
resolved "https://registry.npm.taobao.org/builtin-modules/download/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484"
integrity sha1-qtl8FRMet2tltQ7yCOdYTNdqdIQ=
browser-resolve@^1.11.0:
version "1.11.3"
resolved "http://npm.dui88.com:80/browser-resolve/-/browser-resolve-1.11.3.tgz#9b7cbb3d0f510e4cb86bdbd796124d28b5890af6"
integrity sha1-m3y7PQ9RDky4a9vXlhJNKLWJCvY=
dependencies:
resolve "1.1.7"
builtin-modules@^1.1.0:
version "1.1.1"
resolved "http://npm.dui88.com:80/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=
chalk@^2.0.0, chalk@^2.4.2:
version "2.4.2"
......@@ -151,15 +146,29 @@ esutils@^2.0.2:
resolved "https://registry.npm.taobao.org/esutils/download/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
integrity sha1-dNLrTeC42hKTcRkQ1Qd1ubcQ72Q=
function-bind@^1.1.1:
version "1.1.1"
resolved "http://npm.dui88.com:80/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
integrity sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0=
has-flag@^3.0.0:
version "3.0.0"
resolved "https://registry.npm.taobao.org/has-flag/download/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0=
is-module@^1.0.0:
version "1.0.0"
resolved "https://registry.npm.taobao.org/is-module/download/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591"
integrity sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=
has@^1.0.3:
version "1.0.3"
resolved "http://npm.dui88.com:80/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796"
integrity sha1-ci18v8H2qoJB8W3YFOAR4fQeh5Y=
dependencies:
function-bind "^1.1.1"
is-core-module@^2.0.0:
version "2.1.0"
resolved "http://npm.dui88.com:80/is-core-module/-/is-core-module-2.1.0.tgz#a4cc031d9b1aca63eecbd18a650e13cb4eeab946"
integrity sha1-pMwDHZsaymPuy9GKZQ4Ty07quUY=
dependencies:
has "^1.0.3"
is-reference@^1.1.2:
version "1.1.4"
......@@ -222,7 +231,20 @@ protobufjs@^6.8.8:
"@types/node" "^10.1.0"
long "^4.0.0"
resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1:
resolve@1.1.7:
version "1.1.7"
resolved "http://npm.dui88.com:80/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=
resolve@^1.1.6:
version "1.18.1"
resolved "http://npm.dui88.com:80/resolve/-/resolve-1.18.1.tgz#018fcb2c5b207d2a6424aee361c5a266da8f4130"
integrity sha1-AY/LLFsgfSpkJK7jYcWiZtqPQTA=
dependencies:
is-core-module "^2.0.0"
path-parse "^1.0.6"
resolve@^1.10.0, resolve@^1.11.0:
version "1.14.1"
resolved "https://registry.npm.taobao.org/resolve/download/resolve-1.14.1.tgz#9e018c540fcf0c427d678b9931cbf45e984bcaff"
integrity sha1-ngGMVA/PDEJ9Z4uZMcv0XphLyv8=
......@@ -240,16 +262,14 @@ rollup-plugin-commonjs@^10.1.0:
resolve "^1.11.0"
rollup-pluginutils "^2.8.1"
rollup-plugin-node-resolve@^5.2.0:
version "5.2.0"
resolved "https://registry.npm.taobao.org/rollup-plugin-node-resolve/download/rollup-plugin-node-resolve-5.2.0.tgz#730f93d10ed202473b1fb54a5997a7db8c6d8523"
integrity sha1-cw+T0Q7SAkc7H7VKWZen24xthSM=
"rollup-plugin-node-resolve@^5. 2.0":
version "2.0.0"
resolved "http://npm.dui88.com:80/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-2.0.0.tgz#07e0ae94ac002a3ea36e8f33ca121d9f836b1309"
integrity sha1-B+CulKwAKj6jbo8zyhIdn4NrEwk=
dependencies:
"@types/resolve" "0.0.8"
builtin-modules "^3.1.0"
is-module "^1.0.0"
resolve "^1.11.1"
rollup-pluginutils "^2.8.1"
browser-resolve "^1.11.0"
builtin-modules "^1.1.0"
resolve "^1.1.6"
rollup-plugin-progress@^1.1.1:
version "1.1.1"
......
......@@ -3,6 +3,7 @@
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment