add html2canvas
This commit is contained in:
parent
ccf753f0cc
commit
7b3f873395
465 changed files with 34652 additions and 2 deletions
43
node_modules/text-segmentation/CHANGELOG.md
generated
vendored
Normal file
43
node_modules/text-segmentation/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [1.0.3](https://github.com/niklasvh/text-segmentation/compare/v1.0.2...v1.0.3) (2022-01-22)
|
||||
|
||||
|
||||
### fix
|
||||
|
||||
* source maps ([4108278](https://github.com/niklasvh/text-segmentation/commit/4108278c278b271543e9a997dbf14ce14e946fe7))
|
||||
|
||||
|
||||
|
||||
## [1.0.2](https://github.com/niklasvh/text-segmentation/compare/v1.0.1...v1.0.2) (2021-08-10)
|
||||
|
||||
|
||||
### deps
|
||||
|
||||
* update base64-arraybuffer ([3804223](https://github.com/niklasvh/text-segmentation/commit/3804223855fa4f37e8c784dca5ce5113c33d3e27))
|
||||
|
||||
|
||||
|
||||
## [1.0.1](https://github.com/niklasvh/text-segmentation/compare/v1.0.0...v1.0.1) (2021-08-09)
|
||||
|
||||
|
||||
### docs
|
||||
|
||||
* add readme ([c3f1dd3](https://github.com/niklasvh/text-segmentation/commit/c3f1dd31ef4880ad7b8ecab5155f7362d4d652d3))
|
||||
|
||||
### feat
|
||||
|
||||
* expose fromCodePoint / toCodePoints ([a497aeb](https://github.com/niklasvh/text-segmentation/commit/a497aeb75255fec597b8c4b0803e3b57d6a06a25))
|
||||
|
||||
|
||||
|
||||
# 1.0.0 (2021-08-09)
|
||||
|
||||
|
||||
### feat
|
||||
|
||||
* add grapheme breaker trie ([0e5a06b](https://github.com/niklasvh/text-segmentation/commit/0e5a06b4ab7f1eef9cf7b01fc47bdb270c5704c0))
|
||||
* implement grapheme breaker ([7e065b5](https://github.com/niklasvh/text-segmentation/commit/7e065b5b2484d2dcd06efc487d938289c197fee0))
|
||||
* implement splitter ([8a52b31](https://github.com/niklasvh/text-segmentation/commit/8a52b318368ea994b245daf4ac056319ee697f24))
|
22
node_modules/text-segmentation/LICENSE
generated
vendored
Normal file
22
node_modules/text-segmentation/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2021 Niklas von Hertzen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
27
node_modules/text-segmentation/README.md
generated
vendored
Normal file
27
node_modules/text-segmentation/README.md
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
text-segmentation
|
||||
==============
|
||||
|
||||

|
||||
[](https://www.npmjs.org/package/text-segmentation)
|
||||
[](https://www.npmjs.org/package/text-segmentation)
|
||||
|
||||
A JavaScript library for Grapheme Breaking and identifying Grapheme Boundaries, [implementing the Unicode Line Breaking Algorithm (UAX #29)](https://unicode.org/reports/tr29/)
|
||||
|
||||
### Installing
|
||||
You can install the module via npm:
|
||||
|
||||
npm install text-segmentation
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
import {splitGraphemes} from 'text-segmentation';
|
||||
|
||||
const graphemes = splitGraphemes('Hello 👨👩👧👦!');
|
||||
```
|
||||
|
||||
### Testing
|
||||
You can run the test suite with:
|
||||
|
||||
npm test
|
||||
|
||||
The library implements all the [GraphemeBreakTest.txt tests](https://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakTest.txt).
|
218
node_modules/text-segmentation/dist/lib/GraphemeBreak.js
generated
vendored
Normal file
218
node_modules/text-segmentation/dist/lib/GraphemeBreak.js
generated
vendored
Normal file
|
@ -0,0 +1,218 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.splitGraphemes = exports.GraphemeBreaker = exports.graphemeBreakAtIndex = exports.codePointToClass = exports.BREAK_ALLOWED = exports.BREAK_NOT_ALLOWED = exports.UnicodeTrie = exports.fromCodePoint = exports.toCodePoints = exports.classes = void 0;
|
||||
var grapheme_break_trie_1 = require("./grapheme-break-trie");
|
||||
var utrie_1 = require("utrie");
|
||||
var Other = 0;
|
||||
var Prepend = 1;
|
||||
var CR = 2;
|
||||
var LF = 3;
|
||||
var Control = 4;
|
||||
var Extend = 5;
|
||||
var Regional_Indicator = 6;
|
||||
var SpacingMark = 7;
|
||||
var L = 8;
|
||||
var V = 9;
|
||||
var T = 10;
|
||||
var LV = 11;
|
||||
var LVT = 12;
|
||||
var ZWJ = 13;
|
||||
var Extended_Pictographic = 14;
|
||||
var RI = 15;
|
||||
exports.classes = {
|
||||
Other: Other,
|
||||
Prepend: Prepend,
|
||||
CR: CR,
|
||||
LF: LF,
|
||||
Control: Control,
|
||||
Extend: Extend,
|
||||
Regional_Indicator: Regional_Indicator,
|
||||
SpacingMark: SpacingMark,
|
||||
L: L,
|
||||
V: V,
|
||||
T: T,
|
||||
LV: LV,
|
||||
LVT: LVT,
|
||||
ZWJ: ZWJ,
|
||||
Extended_Pictographic: Extended_Pictographic,
|
||||
RI: RI,
|
||||
};
|
||||
var toCodePoints = function (str) {
|
||||
var codePoints = [];
|
||||
var i = 0;
|
||||
var length = str.length;
|
||||
while (i < length) {
|
||||
var value = str.charCodeAt(i++);
|
||||
if (value >= 0xd800 && value <= 0xdbff && i < length) {
|
||||
var extra = str.charCodeAt(i++);
|
||||
if ((extra & 0xfc00) === 0xdc00) {
|
||||
codePoints.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000);
|
||||
}
|
||||
else {
|
||||
codePoints.push(value);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
else {
|
||||
codePoints.push(value);
|
||||
}
|
||||
}
|
||||
return codePoints;
|
||||
};
|
||||
exports.toCodePoints = toCodePoints;
|
||||
var fromCodePoint = function () {
|
||||
var codePoints = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
codePoints[_i] = arguments[_i];
|
||||
}
|
||||
if (String.fromCodePoint) {
|
||||
return String.fromCodePoint.apply(String, codePoints);
|
||||
}
|
||||
var length = codePoints.length;
|
||||
if (!length) {
|
||||
return '';
|
||||
}
|
||||
var codeUnits = [];
|
||||
var index = -1;
|
||||
var result = '';
|
||||
while (++index < length) {
|
||||
var codePoint = codePoints[index];
|
||||
if (codePoint <= 0xffff) {
|
||||
codeUnits.push(codePoint);
|
||||
}
|
||||
else {
|
||||
codePoint -= 0x10000;
|
||||
codeUnits.push((codePoint >> 10) + 0xd800, (codePoint % 0x400) + 0xdc00);
|
||||
}
|
||||
if (index + 1 === length || codeUnits.length > 0x4000) {
|
||||
result += String.fromCharCode.apply(String, codeUnits);
|
||||
codeUnits.length = 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
exports.fromCodePoint = fromCodePoint;
|
||||
exports.UnicodeTrie = utrie_1.createTrieFromBase64(grapheme_break_trie_1.base64, grapheme_break_trie_1.byteLength);
|
||||
exports.BREAK_NOT_ALLOWED = '×';
|
||||
exports.BREAK_ALLOWED = '÷';
|
||||
var codePointToClass = function (codePoint) { return exports.UnicodeTrie.get(codePoint); };
|
||||
exports.codePointToClass = codePointToClass;
|
||||
var _graphemeBreakAtIndex = function (_codePoints, classTypes, index) {
|
||||
var prevIndex = index - 2;
|
||||
var prev = classTypes[prevIndex];
|
||||
var current = classTypes[index - 1];
|
||||
var next = classTypes[index];
|
||||
// GB3 Do not break between a CR and LF
|
||||
if (current === CR && next === LF) {
|
||||
return exports.BREAK_NOT_ALLOWED;
|
||||
}
|
||||
// GB4 Otherwise, break before and after controls.
|
||||
if (current === CR || current === LF || current === Control) {
|
||||
return exports.BREAK_ALLOWED;
|
||||
}
|
||||
// GB5
|
||||
if (next === CR || next === LF || next === Control) {
|
||||
return exports.BREAK_ALLOWED;
|
||||
}
|
||||
// Do not break Hangul syllable sequences.
|
||||
// GB6
|
||||
if (current === L && [L, V, LV, LVT].indexOf(next) !== -1) {
|
||||
return exports.BREAK_NOT_ALLOWED;
|
||||
}
|
||||
// GB7
|
||||
if ((current === LV || current === V) && (next === V || next === T)) {
|
||||
return exports.BREAK_NOT_ALLOWED;
|
||||
}
|
||||
// GB8
|
||||
if ((current === LVT || current === T) && next === T) {
|
||||
return exports.BREAK_NOT_ALLOWED;
|
||||
}
|
||||
// GB9 Do not break before extending characters or ZWJ.
|
||||
if (next === ZWJ || next === Extend) {
|
||||
return exports.BREAK_NOT_ALLOWED;
|
||||
}
|
||||
// Do not break before SpacingMarks, or after Prepend characters.
|
||||
// GB9a
|
||||
if (next === SpacingMark) {
|
||||
return exports.BREAK_NOT_ALLOWED;
|
||||
}
|
||||
// GB9a
|
||||
if (current === Prepend) {
|
||||
return exports.BREAK_NOT_ALLOWED;
|
||||
}
|
||||
// GB11 Do not break within emoji modifier sequences or emoji zwj sequences.
|
||||
if (current === ZWJ && next === Extended_Pictographic) {
|
||||
while (prev === Extend) {
|
||||
prev = classTypes[--prevIndex];
|
||||
}
|
||||
if (prev === Extended_Pictographic) {
|
||||
return exports.BREAK_NOT_ALLOWED;
|
||||
}
|
||||
}
|
||||
// GB12 Do not break within emoji flag sequences.
|
||||
// That is, do not break between regional indicator (RI) symbols
|
||||
// if there is an odd number of RI characters before the break point.
|
||||
if (current === RI && next === RI) {
|
||||
var countRI = 0;
|
||||
while (prev === RI) {
|
||||
countRI++;
|
||||
prev = classTypes[--prevIndex];
|
||||
}
|
||||
if (countRI % 2 === 0) {
|
||||
return exports.BREAK_NOT_ALLOWED;
|
||||
}
|
||||
}
|
||||
return exports.BREAK_ALLOWED;
|
||||
};
|
||||
var graphemeBreakAtIndex = function (codePoints, index) {
|
||||
// GB1 Break at the start and end of text, unless the text is empty.
|
||||
if (index === 0) {
|
||||
return exports.BREAK_ALLOWED;
|
||||
}
|
||||
// GB2
|
||||
if (index >= codePoints.length) {
|
||||
return exports.BREAK_ALLOWED;
|
||||
}
|
||||
var classTypes = codePoints.map(exports.codePointToClass);
|
||||
return _graphemeBreakAtIndex(codePoints, classTypes, index);
|
||||
};
|
||||
exports.graphemeBreakAtIndex = graphemeBreakAtIndex;
|
||||
var GraphemeBreaker = function (str) {
|
||||
var codePoints = exports.toCodePoints(str);
|
||||
var length = codePoints.length;
|
||||
var index = 0;
|
||||
var lastEnd = 0;
|
||||
var classTypes = codePoints.map(exports.codePointToClass);
|
||||
return {
|
||||
next: function () {
|
||||
if (index >= length) {
|
||||
return { done: true, value: null };
|
||||
}
|
||||
var graphemeBreak = exports.BREAK_NOT_ALLOWED;
|
||||
while (index < length &&
|
||||
(graphemeBreak = _graphemeBreakAtIndex(codePoints, classTypes, ++index)) === exports.BREAK_NOT_ALLOWED) { }
|
||||
if (graphemeBreak !== exports.BREAK_NOT_ALLOWED || index === length) {
|
||||
var value = exports.fromCodePoint.apply(null, codePoints.slice(lastEnd, index));
|
||||
lastEnd = index;
|
||||
return { value: value, done: false };
|
||||
}
|
||||
return { done: true, value: null };
|
||||
while (index < length) { }
|
||||
return { done: true, value: null };
|
||||
},
|
||||
};
|
||||
};
|
||||
exports.GraphemeBreaker = GraphemeBreaker;
|
||||
var splitGraphemes = function (str) {
|
||||
var breaker = exports.GraphemeBreaker(str);
|
||||
var graphemes = [];
|
||||
var bk;
|
||||
while (!(bk = breaker.next()).done) {
|
||||
if (bk.value) {
|
||||
graphemes.push(bk.value.slice());
|
||||
}
|
||||
}
|
||||
return graphemes;
|
||||
};
|
||||
exports.splitGraphemes = splitGraphemes;
|
||||
//# sourceMappingURL=GraphemeBreak.js.map
|
1
node_modules/text-segmentation/dist/lib/GraphemeBreak.js.map
generated
vendored
Normal file
1
node_modules/text-segmentation/dist/lib/GraphemeBreak.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/text-segmentation/dist/lib/grapheme-break-trie.js
generated
vendored
Normal file
6
node_modules/text-segmentation/dist/lib/grapheme-break-trie.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/text-segmentation/dist/lib/grapheme-break-trie.js.map
generated
vendored
Normal file
1
node_modules/text-segmentation/dist/lib/grapheme-break-trie.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"grapheme-break-trie.js","sourceRoot":"","sources":["../../src/grapheme-break-trie.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GACf,8izBAA8izB,CAAC;AACtizB,QAAA,UAAU,GAAG,KAAK,CAAC"}
|
9
node_modules/text-segmentation/dist/lib/index.js
generated
vendored
Normal file
9
node_modules/text-segmentation/dist/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.toCodePoints = exports.fromCodePoint = exports.splitGraphemes = exports.GraphemeBreaker = void 0;
|
||||
var GraphemeBreak_1 = require("./GraphemeBreak");
|
||||
Object.defineProperty(exports, "GraphemeBreaker", { enumerable: true, get: function () { return GraphemeBreak_1.GraphemeBreaker; } });
|
||||
Object.defineProperty(exports, "splitGraphemes", { enumerable: true, get: function () { return GraphemeBreak_1.splitGraphemes; } });
|
||||
Object.defineProperty(exports, "fromCodePoint", { enumerable: true, get: function () { return GraphemeBreak_1.fromCodePoint; } });
|
||||
Object.defineProperty(exports, "toCodePoints", { enumerable: true, get: function () { return GraphemeBreak_1.toCodePoints; } });
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/text-segmentation/dist/lib/index.js.map
generated
vendored
Normal file
1
node_modules/text-segmentation/dist/lib/index.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,iDAA6F;AAArF,gHAAA,eAAe,OAAA;AAAE,+GAAA,cAAc,OAAA;AAAE,8GAAA,aAAa,OAAA;AAAE,6GAAA,YAAY,OAAA"}
|
384
node_modules/text-segmentation/dist/text-segmentation.es5.js
generated
vendored
Normal file
384
node_modules/text-segmentation/dist/text-segmentation.es5.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/text-segmentation/dist/text-segmentation.es5.js.map
generated
vendored
Normal file
1
node_modules/text-segmentation/dist/text-segmentation.es5.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
397
node_modules/text-segmentation/dist/text-segmentation.umd.js
generated
vendored
Normal file
397
node_modules/text-segmentation/dist/text-segmentation.umd.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/text-segmentation/dist/text-segmentation.umd.js.map
generated
vendored
Normal file
1
node_modules/text-segmentation/dist/text-segmentation.umd.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
21
node_modules/text-segmentation/dist/types/GraphemeBreak.d.ts
generated
vendored
Normal file
21
node_modules/text-segmentation/dist/types/GraphemeBreak.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
export declare const classes: {
|
||||
[key: string]: number;
|
||||
};
|
||||
export declare const toCodePoints: (str: string) => number[];
|
||||
export declare const fromCodePoint: (...codePoints: number[]) => string;
|
||||
export declare const UnicodeTrie: import("utrie").Trie;
|
||||
export declare const BREAK_NOT_ALLOWED = "\u00D7";
|
||||
export declare const BREAK_ALLOWED = "\u00F7";
|
||||
export declare type BREAK_OPPORTUNITIES = typeof BREAK_NOT_ALLOWED | typeof BREAK_ALLOWED;
|
||||
export declare const codePointToClass: (codePoint: number) => number;
|
||||
export declare const graphemeBreakAtIndex: (codePoints: number[], index: number) => BREAK_OPPORTUNITIES;
|
||||
export declare const GraphemeBreaker: (str: string) => {
|
||||
next: () => {
|
||||
done: boolean;
|
||||
value: null;
|
||||
} | {
|
||||
value: string;
|
||||
done: boolean;
|
||||
};
|
||||
};
|
||||
export declare const splitGraphemes: (str: string) => string[];
|
2
node_modules/text-segmentation/dist/types/grapheme-break-trie.d.ts
generated
vendored
Normal file
2
node_modules/text-segmentation/dist/types/grapheme-break-trie.d.ts
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/text-segmentation/dist/types/index.d.ts
generated
vendored
Normal file
1
node_modules/text-segmentation/dist/types/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export { GraphemeBreaker, splitGraphemes, fromCodePoint, toCodePoints } from './GraphemeBreak';
|
55
node_modules/text-segmentation/package.json
generated
vendored
Normal file
55
node_modules/text-segmentation/package.json
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
"name": "text-segmentation",
|
||||
"version": "1.0.3",
|
||||
"description": "",
|
||||
"main": "dist/text-segmentation.umd.js",
|
||||
"module": "dist/text-segmentation.es5.js",
|
||||
"typings": "dist/types/index.d.ts",
|
||||
"scripts": {
|
||||
"prebuild": "rimraf dist/",
|
||||
"build": "tsc --module commonjs && rollup -c rollup.config.ts",
|
||||
"format": "prettier --write \"{src,scripts}/**/*.ts\"",
|
||||
"generate-trie": "ts-node scripts/generate_grapheme_break_trie.ts",
|
||||
"generate-tests": "ts-node scripts/generate_grapheme_break_tests.ts",
|
||||
"lint": "tslint -c tslint.json --project tsconfig.json -t codeFrame src/**/*.ts tests/**/*.ts scripts/**/*.ts",
|
||||
"mocha": "mocha --require ts-node/register tests/*.ts",
|
||||
"test": "npm run lint && npm run mocha",
|
||||
"release": "standard-version"
|
||||
},
|
||||
"dependencies": {
|
||||
"utrie": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^19.0.0",
|
||||
"@rollup/plugin-node-resolve": "^13.0.0",
|
||||
"@rollup/plugin-typescript": "^8.2.1",
|
||||
"@types/mocha": "^8.2.2",
|
||||
"@types/node": "^16.0.0",
|
||||
"mocha": "9.0.2",
|
||||
"prettier": "^2.3.2",
|
||||
"rimraf": "3.0.2",
|
||||
"rollup": "^2.52.7",
|
||||
"rollup-plugin-json": "^4.0.0",
|
||||
"rollup-plugin-sourcemaps": "^0.6.3",
|
||||
"standard-version": "^9.3.0",
|
||||
"ts-node": "^10.0.0",
|
||||
"tslib": "^2.3.0",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.18.0",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"author": {
|
||||
"name": "Niklas von Hertzen",
|
||||
"email": "niklasvh@gmail.com",
|
||||
"url": "https://hertzen.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/niklasvh/text-segmentation.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/niklasvh/text-segmentation/issues"
|
||||
},
|
||||
"homepage": "https://github.com/niklasvh/text-segmentation"
|
||||
}
|
40
node_modules/text-segmentation/rollup.config.ts
generated
vendored
Normal file
40
node_modules/text-segmentation/rollup.config.ts
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
import resolve from '@rollup/plugin-node-resolve';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import sourceMaps from 'rollup-plugin-sourcemaps';
|
||||
import typescript from '@rollup/plugin-typescript';
|
||||
import json from 'rollup-plugin-json';
|
||||
|
||||
const pkg = require('./package.json');
|
||||
|
||||
const banner = `/*
|
||||
* ${pkg.name} ${pkg.version} <${pkg.homepage}>
|
||||
* Copyright (c) ${(new Date()).getFullYear()} ${pkg.author.name} <${pkg.author.url}>
|
||||
* Released under ${pkg.license} License
|
||||
*/`;
|
||||
|
||||
export default {
|
||||
input: `src/index.ts`,
|
||||
output: [
|
||||
{ file: pkg.main, name: pkg.name, format: 'umd', banner, sourcemap: true },
|
||||
{ file: pkg.module, format: 'esm', banner, sourcemap: true },
|
||||
],
|
||||
external: [],
|
||||
watch: {
|
||||
include: 'src/**',
|
||||
},
|
||||
plugins: [
|
||||
// Allow node_modules resolution, so you can use 'external' to control
|
||||
// which external modules to include in the bundle
|
||||
// https://github.com/rollup/rollup-plugin-node-resolve#usage
|
||||
resolve(),
|
||||
// Allow json resolution
|
||||
json(),
|
||||
// Compile TypeScript files
|
||||
typescript({ sourceMap: true, inlineSources: true }),
|
||||
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
|
||||
commonjs(),
|
||||
|
||||
// Resolve source maps to the original source
|
||||
sourceMaps(),
|
||||
],
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue