update
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
export type Manifest = {
|
||||
routes: Record<
|
||||
string,
|
||||
{
|
||||
filePath?: string
|
||||
preloads?: Array<string>
|
||||
assets?: Array<RouterManagedTag>
|
||||
}
|
||||
>
|
||||
}
|
||||
|
||||
export type RouterManagedTag =
|
||||
| {
|
||||
tag: 'title'
|
||||
attrs?: Record<string, any>
|
||||
children: string
|
||||
}
|
||||
| {
|
||||
tag: 'meta' | 'link'
|
||||
attrs?: Record<string, any>
|
||||
children?: never
|
||||
}
|
||||
| {
|
||||
tag: 'script'
|
||||
attrs?: Record<string, any>
|
||||
children?: string
|
||||
}
|
||||
| {
|
||||
tag: 'style'
|
||||
attrs?: Record<string, any>
|
||||
children?: string
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2022 Andrey Sitnik <andrey@sitnik.ru> and other contributors
|
||||
|
||||
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.
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_importDeferProxy","init","ns","constValue","v","proxy","run","_target","p","receiver","Proxy","defineProperty","deleteProperty","get","Reflect","getOwnPropertyDescriptor","getPrototypeOf","isExtensible","has","ownKeys","preventExtensions","set","setPrototypeOf"],"sources":["../../src/helpers/importDeferProxy.ts"],"sourcesContent":["/* @minVersion 7.23.0 */\n\nexport default function _importDeferProxy<T extends object>(\n init: () => T,\n): ProxyHandler<T> {\n var ns: T | null = null;\n\n var constValue = function <V extends boolean | null>(v: V) {\n return function (): V {\n return v;\n };\n };\n\n var proxy = function (run: Function) {\n return function (_target: T, p?: string | symbol, receiver?: any) {\n if (ns === null) ns = init();\n return run(ns, p, receiver);\n };\n };\n\n return new Proxy(\n {},\n {\n defineProperty: constValue(false),\n deleteProperty: constValue(false),\n get: proxy(Reflect.get),\n getOwnPropertyDescriptor: proxy(Reflect.getOwnPropertyDescriptor),\n getPrototypeOf: constValue(null),\n isExtensible: constValue(false),\n has: proxy(Reflect.has),\n ownKeys: proxy(Reflect.ownKeys),\n preventExtensions: constValue(true),\n set: constValue(false),\n setPrototypeOf: constValue(false),\n },\n );\n}\n"],"mappings":";;;;;;AAEe,SAASA,iBAAiBA,CACvCC,IAAa,EACI;EACjB,IAAIC,EAAY,GAAG,IAAI;EAEvB,IAAIC,UAAU,GAAG,SAAAA,CAAoCC,CAAI,EAAE;IACzD,OAAO,YAAe;MACpB,OAAOA,CAAC;IACV,CAAC;EACH,CAAC;EAED,IAAIC,KAAK,GAAG,SAAAA,CAAUC,GAAa,EAAE;IACnC,OAAO,UAAUC,OAAU,EAAEC,CAAmB,EAAEC,QAAc,EAAE;MAChE,IAAIP,EAAE,KAAK,IAAI,EAAEA,EAAE,GAAGD,IAAI,CAAC,CAAC;MAC5B,OAAOK,GAAG,CAACJ,EAAE,EAAEM,CAAC,EAAEC,QAAQ,CAAC;IAC7B,CAAC;EACH,CAAC;EAED,OAAO,IAAIC,KAAK,CACd,CAAC,CAAC,EACF;IACEC,cAAc,EAAER,UAAU,CAAC,KAAK,CAAC;IACjCS,cAAc,EAAET,UAAU,CAAC,KAAK,CAAC;IACjCU,GAAG,EAAER,KAAK,CAACS,OAAO,CAACD,GAAG,CAAC;IACvBE,wBAAwB,EAAEV,KAAK,CAACS,OAAO,CAACC,wBAAwB,CAAC;IACjEC,cAAc,EAAEb,UAAU,CAAC,IAAI,CAAC;IAChCc,YAAY,EAAEd,UAAU,CAAC,KAAK,CAAC;IAC/Be,GAAG,EAAEb,KAAK,CAACS,OAAO,CAACI,GAAG,CAAC;IACvBC,OAAO,EAAEd,KAAK,CAACS,OAAO,CAACK,OAAO,CAAC;IAC/BC,iBAAiB,EAAEjB,UAAU,CAAC,IAAI,CAAC;IACnCkB,GAAG,EAAElB,UAAU,CAAC,KAAK,CAAC;IACtBmB,cAAc,EAAEnB,UAAU,CAAC,KAAK;EAClC,CACF,CAAC;AACH","ignoreList":[]}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"D E F A B","2":"mC","8":"K"},B:{"1":"0 9 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC qC rC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC"},E:{"1":"J PB K D E F A B C L M G sC SC tC uC vC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","1025":"wC"},F:{"1":"0 1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"E DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"SC 9C lC","132":"AD BD CD"},H:{"2":"WD"},I:{"1":"LC I bD cD","260":"XD YD ZD","513":"J aD lC"},J:{"1":"D A"},K:{"1":"A B C H FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"1":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:2,C:"CSS position:fixed",D:true};
|
||||
@@ -0,0 +1,125 @@
|
||||
/**
|
||||
* @fileoverview enforce the location of arrow function bodies
|
||||
* @author Sharmila Jesupaul
|
||||
* @deprecated in ESLint v8.53.0
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const { isCommentToken, isNotOpeningParenToken } = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
deprecated: {
|
||||
message: "Formatting rules are being moved out of ESLint core.",
|
||||
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
|
||||
deprecatedSince: "8.53.0",
|
||||
availableUntil: "10.0.0",
|
||||
replacedBy: [
|
||||
{
|
||||
message:
|
||||
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
||||
url: "https://eslint.style/guide/migration",
|
||||
plugin: {
|
||||
name: "@stylistic/eslint-plugin-js",
|
||||
url: "https://eslint.style/packages/js",
|
||||
},
|
||||
rule: {
|
||||
name: "implicit-arrow-linebreak",
|
||||
url: "https://eslint.style/rules/js/implicit-arrow-linebreak",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
type: "layout",
|
||||
|
||||
docs: {
|
||||
description: "Enforce the location of arrow function bodies",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/implicit-arrow-linebreak",
|
||||
},
|
||||
|
||||
fixable: "whitespace",
|
||||
|
||||
schema: [
|
||||
{
|
||||
enum: ["beside", "below"],
|
||||
},
|
||||
],
|
||||
messages: {
|
||||
expected: "Expected a linebreak before this expression.",
|
||||
unexpected: "Expected no linebreak before this expression.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
const option = context.options[0] || "beside";
|
||||
|
||||
/**
|
||||
* Validates the location of an arrow function body
|
||||
* @param {ASTNode} node The arrow function body
|
||||
* @returns {void}
|
||||
*/
|
||||
function validateExpression(node) {
|
||||
if (node.body.type === "BlockStatement") {
|
||||
return;
|
||||
}
|
||||
|
||||
const arrowToken = sourceCode.getTokenBefore(
|
||||
node.body,
|
||||
isNotOpeningParenToken,
|
||||
);
|
||||
const firstTokenOfBody = sourceCode.getTokenAfter(arrowToken);
|
||||
|
||||
if (
|
||||
arrowToken.loc.end.line === firstTokenOfBody.loc.start.line &&
|
||||
option === "below"
|
||||
) {
|
||||
context.report({
|
||||
node: firstTokenOfBody,
|
||||
messageId: "expected",
|
||||
fix: fixer =>
|
||||
fixer.insertTextBefore(firstTokenOfBody, "\n"),
|
||||
});
|
||||
} else if (
|
||||
arrowToken.loc.end.line !== firstTokenOfBody.loc.start.line &&
|
||||
option === "beside"
|
||||
) {
|
||||
context.report({
|
||||
node: firstTokenOfBody,
|
||||
messageId: "unexpected",
|
||||
fix(fixer) {
|
||||
if (
|
||||
sourceCode.getFirstTokenBetween(
|
||||
arrowToken,
|
||||
firstTokenOfBody,
|
||||
{
|
||||
includeComments: true,
|
||||
filter: isCommentToken,
|
||||
},
|
||||
)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return fixer.replaceTextRange(
|
||||
[arrowToken.range[1], firstTokenOfBody.range[0]],
|
||||
" ",
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Public
|
||||
//----------------------------------------------------------------------
|
||||
return {
|
||||
ArrowFunctionExpression: node => validateExpression(node),
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* @fileoverview Define 2 token factories; forward and backward.
|
||||
* @author Toru Nagashima
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const BackwardTokenCommentCursor = require("./backward-token-comment-cursor");
|
||||
const BackwardTokenCursor = require("./backward-token-cursor");
|
||||
const FilterCursor = require("./filter-cursor");
|
||||
const ForwardTokenCommentCursor = require("./forward-token-comment-cursor");
|
||||
const ForwardTokenCursor = require("./forward-token-cursor");
|
||||
const LimitCursor = require("./limit-cursor");
|
||||
const SkipCursor = require("./skip-cursor");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* The cursor factory.
|
||||
* @private
|
||||
*/
|
||||
class CursorFactory {
|
||||
/**
|
||||
* Initializes this cursor.
|
||||
* @param {Function} TokenCursor The class of the cursor which iterates tokens only.
|
||||
* @param {Function} TokenCommentCursor The class of the cursor which iterates the mix of tokens and comments.
|
||||
*/
|
||||
constructor(TokenCursor, TokenCommentCursor) {
|
||||
this.TokenCursor = TokenCursor;
|
||||
this.TokenCommentCursor = TokenCommentCursor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a base cursor instance that can be decorated by createCursor.
|
||||
* @param {Token[]} tokens The array of tokens.
|
||||
* @param {Comment[]} comments The array of comments.
|
||||
* @param {Object} indexMap The map from locations to indices in `tokens`.
|
||||
* @param {number} startLoc The start location of the iteration range.
|
||||
* @param {number} endLoc The end location of the iteration range.
|
||||
* @param {boolean} includeComments The flag to iterate comments as well.
|
||||
* @returns {Cursor} The created base cursor.
|
||||
*/
|
||||
createBaseCursor(
|
||||
tokens,
|
||||
comments,
|
||||
indexMap,
|
||||
startLoc,
|
||||
endLoc,
|
||||
includeComments,
|
||||
) {
|
||||
const Cursor = includeComments
|
||||
? this.TokenCommentCursor
|
||||
: this.TokenCursor;
|
||||
|
||||
return new Cursor(tokens, comments, indexMap, startLoc, endLoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a cursor that iterates tokens with normalized options.
|
||||
* @param {Token[]} tokens The array of tokens.
|
||||
* @param {Comment[]} comments The array of comments.
|
||||
* @param {Object} indexMap The map from locations to indices in `tokens`.
|
||||
* @param {number} startLoc The start location of the iteration range.
|
||||
* @param {number} endLoc The end location of the iteration range.
|
||||
* @param {boolean} includeComments The flag to iterate comments as well.
|
||||
* @param {Function|null} filter The predicate function to choose tokens.
|
||||
* @param {number} skip The count of tokens the cursor skips.
|
||||
* @param {number} count The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility.
|
||||
* @returns {Cursor} The created cursor.
|
||||
*/
|
||||
createCursor(
|
||||
tokens,
|
||||
comments,
|
||||
indexMap,
|
||||
startLoc,
|
||||
endLoc,
|
||||
includeComments,
|
||||
filter,
|
||||
skip,
|
||||
count,
|
||||
) {
|
||||
let cursor = this.createBaseCursor(
|
||||
tokens,
|
||||
comments,
|
||||
indexMap,
|
||||
startLoc,
|
||||
endLoc,
|
||||
includeComments,
|
||||
);
|
||||
|
||||
if (filter) {
|
||||
cursor = new FilterCursor(cursor, filter);
|
||||
}
|
||||
if (skip >= 1) {
|
||||
cursor = new SkipCursor(cursor, skip);
|
||||
}
|
||||
if (count >= 0) {
|
||||
cursor = new LimitCursor(cursor, count);
|
||||
}
|
||||
|
||||
return cursor;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Exports
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
forward: new CursorFactory(ForwardTokenCursor, ForwardTokenCommentCursor),
|
||||
backward: new CursorFactory(
|
||||
BackwardTokenCursor,
|
||||
BackwardTokenCommentCursor,
|
||||
),
|
||||
};
|
||||
@@ -0,0 +1,137 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = populatePlaceholders;
|
||||
var _t = require("@babel/types");
|
||||
const {
|
||||
blockStatement,
|
||||
cloneNode,
|
||||
emptyStatement,
|
||||
expressionStatement,
|
||||
identifier,
|
||||
isStatement,
|
||||
isStringLiteral,
|
||||
stringLiteral,
|
||||
validate
|
||||
} = _t;
|
||||
function populatePlaceholders(metadata, replacements) {
|
||||
const ast = cloneNode(metadata.ast);
|
||||
if (replacements) {
|
||||
metadata.placeholders.forEach(placeholder => {
|
||||
if (!hasOwnProperty.call(replacements, placeholder.name)) {
|
||||
const placeholderName = placeholder.name;
|
||||
throw new Error(`Error: No substitution given for "${placeholderName}". If this is not meant to be a
|
||||
placeholder you may want to consider passing one of the following options to @babel/template:
|
||||
- { placeholderPattern: false, placeholderWhitelist: new Set(['${placeholderName}'])}
|
||||
- { placeholderPattern: /^${placeholderName}$/ }`);
|
||||
}
|
||||
});
|
||||
Object.keys(replacements).forEach(key => {
|
||||
if (!metadata.placeholderNames.has(key)) {
|
||||
throw new Error(`Unknown substitution "${key}" given`);
|
||||
}
|
||||
});
|
||||
}
|
||||
metadata.placeholders.slice().reverse().forEach(placeholder => {
|
||||
try {
|
||||
applyReplacement(placeholder, ast, replacements && replacements[placeholder.name] || null);
|
||||
} catch (e) {
|
||||
e.message = `@babel/template placeholder "${placeholder.name}": ${e.message}`;
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
return ast;
|
||||
}
|
||||
function applyReplacement(placeholder, ast, replacement) {
|
||||
if (placeholder.isDuplicate) {
|
||||
if (Array.isArray(replacement)) {
|
||||
replacement = replacement.map(node => cloneNode(node));
|
||||
} else if (typeof replacement === "object") {
|
||||
replacement = cloneNode(replacement);
|
||||
}
|
||||
}
|
||||
const {
|
||||
parent,
|
||||
key,
|
||||
index
|
||||
} = placeholder.resolve(ast);
|
||||
if (placeholder.type === "string") {
|
||||
if (typeof replacement === "string") {
|
||||
replacement = stringLiteral(replacement);
|
||||
}
|
||||
if (!replacement || !isStringLiteral(replacement)) {
|
||||
throw new Error("Expected string substitution");
|
||||
}
|
||||
} else if (placeholder.type === "statement") {
|
||||
if (index === undefined) {
|
||||
if (!replacement) {
|
||||
replacement = emptyStatement();
|
||||
} else if (Array.isArray(replacement)) {
|
||||
replacement = blockStatement(replacement);
|
||||
} else if (typeof replacement === "string") {
|
||||
replacement = expressionStatement(identifier(replacement));
|
||||
} else if (!isStatement(replacement)) {
|
||||
replacement = expressionStatement(replacement);
|
||||
}
|
||||
} else {
|
||||
if (replacement && !Array.isArray(replacement)) {
|
||||
if (typeof replacement === "string") {
|
||||
replacement = identifier(replacement);
|
||||
}
|
||||
if (!isStatement(replacement)) {
|
||||
replacement = expressionStatement(replacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (placeholder.type === "param") {
|
||||
if (typeof replacement === "string") {
|
||||
replacement = identifier(replacement);
|
||||
}
|
||||
if (index === undefined) throw new Error("Assertion failure.");
|
||||
} else {
|
||||
if (typeof replacement === "string") {
|
||||
replacement = identifier(replacement);
|
||||
}
|
||||
if (Array.isArray(replacement)) {
|
||||
throw new Error("Cannot replace single expression with an array.");
|
||||
}
|
||||
}
|
||||
function set(parent, key, value) {
|
||||
const node = parent[key];
|
||||
parent[key] = value;
|
||||
if (node.type === "Identifier" || node.type === "Placeholder") {
|
||||
if (node.typeAnnotation) {
|
||||
value.typeAnnotation = node.typeAnnotation;
|
||||
}
|
||||
if (node.optional) {
|
||||
value.optional = node.optional;
|
||||
}
|
||||
if (node.decorators) {
|
||||
value.decorators = node.decorators;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (index === undefined) {
|
||||
validate(parent, key, replacement);
|
||||
set(parent, key, replacement);
|
||||
} else {
|
||||
const items = parent[key].slice();
|
||||
if (placeholder.type === "statement" || placeholder.type === "param") {
|
||||
if (replacement == null) {
|
||||
items.splice(index, 1);
|
||||
} else if (Array.isArray(replacement)) {
|
||||
items.splice(index, 1, ...replacement);
|
||||
} else {
|
||||
set(items, index, replacement);
|
||||
}
|
||||
} else {
|
||||
set(items, index, replacement);
|
||||
}
|
||||
validate(parent, key, items);
|
||||
parent[key] = items;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=populate.js.map
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "gensync",
|
||||
"version": "1.0.0-beta.2",
|
||||
"license": "MIT",
|
||||
"description": "Allows users to use generators in order to write common functions that can be both sync or async.",
|
||||
"main": "index.js",
|
||||
"author": "Logan Smyth <loganfsmyth@gmail.com>",
|
||||
"homepage": "https://github.com/loganfsmyth/gensync",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/loganfsmyth/gensync.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"keywords": [
|
||||
"async",
|
||||
"sync",
|
||||
"generators",
|
||||
"async-await",
|
||||
"callbacks"
|
||||
],
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-config-prettier": "^2.9.0",
|
||||
"eslint-plugin-node": "^6.0.1",
|
||||
"eslint-plugin-prettier": "^2.6.0",
|
||||
"flow-bin": "^0.71.0",
|
||||
"jest": "^22.4.3",
|
||||
"prettier": "^1.12.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"2":"0 9 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"2 3 4 5 6 7 8 RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB","2":"0 1 9 nC LC J PB K D E F A B C L M G N O P QB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC qC rC","322":"sB tB uB vB MC wB"},D:{"2":"0 9 J PB K D E F A B C L M G N O P QB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","194":"1 2 3 4 5 6 7 8 RB SB TB UB VB WB XB YB ZB"},E:{"2":"J PB K D E F A B C L M G sC SC tC uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C"},F:{"2":"0 1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 4C 5C 6C 7C FC kC 8C GC"},G:{"2":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC"},H:{"2":"WD"},I:{"2":"LC J I XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"2":"A B C H FC kC GC"},L:{"2":"I"},M:{"2":"EC"},N:{"2":"A B"},O:{"2":"HC"},P:{"2":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"2":"oD"},R:{"2":"pD"},S:{"1":"qD","2":"rD"}},B:7,C:"Scoped attribute",D:true};
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "lru-cache",
|
||||
"description": "A cache object that deletes the least-recently-used items.",
|
||||
"version": "5.1.1",
|
||||
"author": "Isaac Z. Schlueter <i@izs.me>",
|
||||
"keywords": [
|
||||
"mru",
|
||||
"lru",
|
||||
"cache"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --100 -J",
|
||||
"snap": "TAP_SNAPSHOT=1 tap test/*.js -J",
|
||||
"coveragerport": "tap --coverage-report=html",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"postpublish": "git push origin --all; git push origin --tags"
|
||||
},
|
||||
"main": "index.js",
|
||||
"repository": "git://github.com/isaacs/node-lru-cache.git",
|
||||
"devDependencies": {
|
||||
"benchmark": "^2.1.4",
|
||||
"tap": "^12.1.0"
|
||||
},
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"yallist": "^3.0.2"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'zustand/vanilla/shallow';
|
||||
|
||||
function useShallow(selector) {
|
||||
const prev = React.useRef(undefined);
|
||||
return (state) => {
|
||||
const next = selector(state);
|
||||
return shallow(prev.current, next) ? prev.current : prev.current = next;
|
||||
};
|
||||
}
|
||||
|
||||
export { useShallow };
|
||||
@@ -0,0 +1,129 @@
|
||||
# brace-expansion
|
||||
|
||||
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
|
||||
as known from sh/bash, in JavaScript.
|
||||
|
||||
[](http://travis-ci.org/juliangruber/brace-expansion)
|
||||
[](https://www.npmjs.org/package/brace-expansion)
|
||||
[](https://greenkeeper.io/)
|
||||
|
||||
[](https://ci.testling.com/juliangruber/brace-expansion)
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
|
||||
expand('file-{a,b,c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('-v{,,}')
|
||||
// => ['-v', '-v', '-v']
|
||||
|
||||
expand('file{0..2}.jpg')
|
||||
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
|
||||
|
||||
expand('file-{a..c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('file{2..0}.jpg')
|
||||
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
|
||||
|
||||
expand('file{0..4..2}.jpg')
|
||||
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
|
||||
|
||||
expand('file-{a..e..2}.jpg')
|
||||
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
|
||||
|
||||
expand('file{00..10..5}.jpg')
|
||||
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
|
||||
|
||||
expand('{{A..C},{a..c}}')
|
||||
// => ['A', 'B', 'C', 'a', 'b', 'c']
|
||||
|
||||
expand('ppp{,config,oe{,conf}}')
|
||||
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
```
|
||||
|
||||
### var expanded = expand(str)
|
||||
|
||||
Return an array of all possible and valid expansions of `str`. If none are
|
||||
found, `[str]` is returned.
|
||||
|
||||
Valid expansions are:
|
||||
|
||||
```js
|
||||
/^(.*,)+(.+)?$/
|
||||
// {a,b,...}
|
||||
```
|
||||
|
||||
A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
A numeric sequence from `x` to `y` inclusive, with optional increment.
|
||||
If `x` or `y` start with a leading `0`, all the numbers will be padded
|
||||
to have equal length. Negative numbers and backwards iteration work too.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
An alphabetic sequence from `x` to `y` inclusive, with optional increment.
|
||||
`x` and `y` must be exactly one character, and if given, `incr` must be a
|
||||
number.
|
||||
|
||||
For compatibility reasons, the string `${` is not eligible for brace expansion.
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```bash
|
||||
npm install brace-expansion
|
||||
```
|
||||
|
||||
## Contributors
|
||||
|
||||
- [Julian Gruber](https://github.com/juliangruber)
|
||||
- [Isaac Z. Schlueter](https://github.com/isaacs)
|
||||
|
||||
## Sponsors
|
||||
|
||||
This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
|
||||
|
||||
Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,23 @@
|
||||
const numeric = /^[0-9]+$/
|
||||
const compareIdentifiers = (a, b) => {
|
||||
const anum = numeric.test(a)
|
||||
const bnum = numeric.test(b)
|
||||
|
||||
if (anum && bnum) {
|
||||
a = +a
|
||||
b = +b
|
||||
}
|
||||
|
||||
return a === b ? 0
|
||||
: (anum && !bnum) ? -1
|
||||
: (bnum && !anum) ? 1
|
||||
: a < b ? -1
|
||||
: 1
|
||||
}
|
||||
|
||||
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
|
||||
|
||||
module.exports = {
|
||||
compareIdentifiers,
|
||||
rcompareIdentifiers,
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/** @typedef {import("./Resolver")} Resolver */
|
||||
/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */
|
||||
|
||||
module.exports = class DirectoryExistsPlugin {
|
||||
/**
|
||||
* @param {string | ResolveStepHook} source source
|
||||
* @param {string | ResolveStepHook} target target
|
||||
*/
|
||||
constructor(source, target) {
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Resolver} resolver the resolver
|
||||
* @returns {void}
|
||||
*/
|
||||
apply(resolver) {
|
||||
const target = resolver.ensureHook(this.target);
|
||||
resolver
|
||||
.getHook(this.source)
|
||||
.tapAsync(
|
||||
"DirectoryExistsPlugin",
|
||||
(request, resolveContext, callback) => {
|
||||
const fs = resolver.fileSystem;
|
||||
const directory = request.path;
|
||||
if (!directory) return callback();
|
||||
fs.stat(directory, (err, stat) => {
|
||||
if (err || !stat) {
|
||||
if (resolveContext.missingDependencies)
|
||||
resolveContext.missingDependencies.add(directory);
|
||||
if (resolveContext.log)
|
||||
resolveContext.log(directory + " doesn't exist");
|
||||
return callback();
|
||||
}
|
||||
if (!stat.isDirectory()) {
|
||||
if (resolveContext.missingDependencies)
|
||||
resolveContext.missingDependencies.add(directory);
|
||||
if (resolveContext.log)
|
||||
resolveContext.log(directory + " is not a directory");
|
||||
return callback();
|
||||
}
|
||||
if (resolveContext.fileDependencies)
|
||||
resolveContext.fileDependencies.add(directory);
|
||||
resolver.doResolve(
|
||||
target,
|
||||
request,
|
||||
`existing directory ${directory}`,
|
||||
resolveContext,
|
||||
callback
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
import index from './index.js';
|
||||
|
||||
const { transform, transformStyleAttribute, bundle, bundleAsync, browserslistToTargets, composeVisitors, Features } = index;
|
||||
export { transform, transformStyleAttribute, bundle, bundleAsync, browserslistToTargets, composeVisitors, Features };
|
||||
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _rewriteStackTrace = require("./rewrite-stack-trace.js");
|
||||
class ConfigError extends Error {
|
||||
constructor(message, filename) {
|
||||
super(message);
|
||||
(0, _rewriteStackTrace.expectedError)(this);
|
||||
if (filename) (0, _rewriteStackTrace.injectVirtualStackFrame)(this, filename);
|
||||
}
|
||||
}
|
||||
exports.default = ConfigError;
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=config-error.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_findSuggestion","require","OptionValidator","constructor","descriptor","validateTopLevelOptions","options","TopLevelOptionShape","validOptionNames","Object","keys","option","includes","Error","formatMessage","findSuggestion","validateBooleanOption","name","value","defaultValue","undefined","invariant","validateStringOption","condition","message","exports"],"sources":["../src/validator.ts"],"sourcesContent":["import { findSuggestion } from \"./find-suggestion.ts\";\n\nexport class OptionValidator {\n declare descriptor: string;\n constructor(descriptor: string) {\n this.descriptor = descriptor;\n }\n\n /**\n * Validate if the given `options` follow the name of keys defined in the `TopLevelOptionShape`\n *\n * @param {Object} options\n * @param {Object} TopLevelOptionShape\n * An object with all the valid key names that `options` should be allowed to have\n * The property values of `TopLevelOptionShape` can be arbitrary\n * @memberof OptionValidator\n */\n validateTopLevelOptions(options: object, TopLevelOptionShape: object): void {\n const validOptionNames = Object.keys(TopLevelOptionShape);\n for (const option of Object.keys(options)) {\n if (!validOptionNames.includes(option)) {\n throw new Error(\n this.formatMessage(`'${option}' is not a valid top-level option.\n- Did you mean '${findSuggestion(option, validOptionNames)}'?`),\n );\n }\n }\n }\n\n // note: we do not consider rewrite them to high order functions\n // until we have to support `validateNumberOption`.\n validateBooleanOption<T extends boolean>(\n name: string,\n value?: boolean,\n defaultValue?: T,\n ): boolean | T {\n if (value === undefined) {\n return defaultValue;\n } else {\n this.invariant(\n typeof value === \"boolean\",\n `'${name}' option must be a boolean.`,\n );\n }\n return value;\n }\n\n validateStringOption<T extends string>(\n name: string,\n value?: string,\n defaultValue?: T,\n ): string | T {\n if (value === undefined) {\n return defaultValue;\n } else {\n this.invariant(\n typeof value === \"string\",\n `'${name}' option must be a string.`,\n );\n }\n return value;\n }\n /**\n * A helper interface copied from the `invariant` npm package.\n * It throws given `message` when `condition` is not met\n *\n * @param {boolean} condition\n * @param {string} message\n * @memberof OptionValidator\n */\n invariant(condition: boolean, message: string): void {\n if (!condition) {\n throw new Error(this.formatMessage(message));\n }\n }\n\n formatMessage(message: string): string {\n return `${this.descriptor}: ${message}`;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEO,MAAMC,eAAe,CAAC;EAE3BC,WAAWA,CAACC,UAAkB,EAAE;IAC9B,IAAI,CAACA,UAAU,GAAGA,UAAU;EAC9B;EAWAC,uBAAuBA,CAACC,OAAe,EAAEC,mBAA2B,EAAQ;IAC1E,MAAMC,gBAAgB,GAAGC,MAAM,CAACC,IAAI,CAACH,mBAAmB,CAAC;IACzD,KAAK,MAAMI,MAAM,IAAIF,MAAM,CAACC,IAAI,CAACJ,OAAO,CAAC,EAAE;MACzC,IAAI,CAACE,gBAAgB,CAACI,QAAQ,CAACD,MAAM,CAAC,EAAE;QACtC,MAAM,IAAIE,KAAK,CACb,IAAI,CAACC,aAAa,CAAC,IAAIH,MAAM;AACvC,kBAAkB,IAAAI,8BAAc,EAACJ,MAAM,EAAEH,gBAAgB,CAAC,IAAI,CACtD,CAAC;MACH;IACF;EACF;EAIAQ,qBAAqBA,CACnBC,IAAY,EACZC,KAAe,EACfC,YAAgB,EACH;IACb,IAAID,KAAK,KAAKE,SAAS,EAAE;MACvB,OAAOD,YAAY;IACrB,CAAC,MAAM;MACL,IAAI,CAACE,SAAS,CACZ,OAAOH,KAAK,KAAK,SAAS,EAC1B,IAAID,IAAI,6BACV,CAAC;IACH;IACA,OAAOC,KAAK;EACd;EAEAI,oBAAoBA,CAClBL,IAAY,EACZC,KAAc,EACdC,YAAgB,EACJ;IACZ,IAAID,KAAK,KAAKE,SAAS,EAAE;MACvB,OAAOD,YAAY;IACrB,CAAC,MAAM;MACL,IAAI,CAACE,SAAS,CACZ,OAAOH,KAAK,KAAK,QAAQ,EACzB,IAAID,IAAI,4BACV,CAAC;IACH;IACA,OAAOC,KAAK;EACd;EASAG,SAASA,CAACE,SAAkB,EAAEC,OAAe,EAAQ;IACnD,IAAI,CAACD,SAAS,EAAE;MACd,MAAM,IAAIV,KAAK,CAAC,IAAI,CAACC,aAAa,CAACU,OAAO,CAAC,CAAC;IAC9C;EACF;EAEAV,aAAaA,CAACU,OAAe,EAAU;IACrC,OAAO,GAAG,IAAI,CAACpB,UAAU,KAAKoB,OAAO,EAAE;EACzC;AACF;AAACC,OAAA,CAAAvB,eAAA,GAAAA,eAAA","ignoreList":[]}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"52":0.01428,"54":0.00476,"78":0.01904,"82":0.00476,"88":0.01904,"102":0.00476,"103":0.00476,"109":0.00476,"115":0.15229,"123":0.00476,"125":0.00952,"127":0.00476,"128":0.04759,"130":0.00476,"131":0.00952,"132":0.00952,"133":0.03807,"134":0.02855,"135":0.44735,"136":1.26589,"137":0.00476,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 83 84 85 86 87 89 90 91 92 93 94 95 96 97 98 99 100 101 104 105 106 107 108 110 111 112 113 114 116 117 118 119 120 121 122 124 126 129 138 139 140 3.5 3.6"},D:{"25":0.03807,"26":0.00476,"34":0.00952,"38":0.05711,"39":0.0238,"40":0.0238,"41":0.02855,"42":0.0238,"43":0.02855,"44":0.0238,"45":0.0238,"46":0.02855,"47":0.02855,"48":0.02855,"49":0.03331,"50":0.0238,"51":0.0238,"52":0.02855,"53":0.02855,"54":0.02855,"55":0.02855,"56":0.02855,"57":0.02855,"58":0.02855,"59":0.02855,"60":0.02855,"66":0.00476,"73":0.00476,"74":0.00476,"76":0.00476,"78":0.00476,"79":0.05235,"80":0.00952,"81":0.03807,"85":0.0238,"86":0.00952,"87":0.04283,"88":0.02855,"89":0.00476,"90":0.00476,"91":0.00476,"92":0.00476,"93":0.00476,"94":0.00476,"97":0.00476,"98":0.00952,"99":0.00476,"100":0.00476,"101":0.00476,"102":0.00476,"103":0.0809,"104":0.0238,"105":0.00476,"106":0.00476,"107":0.01428,"108":0.03807,"109":0.42831,"110":0.00952,"111":0.03807,"112":0.01428,"113":0.01904,"114":0.04283,"115":0.00952,"116":0.19988,"117":0.01428,"118":0.00952,"119":0.02855,"120":0.03807,"121":0.05711,"122":0.09042,"123":0.07139,"124":0.08566,"125":0.17608,"126":0.11898,"127":0.09994,"128":0.22367,"129":0.09518,"130":0.16657,"131":0.98035,"132":1.05174,"133":8.50433,"134":13.6964,"135":0.01904,"136":0.01904,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 27 28 29 30 31 32 33 35 36 37 61 62 63 64 65 67 68 69 70 71 72 75 77 83 84 95 96 137 138"},F:{"46":0.01428,"87":0.00476,"95":0.00952,"114":0.00952,"115":0.00476,"116":0.28554,"117":0.65674,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 88 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"12":0.00952,"17":0.00476,"18":0.00952,"85":0.00952,"92":0.00476,"109":0.03807,"110":0.00476,"111":0.00476,"112":0.00476,"113":0.00952,"114":0.00952,"115":0.00476,"117":0.00476,"119":0.00476,"120":0.00952,"121":0.00476,"122":0.00952,"123":0.00476,"124":0.00476,"125":0.00952,"126":0.01428,"127":0.00952,"128":0.01428,"129":0.01904,"130":0.03331,"131":0.07614,"132":0.11422,"133":2.17486,"134":4.62099,_:"13 14 15 16 79 80 81 83 84 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 116 118"},E:{"13":0.00476,"14":0.04283,"15":0.00476,_:"0 4 5 6 7 8 9 10 11 12 3.1 3.2 5.1 6.1 7.1 9.1 10.1","11.1":0.00476,"12.1":0.01904,"13.1":0.08566,"14.1":0.13325,"15.1":0.01428,"15.2-15.3":0.01428,"15.4":0.03331,"15.5":0.04759,"15.6":0.46162,"16.0":0.06187,"16.1":0.0809,"16.2":0.05235,"16.3":0.12849,"16.4":0.04283,"16.5":0.05711,"16.6":0.5568,"17.0":0.01428,"17.1":0.41879,"17.2":0.04759,"17.3":0.05711,"17.4":0.14753,"17.5":0.24271,"17.6":0.6853,"18.0":0.07614,"18.1":0.32361,"18.2":0.13801,"18.3":3.81196,"18.4":0.04283},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00456,"5.0-5.1":0,"6.0-6.1":0.01369,"7.0-7.1":0.00913,"8.1-8.4":0,"9.0-9.2":0.00685,"9.3":0.03195,"10.0-10.2":0.00228,"10.3":0.05248,"11.0-11.2":0.24188,"11.3-11.4":0.01597,"12.0-12.1":0.00913,"12.2-12.5":0.22591,"13.0-13.1":0.00456,"13.2":0.00685,"13.3":0.00913,"13.4-13.7":0.03195,"14.0-14.4":0.07987,"14.5-14.8":0.09584,"15.0-15.1":0.05248,"15.2-15.3":0.05248,"15.4":0.06389,"15.5":0.07302,"15.6-15.8":0.89908,"16.0":0.12779,"16.1":0.26242,"16.2":0.13692,"16.3":0.23732,"16.4":0.05248,"16.5":0.09812,"16.6-16.7":1.06566,"17.0":0.06389,"17.1":0.1141,"17.2":0.08671,"17.3":0.12094,"17.4":0.24188,"17.5":0.53854,"17.6-17.7":1.56312,"18.0":0.43813,"18.1":1.43305,"18.2":0.64122,"18.3":13.40178,"18.4":0.19853},P:{"4":0.09767,"20":0.01085,"21":0.03256,"22":0.01085,"23":0.0217,"24":0.03256,"25":0.03256,"26":0.07597,"27":2.7131,"5.0-5.4":0.01085,"6.2-6.4":0.01085,"7.2-7.4":0.01085,_:"8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0","19.0":0.01085},I:{"0":0.02092,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00002},K:{"0":0.14151,_:"10 11 12 11.1 11.5 12.1"},A:{"9":0.03127,"11":0.07818,_:"6 7 8 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.56079},Q:{"14.9":0.01048},O:{"0":0.04717},H:{"0":0},L:{"0":26.14679}};
|
||||
@@ -0,0 +1,101 @@
|
||||
// Copyright (c) 2010 LearnBoost <tj@learnboost.com>
|
||||
|
||||
#pragma once
|
||||
|
||||
struct Closure;
|
||||
|
||||
#include "backend/Backend.h"
|
||||
#include "closure.h"
|
||||
#include <cairo.h>
|
||||
#include "dll_visibility.h"
|
||||
#include <napi.h>
|
||||
#include <pango/pangocairo.h>
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
|
||||
/*
|
||||
* FontFace describes a font file in terms of one PangoFontDescription that
|
||||
* will resolve to it and one that the user describes it as (like @font-face)
|
||||
*/
|
||||
class FontFace {
|
||||
public:
|
||||
PangoFontDescription *sys_desc = nullptr;
|
||||
PangoFontDescription *user_desc = nullptr;
|
||||
unsigned char file_path[1024];
|
||||
};
|
||||
|
||||
enum text_baseline_t : uint8_t {
|
||||
TEXT_BASELINE_ALPHABETIC = 0,
|
||||
TEXT_BASELINE_TOP = 1,
|
||||
TEXT_BASELINE_BOTTOM = 2,
|
||||
TEXT_BASELINE_MIDDLE = 3,
|
||||
TEXT_BASELINE_IDEOGRAPHIC = 4,
|
||||
TEXT_BASELINE_HANGING = 5
|
||||
};
|
||||
|
||||
enum text_align_t : int8_t {
|
||||
TEXT_ALIGNMENT_LEFT = -1,
|
||||
TEXT_ALIGNMENT_CENTER = 0,
|
||||
TEXT_ALIGNMENT_RIGHT = 1,
|
||||
TEXT_ALIGNMENT_START = -2,
|
||||
TEXT_ALIGNMENT_END = 2
|
||||
};
|
||||
|
||||
enum canvas_draw_mode_t : uint8_t {
|
||||
TEXT_DRAW_PATHS,
|
||||
TEXT_DRAW_GLYPHS
|
||||
};
|
||||
|
||||
/*
|
||||
* Canvas.
|
||||
*/
|
||||
|
||||
class Canvas : public Napi::ObjectWrap<Canvas> {
|
||||
public:
|
||||
Canvas(const Napi::CallbackInfo& info);
|
||||
static void Initialize(Napi::Env& env, Napi::Object& target);
|
||||
|
||||
Napi::Value ToBuffer(const Napi::CallbackInfo& info);
|
||||
Napi::Value GetType(const Napi::CallbackInfo& info);
|
||||
Napi::Value GetStride(const Napi::CallbackInfo& info);
|
||||
Napi::Value GetWidth(const Napi::CallbackInfo& info);
|
||||
Napi::Value GetHeight(const Napi::CallbackInfo& info);
|
||||
void SetWidth(const Napi::CallbackInfo& info, const Napi::Value& value);
|
||||
void SetHeight(const Napi::CallbackInfo& info, const Napi::Value& value);
|
||||
void StreamPNGSync(const Napi::CallbackInfo& info);
|
||||
void StreamPDFSync(const Napi::CallbackInfo& info);
|
||||
void StreamJPEGSync(const Napi::CallbackInfo& info);
|
||||
static void RegisterFont(const Napi::CallbackInfo& info);
|
||||
static void DeregisterAllFonts(const Napi::CallbackInfo& info);
|
||||
static Napi::Value ParseFont(const Napi::CallbackInfo& info);
|
||||
Napi::Error CairoError(cairo_status_t status);
|
||||
static void ToPngBufferAsync(Closure* closure);
|
||||
static void ToJpegBufferAsync(Closure* closure);
|
||||
static PangoWeight GetWeightFromCSSString(const char *weight);
|
||||
static PangoStyle GetStyleFromCSSString(const char *style);
|
||||
static PangoFontDescription *ResolveFontDescription(const PangoFontDescription *desc);
|
||||
|
||||
DLL_PUBLIC inline Backend* backend() { return _backend; }
|
||||
DLL_PUBLIC inline cairo_surface_t* surface(){ return backend()->getSurface(); }
|
||||
cairo_t* createCairoContext();
|
||||
|
||||
DLL_PUBLIC inline uint8_t *data(){ return cairo_image_surface_get_data(surface()); }
|
||||
DLL_PUBLIC inline int stride(){ return cairo_image_surface_get_stride(surface()); }
|
||||
DLL_PUBLIC inline std::size_t nBytes(){
|
||||
return static_cast<std::size_t>(backend()->getHeight()) * stride();
|
||||
}
|
||||
|
||||
DLL_PUBLIC inline int getWidth() { return backend()->getWidth(); }
|
||||
DLL_PUBLIC inline int getHeight() { return backend()->getHeight(); }
|
||||
|
||||
void resurface(Napi::Object This);
|
||||
|
||||
Napi::Env env;
|
||||
static int fontSerial;
|
||||
|
||||
private:
|
||||
Backend* _backend;
|
||||
Napi::ObjectReference _jsBackend;
|
||||
Napi::FunctionReference ctor;
|
||||
static std::vector<FontFace> font_face_list;
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _classPrivateFieldSet2;
|
||||
var _assertClassBrand = require("./assertClassBrand.js");
|
||||
function _classPrivateFieldSet2(privateMap, receiver, value) {
|
||||
privateMap.set((0, _assertClassBrand.default)(privateMap, receiver), value);
|
||||
return value;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=classPrivateFieldSet2.js.map
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
presets: [
|
||||
["env", { targets: { node: "current" }}],
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Parser } from "../index.js";
|
||||
|
||||
export declare const parsers: {
|
||||
markdown: Parser;
|
||||
mdx: Parser;
|
||||
remark: Parser;
|
||||
};
|
||||
Reference in New Issue
Block a user