update
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
# path2d
|
||||
|
||||
[](https://github.com/nilzona/path2d-polyfill/actions/workflows/ci.yml)
|
||||
|
||||
Implements `Path2D` api and `roundRect` for CanvasRenderingContext2D
|
||||
|
||||
## Usage
|
||||
|
||||
```shell
|
||||
npm install --save path2d
|
||||
```
|
||||
|
||||
## Use in a node environment
|
||||
|
||||
The package exports a few functions that can be used in a node environment:
|
||||
|
||||
- `Path2D` - class to create Path2D objects used by the polyfill methods
|
||||
- `parsePath` - function for parsing an SVG path string into canvas commands
|
||||
- 'roundRect' - implementation of roundRect using canvas commands
|
||||
- `applyPath2DToCanvasRenderingContext` - Adds Path2D functions (if needed) to a CanvasRenderingContext and augments the fill, stroke and clip command
|
||||
- `applyRoundRectToCanvasRenderingContext2D` - Adds roundRect function (if needed) to a CanvasRenderingContext
|
||||
|
||||
```js
|
||||
import { Path2D } from "path2d";
|
||||
```
|
||||
|
||||
### usage with node-canvas
|
||||
|
||||
To get Path2D features with the [node-canvas library](https://github.com/Automattic/node-canvas) use the following pattern:
|
||||
|
||||
```js
|
||||
const { createCanvas, CanvasRenderingContext2D } = require("canvas");
|
||||
const { applyPath2DToCanvasRenderingContext, Path2D } = require("path2d");
|
||||
|
||||
applyPath2DToCanvasRenderingContext(CanvasRenderingContext2D);
|
||||
// Path2D features has now been added to CanvasRenderingContext2D
|
||||
|
||||
const canvas = createCanvas(200, 200);
|
||||
const ctx = canvas.getContext("2d");
|
||||
|
||||
const p = new Path2D("M10 10 l 20 0 l 0 20 Z");
|
||||
ctx.fillStyle = "green";
|
||||
ctx.fill(p);
|
||||
```
|
||||
|
||||
A working example of a node express server that serves an image drawn with canvas can be seen [here](https://gist.github.com/nilzona/e611c99336d8ea1f645bd391a459c24f)
|
||||
|
||||
## Support table
|
||||
|
||||
| Method | Supported |
|
||||
| -------------------- | :-------: |
|
||||
| constructor(SVGPath) | Yes |
|
||||
| addPath() | Yes |
|
||||
| closePath() | Yes |
|
||||
| moveTo() | Yes |
|
||||
| lineTo() | Yes |
|
||||
| bezierCurveTo() | Yes |
|
||||
| quadraticCurveTo() | Yes |
|
||||
| arc() | Yes |
|
||||
| ellipse() | Yes |
|
||||
| rect() | Yes |
|
||||
| roundRect() | Yes |
|
||||
|
||||
## See it in action
|
||||
|
||||
Clone [path2d-polyfill](https://github.com/nilzona/path2d-polyfill)
|
||||
|
||||
```shell
|
||||
pnpm install
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
open <http://localhost:5173/> to see the example page.
|
||||
|
||||
## Contributing
|
||||
|
||||
Recommended to use vscode with the prettier extension to keep formatting intact.
|
||||
@@ -0,0 +1,54 @@
|
||||
import { InferFileRouteTypes } from './fileRoute.js';
|
||||
import { AddTrailingSlash, RemoveTrailingSlashes } from './link.js';
|
||||
import { AnyRoute } from './route.js';
|
||||
import { AnyRouter, TrailingSlashOption } from './router.js';
|
||||
import { PartialMergeAll } from './utils.js';
|
||||
export type ParseRoute<TRouteTree, TAcc = TRouteTree> = TRouteTree extends {
|
||||
types: {
|
||||
children: infer TChildren;
|
||||
};
|
||||
} ? unknown extends TChildren ? TAcc : TChildren extends ReadonlyArray<any> ? ParseRoute<TChildren[number], TAcc | TChildren[number]> : ParseRoute<TChildren[keyof TChildren], TAcc | TChildren[keyof TChildren]> : TAcc;
|
||||
export type ParseRouteWithoutBranches<TRouteTree> = ParseRoute<TRouteTree> extends infer TRoute extends AnyRoute ? TRoute extends any ? unknown extends TRoute['types']['children'] ? TRoute : TRoute['types']['children'] extends ReadonlyArray<any> ? '/' extends TRoute['types']['children'][number]['path'] ? never : TRoute : '/' extends TRoute['types']['children'][keyof TRoute['types']['children']]['path'] ? never : TRoute : never : never;
|
||||
export type CodeRoutesById<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? {
|
||||
[K in TRoutes as K['id']]: K;
|
||||
} : never;
|
||||
export type RoutesById<TRouteTree extends AnyRoute> = InferFileRouteTypes<TRouteTree> extends never ? CodeRoutesById<TRouteTree> : InferFileRouteTypes<TRouteTree>['fileRoutesById'];
|
||||
export type RouteById<TRouteTree extends AnyRoute, TId> = Extract<RoutesById<TRouteTree>[TId & keyof RoutesById<TRouteTree>], AnyRoute>;
|
||||
export type CodeRouteIds<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? TRoutes['id'] : never;
|
||||
export type RouteIds<TRouteTree extends AnyRoute> = InferFileRouteTypes<TRouteTree> extends never ? CodeRouteIds<TRouteTree> : InferFileRouteTypes<TRouteTree>['id'];
|
||||
export type ParentPath<TRouter extends AnyRouter> = TrailingSlashOptionByRouter<TRouter> extends 'always' ? '../' : TrailingSlashOptionByRouter<TRouter> extends 'never' ? '..' : '../' | '..';
|
||||
export type CurrentPath<TRouter extends AnyRouter> = TrailingSlashOptionByRouter<TRouter> extends 'always' ? './' : TrailingSlashOptionByRouter<TRouter> extends 'never' ? '.' : './' | '.';
|
||||
export type ToPath<TRouter extends AnyRouter, TTo extends string> = TrailingSlashOptionByRouter<TRouter> extends 'always' ? AddTrailingSlash<TTo> : TrailingSlashOptionByRouter<TRouter> extends 'never' ? RemoveTrailingSlashes<TTo> : AddTrailingSlash<TTo> | RemoveTrailingSlashes<TTo>;
|
||||
export type CatchAllPaths<TRouter extends AnyRouter> = CurrentPath<TRouter> | ParentPath<TRouter>;
|
||||
export type CodeRoutesByPath<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? {
|
||||
[K in TRoutes as K['fullPath']]: K;
|
||||
} : never;
|
||||
export type RoutesByPath<TRouteTree extends AnyRoute> = InferFileRouteTypes<TRouteTree> extends never ? CodeRoutesByPath<TRouteTree> : InferFileRouteTypes<TRouteTree>['fileRoutesByFullPath'];
|
||||
export type RouteByPath<TRouteTree extends AnyRoute, TPath> = Extract<RoutesByPath<TRouteTree>[TPath & keyof RoutesByPath<TRouteTree>], AnyRoute>;
|
||||
export type CodeRoutePaths<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? TRoutes['fullPath'] : never;
|
||||
export type RoutePaths<TRouteTree extends AnyRoute> = unknown extends TRouteTree ? string : (InferFileRouteTypes<TRouteTree> extends never ? CodeRoutePaths<TRouteTree> : InferFileRouteTypes<TRouteTree>['fullPaths']) | '/';
|
||||
export type RouteToPathAlwaysTrailingSlash<TRoute extends AnyRoute> = TRoute['path'] extends '/' ? TRoute['fullPath'] : TRoute['fullPath'] extends '/' ? TRoute['fullPath'] : `${TRoute['fullPath']}/`;
|
||||
export type RouteToPathNeverTrailingSlash<TRoute extends AnyRoute> = TRoute['path'] extends '/' ? TRoute['fullPath'] extends '/' ? TRoute['fullPath'] : RemoveTrailingSlashes<TRoute['fullPath']> : TRoute['fullPath'];
|
||||
export type RouteToPathPreserveTrailingSlash<TRoute extends AnyRoute> = RouteToPathNeverTrailingSlash<TRoute> | RouteToPathAlwaysTrailingSlash<TRoute>;
|
||||
export type RouteToPathByTrailingSlashOption<TRoute extends AnyRoute> = {
|
||||
always: RouteToPathAlwaysTrailingSlash<TRoute>;
|
||||
preserve: RouteToPathPreserveTrailingSlash<TRoute>;
|
||||
never: RouteToPathNeverTrailingSlash<TRoute>;
|
||||
};
|
||||
export type TrailingSlashOptionByRouter<TRouter extends AnyRouter> = TrailingSlashOption extends TRouter['options']['trailingSlash'] ? 'never' : NonNullable<TRouter['options']['trailingSlash']>;
|
||||
export type RouteToByRouter<TRouter extends AnyRouter, TRoute extends AnyRoute> = RouteToPathByTrailingSlashOption<TRoute>[TrailingSlashOptionByRouter<TRouter>];
|
||||
export type CodeRouteToPath<TRouter extends AnyRouter> = ParseRouteWithoutBranches<TRouter['routeTree']> extends infer TRoute extends AnyRoute ? TRoute extends any ? RouteToByRouter<TRouter, TRoute> : never : never;
|
||||
export type FileRouteToPath<TRouter extends AnyRouter, TTo = InferFileRouteTypes<TRouter['routeTree']>['to'], TTrailingSlashOption = TrailingSlashOptionByRouter<TRouter>> = 'never' extends TTrailingSlashOption ? TTo : 'always' extends TTrailingSlashOption ? AddTrailingSlash<TTo> : TTo | AddTrailingSlash<TTo>;
|
||||
export type RouteToPath<TRouter extends AnyRouter> = unknown extends TRouter ? string : InferFileRouteTypes<TRouter['routeTree']> extends never ? CodeRouteToPath<TRouter> : FileRouteToPath<TRouter>;
|
||||
export type CodeRoutesByToPath<TRouter extends AnyRouter> = ParseRouteWithoutBranches<TRouter['routeTree']> extends infer TRoutes extends AnyRoute ? {
|
||||
[TRoute in TRoutes as RouteToByRouter<TRouter, TRoute>]: TRoute;
|
||||
} : never;
|
||||
export type RoutesByToPath<TRouter extends AnyRouter> = InferFileRouteTypes<TRouter['routeTree']> extends never ? CodeRoutesByToPath<TRouter> : InferFileRouteTypes<TRouter['routeTree']>['fileRoutesByTo'];
|
||||
export type CodeRouteByToPath<TRouter extends AnyRouter, TTo> = Extract<RoutesByToPath<TRouter>[TTo & keyof RoutesByToPath<TRouter>], AnyRoute>;
|
||||
export type FileRouteByToPath<TRouter extends AnyRouter, TTo> = 'never' extends TrailingSlashOptionByRouter<TRouter> ? CodeRouteByToPath<TRouter, TTo> : 'always' extends TrailingSlashOptionByRouter<TRouter> ? TTo extends '/' ? CodeRouteByToPath<TRouter, TTo> : TTo extends `${infer TPath}/` ? CodeRouteByToPath<TRouter, TPath> : never : CodeRouteByToPath<TRouter, TTo extends '/' ? TTo : RemoveTrailingSlashes<TTo>>;
|
||||
export type RouteByToPath<TRouter extends AnyRouter, TTo> = InferFileRouteTypes<TRouter['routeTree']> extends never ? CodeRouteByToPath<TRouter, TTo> : FileRouteByToPath<TRouter, TTo>;
|
||||
export type FullSearchSchema<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? PartialMergeAll<TRoutes['types']['fullSearchSchema']> : never;
|
||||
export type FullSearchSchemaInput<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? PartialMergeAll<TRoutes['types']['fullSearchSchemaInput']> : never;
|
||||
export type AllParams<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? PartialMergeAll<TRoutes['types']['allParams']> : never;
|
||||
export type AllContext<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? PartialMergeAll<TRoutes['types']['allContext']> : never;
|
||||
export type AllLoaderData<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? PartialMergeAll<TRoutes['types']['loaderData']> : never;
|
||||
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"name": "@eslint-community/regexpp",
|
||||
"version": "4.12.1",
|
||||
"description": "Regular expression parser for ECMAScript.",
|
||||
"keywords": [
|
||||
"regexp",
|
||||
"regular",
|
||||
"expression",
|
||||
"parser",
|
||||
"validator",
|
||||
"ast",
|
||||
"abstract",
|
||||
"syntax",
|
||||
"tree",
|
||||
"ecmascript",
|
||||
"es2015",
|
||||
"es2016",
|
||||
"es2017",
|
||||
"es2018",
|
||||
"es2019",
|
||||
"es2020",
|
||||
"es2021",
|
||||
"annexB"
|
||||
],
|
||||
"homepage": "https://github.com/eslint-community/regexpp#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint-community/regexpp/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/eslint-community/regexpp"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "Toru Nagashima",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"import": "./index.mjs",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "index",
|
||||
"files": [
|
||||
"index.*"
|
||||
],
|
||||
"scripts": {
|
||||
"prebuild": "npm run -s clean",
|
||||
"build": "run-s build:*",
|
||||
"build:tsc": "tsc --module es2015",
|
||||
"build:rollup": "rollup -c",
|
||||
"build:dts": "npm run -s build:tsc -- --removeComments false && dts-bundle --name @eslint-community/regexpp --main .temp/index.d.ts --out ../index.d.ts && prettier --write index.d.ts",
|
||||
"clean": "rimraf .temp index.*",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"test": "nyc _mocha \"test/*.ts\" --reporter dot --timeout 10000",
|
||||
"debug": "mocha --require ts-node/register/transpile-only \"test/*.ts\" --reporter dot --timeout 10000",
|
||||
"update:test": "ts-node scripts/update-fixtures.ts",
|
||||
"update:unicode": "run-s update:unicode:*",
|
||||
"update:unicode:ids": "ts-node scripts/update-unicode-ids.ts",
|
||||
"update:unicode:props": "ts-node scripts/update-unicode-properties.ts",
|
||||
"update:test262:extract": "ts-node -T scripts/extract-test262.ts",
|
||||
"preversion": "npm test && npm run -s build",
|
||||
"postversion": "git push && git push --tags",
|
||||
"prewatch": "npm run -s clean",
|
||||
"watch": "_mocha \"test/*.ts\" --require ts-node/register --reporter dot --timeout 10000 --watch-extensions ts --watch --growl"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@eslint-community/eslint-plugin-mysticatea": "^15.5.1",
|
||||
"@rollup/plugin-node-resolve": "^14.1.0",
|
||||
"@types/eslint": "^8.44.3",
|
||||
"@types/jsdom": "^16.2.15",
|
||||
"@types/mocha": "^9.1.1",
|
||||
"@types/node": "^12.20.55",
|
||||
"dts-bundle": "^0.7.3",
|
||||
"eslint": "^8.50.0",
|
||||
"js-tokens": "^8.0.2",
|
||||
"jsdom": "^19.0.0",
|
||||
"mocha": "^9.2.2",
|
||||
"npm-run-all2": "^6.2.2",
|
||||
"nyc": "^14.1.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.79.1",
|
||||
"rollup-plugin-sourcemaps": "^0.6.3",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "~5.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.0.0 || ^14.0.0 || >=16.0.0"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,328 @@
|
||||
/**
|
||||
* @fileoverview The `Config` class
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const { deepMergeArrays } = require("../shared/deep-merge-arrays");
|
||||
const { getRuleFromConfig } = require("./flat-config-helpers");
|
||||
const { flatConfigSchema, hasMethod } = require("./flat-config-schema");
|
||||
const { RuleValidator } = require("./rule-validator");
|
||||
const { ObjectSchema } = require("@eslint/config-array");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const ruleValidator = new RuleValidator();
|
||||
|
||||
const severities = new Map([
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
[2, 2],
|
||||
["off", 0],
|
||||
["warn", 1],
|
||||
["error", 2],
|
||||
]);
|
||||
|
||||
/**
|
||||
* Splits a plugin identifier in the form a/b/c into two parts: a/b and c.
|
||||
* @param {string} identifier The identifier to parse.
|
||||
* @returns {{objectName: string, pluginName: string}} The parts of the plugin
|
||||
* name.
|
||||
*/
|
||||
function splitPluginIdentifier(identifier) {
|
||||
const parts = identifier.split("/");
|
||||
|
||||
return {
|
||||
objectName: parts.pop(),
|
||||
pluginName: parts.join("/"),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of an object in the config by reading its `meta` key.
|
||||
* @param {Object} object The object to check.
|
||||
* @returns {string?} The name of the object if found or `null` if there
|
||||
* is no name.
|
||||
*/
|
||||
function getObjectId(object) {
|
||||
// first check old-style name
|
||||
let name = object.name;
|
||||
|
||||
if (!name) {
|
||||
if (!object.meta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
name = object.meta.name;
|
||||
|
||||
if (!name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// now check for old-style version
|
||||
let version = object.version;
|
||||
|
||||
if (!version) {
|
||||
version = object.meta && object.meta.version;
|
||||
}
|
||||
|
||||
// if there's a version then append that
|
||||
if (version) {
|
||||
return `${name}@${version}`;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a languageOptions object to a JSON representation.
|
||||
* @param {Record<string, any>} languageOptions The options to create a JSON
|
||||
* representation of.
|
||||
* @param {string} objectKey The key of the object being converted.
|
||||
* @returns {Record<string, any>} The JSON representation of the languageOptions.
|
||||
* @throws {TypeError} If a function is found in the languageOptions.
|
||||
*/
|
||||
function languageOptionsToJSON(languageOptions, objectKey = "languageOptions") {
|
||||
const result = {};
|
||||
|
||||
for (const [key, value] of Object.entries(languageOptions)) {
|
||||
if (value) {
|
||||
if (typeof value === "object") {
|
||||
const name = getObjectId(value);
|
||||
|
||||
if (name && hasMethod(value)) {
|
||||
result[key] = name;
|
||||
} else {
|
||||
result[key] = languageOptionsToJSON(value, key);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeof value === "function") {
|
||||
const error = new TypeError(
|
||||
`Cannot serialize key "${key}" in ${objectKey}: Function values are not supported.`,
|
||||
);
|
||||
|
||||
error.messageTemplate = "config-serialize-function";
|
||||
error.messageData = { key, objectKey };
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
result[key] = value;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Represents a normalized configuration object.
|
||||
*/
|
||||
class Config {
|
||||
/**
|
||||
* The name to use for the language when serializing to JSON.
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
#languageName;
|
||||
|
||||
/**
|
||||
* The name to use for the processor when serializing to JSON.
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
#processorName;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Object} config The configuration object.
|
||||
*/
|
||||
constructor(config) {
|
||||
const { plugins, language, languageOptions, processor, ...otherKeys } =
|
||||
config;
|
||||
|
||||
// Validate config object
|
||||
const schema = new ObjectSchema(flatConfigSchema);
|
||||
|
||||
schema.validate(config);
|
||||
|
||||
// first, copy all the other keys over
|
||||
Object.assign(this, otherKeys);
|
||||
|
||||
// ensure that a language is specified
|
||||
if (!language) {
|
||||
throw new TypeError("Key 'language' is required.");
|
||||
}
|
||||
|
||||
// copy the rest over
|
||||
this.plugins = plugins;
|
||||
this.language = language;
|
||||
|
||||
// Check language value
|
||||
const {
|
||||
pluginName: languagePluginName,
|
||||
objectName: localLanguageName,
|
||||
} = splitPluginIdentifier(language);
|
||||
|
||||
this.#languageName = language;
|
||||
|
||||
if (
|
||||
!plugins ||
|
||||
!plugins[languagePluginName] ||
|
||||
!plugins[languagePluginName].languages ||
|
||||
!plugins[languagePluginName].languages[localLanguageName]
|
||||
) {
|
||||
throw new TypeError(
|
||||
`Key "language": Could not find "${localLanguageName}" in plugin "${languagePluginName}".`,
|
||||
);
|
||||
}
|
||||
|
||||
this.language =
|
||||
plugins[languagePluginName].languages[localLanguageName];
|
||||
|
||||
if (this.language.defaultLanguageOptions ?? languageOptions) {
|
||||
this.languageOptions = flatConfigSchema.languageOptions.merge(
|
||||
this.language.defaultLanguageOptions,
|
||||
languageOptions,
|
||||
);
|
||||
} else {
|
||||
this.languageOptions = {};
|
||||
}
|
||||
|
||||
// Validate language options
|
||||
try {
|
||||
this.language.validateLanguageOptions(this.languageOptions);
|
||||
} catch (error) {
|
||||
throw new TypeError(`Key "languageOptions": ${error.message}`, {
|
||||
cause: error,
|
||||
});
|
||||
}
|
||||
|
||||
// Normalize language options if necessary
|
||||
if (this.language.normalizeLanguageOptions) {
|
||||
this.languageOptions = this.language.normalizeLanguageOptions(
|
||||
this.languageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
// Check processor value
|
||||
if (processor) {
|
||||
this.processor = processor;
|
||||
|
||||
if (typeof processor === "string") {
|
||||
const { pluginName, objectName: localProcessorName } =
|
||||
splitPluginIdentifier(processor);
|
||||
|
||||
this.#processorName = processor;
|
||||
|
||||
if (
|
||||
!plugins ||
|
||||
!plugins[pluginName] ||
|
||||
!plugins[pluginName].processors ||
|
||||
!plugins[pluginName].processors[localProcessorName]
|
||||
) {
|
||||
throw new TypeError(
|
||||
`Key "processor": Could not find "${localProcessorName}" in plugin "${pluginName}".`,
|
||||
);
|
||||
}
|
||||
|
||||
this.processor =
|
||||
plugins[pluginName].processors[localProcessorName];
|
||||
} else if (typeof processor === "object") {
|
||||
this.#processorName = getObjectId(processor);
|
||||
this.processor = processor;
|
||||
} else {
|
||||
throw new TypeError(
|
||||
"Key 'processor' must be a string or an object.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Process the rules
|
||||
if (this.rules) {
|
||||
this.#normalizeRulesConfig();
|
||||
ruleValidator.validate(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the configuration to a JSON representation.
|
||||
* @returns {Record<string, any>} The JSON representation of the configuration.
|
||||
* @throws {Error} If the configuration cannot be serialized.
|
||||
*/
|
||||
toJSON() {
|
||||
if (this.processor && !this.#processorName) {
|
||||
throw new Error(
|
||||
"Could not serialize processor object (missing 'meta' object).",
|
||||
);
|
||||
}
|
||||
|
||||
if (!this.#languageName) {
|
||||
throw new Error(
|
||||
"Could not serialize language object (missing 'meta' object).",
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
...this,
|
||||
plugins: Object.entries(this.plugins).map(([namespace, plugin]) => {
|
||||
const pluginId = getObjectId(plugin);
|
||||
|
||||
if (!pluginId) {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
return `${namespace}:${pluginId}`;
|
||||
}),
|
||||
language: this.#languageName,
|
||||
languageOptions: languageOptionsToJSON(this.languageOptions),
|
||||
processor: this.#processorName,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes the rules configuration. Ensures that each rule config is
|
||||
* an array and that the severity is a number. Applies meta.defaultOptions.
|
||||
* This function modifies `this.rules`.
|
||||
* @returns {void}
|
||||
*/
|
||||
#normalizeRulesConfig() {
|
||||
for (const [ruleId, originalConfig] of Object.entries(this.rules)) {
|
||||
// ensure rule config is an array
|
||||
let ruleConfig = Array.isArray(originalConfig)
|
||||
? originalConfig
|
||||
: [originalConfig];
|
||||
|
||||
// normalize severity
|
||||
ruleConfig[0] = severities.get(ruleConfig[0]);
|
||||
|
||||
const rule = getRuleFromConfig(ruleId, this);
|
||||
|
||||
// apply meta.defaultOptions
|
||||
const slicedOptions = ruleConfig.slice(1);
|
||||
const mergedOptions = deepMergeArrays(
|
||||
rule?.meta?.defaultOptions,
|
||||
slicedOptions,
|
||||
);
|
||||
|
||||
if (mergedOptions.length) {
|
||||
ruleConfig = [ruleConfig[0], ...mergedOptions];
|
||||
}
|
||||
|
||||
this.rules[ruleId] = ruleConfig;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { Config };
|
||||
@@ -0,0 +1,239 @@
|
||||
export type PageViewportParameters = {
|
||||
/**
|
||||
* - The xMin, yMin, xMax and
|
||||
* yMax coordinates.
|
||||
*/
|
||||
viewBox: Array<number>;
|
||||
/**
|
||||
* - The scale of the viewport.
|
||||
*/
|
||||
scale: number;
|
||||
/**
|
||||
* - The rotation, in degrees, of the viewport.
|
||||
*/
|
||||
rotation: number;
|
||||
/**
|
||||
* - The horizontal, i.e. x-axis, offset. The
|
||||
* default value is `0`.
|
||||
*/
|
||||
offsetX?: number | undefined;
|
||||
/**
|
||||
* - The vertical, i.e. y-axis, offset. The
|
||||
* default value is `0`.
|
||||
*/
|
||||
offsetY?: number | undefined;
|
||||
/**
|
||||
* - If true, the y-axis will not be flipped.
|
||||
* The default value is `false`.
|
||||
*/
|
||||
dontFlip?: boolean | undefined;
|
||||
};
|
||||
export type PageViewportCloneParameters = {
|
||||
/**
|
||||
* - The scale, overriding the one in the cloned
|
||||
* viewport. The default value is `this.scale`.
|
||||
*/
|
||||
scale?: number | undefined;
|
||||
/**
|
||||
* - The rotation, in degrees, overriding the one
|
||||
* in the cloned viewport. The default value is `this.rotation`.
|
||||
*/
|
||||
rotation?: number | undefined;
|
||||
/**
|
||||
* - The horizontal, i.e. x-axis, offset.
|
||||
* The default value is `this.offsetX`.
|
||||
*/
|
||||
offsetX?: number | undefined;
|
||||
/**
|
||||
* - The vertical, i.e. y-axis, offset.
|
||||
* The default value is `this.offsetY`.
|
||||
*/
|
||||
offsetY?: number | undefined;
|
||||
/**
|
||||
* - If true, the x-axis will not be flipped.
|
||||
* The default value is `false`.
|
||||
*/
|
||||
dontFlip?: boolean | undefined;
|
||||
};
|
||||
export function deprecated(details: any): void;
|
||||
export function fetchData(url: any, type?: string): Promise<any>;
|
||||
export function getColorValues(colors: any): void;
|
||||
export function getCurrentTransform(ctx: any): any[];
|
||||
export function getCurrentTransformInverse(ctx: any): any[];
|
||||
/**
|
||||
* Gets the filename from a given URL.
|
||||
* @param {string} url
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getFilenameFromUrl(url: string): string;
|
||||
/**
|
||||
* Returns the filename or guessed filename from the url (see issue 3455).
|
||||
* @param {string} url - The original PDF location.
|
||||
* @param {string} defaultFilename - The value returned if the filename is
|
||||
* unknown, or the protocol is unsupported.
|
||||
* @returns {string} Guessed PDF filename.
|
||||
*/
|
||||
export function getPdfFilenameFromUrl(url: string, defaultFilename?: string): string;
|
||||
export function getRGB(color: any): any;
|
||||
/**
|
||||
* NOTE: This is (mostly) intended to support printing of XFA forms.
|
||||
*/
|
||||
export function getXfaPageViewport(xfaPage: any, { scale, rotation }: {
|
||||
scale?: number | undefined;
|
||||
rotation?: number | undefined;
|
||||
}): PageViewport;
|
||||
export function isDataScheme(url: any): boolean;
|
||||
export function isPdfFile(filename: any): boolean;
|
||||
export function isValidFetchUrl(url: any, baseUrl: any): boolean;
|
||||
/**
|
||||
* Event handler to suppress context menu.
|
||||
*/
|
||||
export function noContextMenu(e: any): void;
|
||||
/**
|
||||
* Scale factors for the canvas, necessary with HiDPI displays.
|
||||
*/
|
||||
export class OutputScale {
|
||||
/**
|
||||
* @type {number} Horizontal scale.
|
||||
*/
|
||||
sx: number;
|
||||
/**
|
||||
* @type {number} Vertical scale.
|
||||
*/
|
||||
sy: number;
|
||||
/**
|
||||
* @type {boolean} Returns `true` when scaling is required, `false` otherwise.
|
||||
*/
|
||||
get scaled(): boolean;
|
||||
get symmetric(): boolean;
|
||||
}
|
||||
/**
|
||||
* @typedef {Object} PageViewportParameters
|
||||
* @property {Array<number>} viewBox - The xMin, yMin, xMax and
|
||||
* yMax coordinates.
|
||||
* @property {number} scale - The scale of the viewport.
|
||||
* @property {number} rotation - The rotation, in degrees, of the viewport.
|
||||
* @property {number} [offsetX] - The horizontal, i.e. x-axis, offset. The
|
||||
* default value is `0`.
|
||||
* @property {number} [offsetY] - The vertical, i.e. y-axis, offset. The
|
||||
* default value is `0`.
|
||||
* @property {boolean} [dontFlip] - If true, the y-axis will not be flipped.
|
||||
* The default value is `false`.
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} PageViewportCloneParameters
|
||||
* @property {number} [scale] - The scale, overriding the one in the cloned
|
||||
* viewport. The default value is `this.scale`.
|
||||
* @property {number} [rotation] - The rotation, in degrees, overriding the one
|
||||
* in the cloned viewport. The default value is `this.rotation`.
|
||||
* @property {number} [offsetX] - The horizontal, i.e. x-axis, offset.
|
||||
* The default value is `this.offsetX`.
|
||||
* @property {number} [offsetY] - The vertical, i.e. y-axis, offset.
|
||||
* The default value is `this.offsetY`.
|
||||
* @property {boolean} [dontFlip] - If true, the x-axis will not be flipped.
|
||||
* The default value is `false`.
|
||||
*/
|
||||
/**
|
||||
* PDF page viewport created based on scale, rotation and offset.
|
||||
*/
|
||||
export class PageViewport {
|
||||
/**
|
||||
* @param {PageViewportParameters}
|
||||
*/
|
||||
constructor({ viewBox, scale, rotation, offsetX, offsetY, dontFlip, }: PageViewportParameters);
|
||||
viewBox: number[];
|
||||
scale: number;
|
||||
rotation: number;
|
||||
offsetX: number;
|
||||
offsetY: number;
|
||||
transform: number[];
|
||||
width: number;
|
||||
height: number;
|
||||
/**
|
||||
* The original, un-scaled, viewport dimensions.
|
||||
* @type {Object}
|
||||
*/
|
||||
get rawDims(): Object;
|
||||
/**
|
||||
* Clones viewport, with optional additional properties.
|
||||
* @param {PageViewportCloneParameters} [params]
|
||||
* @returns {PageViewport} Cloned viewport.
|
||||
*/
|
||||
clone({ scale, rotation, offsetX, offsetY, dontFlip, }?: PageViewportCloneParameters | undefined): PageViewport;
|
||||
/**
|
||||
* Converts PDF point to the viewport coordinates. For examples, useful for
|
||||
* converting PDF location into canvas pixel coordinates.
|
||||
* @param {number} x - The x-coordinate.
|
||||
* @param {number} y - The y-coordinate.
|
||||
* @returns {Array} Array containing `x`- and `y`-coordinates of the
|
||||
* point in the viewport coordinate space.
|
||||
* @see {@link convertToPdfPoint}
|
||||
* @see {@link convertToViewportRectangle}
|
||||
*/
|
||||
convertToViewportPoint(x: number, y: number): any[];
|
||||
/**
|
||||
* Converts PDF rectangle to the viewport coordinates.
|
||||
* @param {Array} rect - The xMin, yMin, xMax and yMax coordinates.
|
||||
* @returns {Array} Array containing corresponding coordinates of the
|
||||
* rectangle in the viewport coordinate space.
|
||||
* @see {@link convertToViewportPoint}
|
||||
*/
|
||||
convertToViewportRectangle(rect: any[]): any[];
|
||||
/**
|
||||
* Converts viewport coordinates to the PDF location. For examples, useful
|
||||
* for converting canvas pixel location into PDF one.
|
||||
* @param {number} x - The x-coordinate.
|
||||
* @param {number} y - The y-coordinate.
|
||||
* @returns {Array} Array containing `x`- and `y`-coordinates of the
|
||||
* point in the PDF coordinate space.
|
||||
* @see {@link convertToViewportPoint}
|
||||
*/
|
||||
convertToPdfPoint(x: number, y: number): any[];
|
||||
}
|
||||
export class PDFDateString {
|
||||
static "__#2@#regex": any;
|
||||
/**
|
||||
* Convert a PDF date string to a JavaScript `Date` object.
|
||||
*
|
||||
* The PDF date string format is described in section 7.9.4 of the official
|
||||
* PDF 32000-1:2008 specification. However, in the PDF 1.7 reference (sixth
|
||||
* edition) Adobe describes the same format including a trailing apostrophe.
|
||||
* This syntax in incorrect, but Adobe Acrobat creates PDF files that contain
|
||||
* them. We ignore all apostrophes as they are not necessary for date parsing.
|
||||
*
|
||||
* Moreover, Adobe Acrobat doesn't handle changing the date to universal time
|
||||
* and doesn't use the user's time zone (effectively ignoring the HH' and mm'
|
||||
* parts of the date string).
|
||||
*
|
||||
* @param {string} input
|
||||
* @returns {Date|null}
|
||||
*/
|
||||
static toDateObject(input: string): Date | null;
|
||||
}
|
||||
export class PixelsPerInch {
|
||||
static CSS: number;
|
||||
static PDF: number;
|
||||
static PDF_TO_CSS_UNITS: number;
|
||||
}
|
||||
declare const RenderingCancelledException_base: any;
|
||||
export class RenderingCancelledException extends RenderingCancelledException_base {
|
||||
[x: string]: any;
|
||||
constructor(msg: any, extraDelay?: number);
|
||||
extraDelay: number;
|
||||
}
|
||||
/**
|
||||
* @param {HTMLDivElement} div
|
||||
* @param {PageViewport} viewport
|
||||
* @param {boolean} mustFlip
|
||||
* @param {boolean} mustRotate
|
||||
*/
|
||||
export function setLayerDimensions(div: HTMLDivElement, viewport: PageViewport, mustFlip?: boolean, mustRotate?: boolean): void;
|
||||
export class StatTimer {
|
||||
started: any;
|
||||
times: any[];
|
||||
time(name: any): void;
|
||||
timeEnd(name: any): void;
|
||||
toString(): string;
|
||||
}
|
||||
export const SVG_NS: "http://www.w3.org/2000/svg";
|
||||
export {};
|
||||
@@ -0,0 +1,19 @@
|
||||
# @babel/parser
|
||||
|
||||
> A JavaScript parser
|
||||
|
||||
See our website [@babel/parser](https://babeljs.io/docs/babel-parser) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20parser%22+is%3Aopen) associated with this package.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/parser
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/parser --dev
|
||||
```
|
||||
@@ -0,0 +1,28 @@
|
||||
# PostCSS
|
||||
|
||||
<img align="right" width="95" height="95"
|
||||
alt="Philosopher’s stone, logo of PostCSS"
|
||||
src="https://postcss.org/logo.svg">
|
||||
|
||||
PostCSS is a tool for transforming styles with JS plugins.
|
||||
These plugins can lint your CSS, support variables and mixins,
|
||||
transpile future CSS syntax, inline images, and more.
|
||||
|
||||
PostCSS is used by industry leaders including Wikipedia, Twitter, Alibaba,
|
||||
and JetBrains. The [Autoprefixer] and [Stylelint] PostCSS plugins is one of the most popular CSS tools.
|
||||
|
||||
---
|
||||
|
||||
<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" /> Made at <b><a href="https://evilmartians.com/devtools?utm_source=postcss&utm_campaign=devtools-button&utm_medium=github">Evil Martians</a></b>, product consulting for <b>developer tools</b>.
|
||||
|
||||
---
|
||||
|
||||
[Abstract Syntax Tree]: https://en.wikipedia.org/wiki/Abstract_syntax_tree
|
||||
[Evil Martians]: https://evilmartians.com/?utm_source=postcss
|
||||
[Autoprefixer]: https://github.com/postcss/autoprefixer
|
||||
[Stylelint]: https://stylelint.io/
|
||||
[plugins]: https://github.com/postcss/postcss#plugins
|
||||
|
||||
|
||||
## Docs
|
||||
Read full docs **[here](https://postcss.org/)**.
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_index","require","traverse","node","handlers","state","enter","exit","traverseSimpleImpl","ancestors","keys","VISITOR_KEYS","type","key","subNode","Array","isArray","i","length","child","push","index","pop"],"sources":["../../src/traverse/traverse.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"../definitions/index.ts\";\nimport type * as t from \"../index.ts\";\n\nexport type TraversalAncestors = Array<{\n node: t.Node;\n key: string;\n index?: number;\n}>;\n\nexport type TraversalHandler<T> = (\n this: undefined,\n node: t.Node,\n parent: TraversalAncestors,\n state: T,\n) => void;\n\nexport type TraversalHandlers<T> = {\n enter?: TraversalHandler<T>;\n exit?: TraversalHandler<T>;\n};\n\n/**\n * A general AST traversal with both prefix and postfix handlers, and a\n * state object. Exposes ancestry data to each handler so that more complex\n * AST data can be taken into account.\n */\nexport default function traverse<T>(\n node: t.Node,\n handlers: TraversalHandler<T> | TraversalHandlers<T>,\n state?: T,\n): void {\n if (typeof handlers === \"function\") {\n handlers = { enter: handlers };\n }\n\n const { enter, exit } = handlers;\n\n traverseSimpleImpl(node, enter, exit, state, []);\n}\n\nfunction traverseSimpleImpl<T>(\n node: any,\n enter: Function | undefined,\n exit: Function | undefined,\n state: T | undefined,\n ancestors: TraversalAncestors,\n) {\n const keys = VISITOR_KEYS[node.type];\n if (!keys) return;\n\n if (enter) enter(node, ancestors, state);\n\n for (const key of keys) {\n const subNode = node[key];\n\n if (Array.isArray(subNode)) {\n for (let i = 0; i < subNode.length; i++) {\n const child = subNode[i];\n if (!child) continue;\n\n ancestors.push({\n node,\n key,\n index: i,\n });\n\n traverseSimpleImpl(child, enter, exit, state, ancestors);\n\n ancestors.pop();\n }\n } else if (subNode) {\n ancestors.push({\n node,\n key,\n });\n\n traverseSimpleImpl(subNode, enter, exit, state, ancestors);\n\n ancestors.pop();\n }\n }\n\n if (exit) exit(node, ancestors, state);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AA0Be,SAASC,QAAQA,CAC9BC,IAAY,EACZC,QAAoD,EACpDC,KAAS,EACH;EACN,IAAI,OAAOD,QAAQ,KAAK,UAAU,EAAE;IAClCA,QAAQ,GAAG;MAAEE,KAAK,EAAEF;IAAS,CAAC;EAChC;EAEA,MAAM;IAAEE,KAAK;IAAEC;EAAK,CAAC,GAAGH,QAAQ;EAEhCI,kBAAkB,CAACL,IAAI,EAAEG,KAAK,EAAEC,IAAI,EAAEF,KAAK,EAAE,EAAE,CAAC;AAClD;AAEA,SAASG,kBAAkBA,CACzBL,IAAS,EACTG,KAA2B,EAC3BC,IAA0B,EAC1BF,KAAoB,EACpBI,SAA6B,EAC7B;EACA,MAAMC,IAAI,GAAGC,mBAAY,CAACR,IAAI,CAACS,IAAI,CAAC;EACpC,IAAI,CAACF,IAAI,EAAE;EAEX,IAAIJ,KAAK,EAAEA,KAAK,CAACH,IAAI,EAAEM,SAAS,EAAEJ,KAAK,CAAC;EAExC,KAAK,MAAMQ,GAAG,IAAIH,IAAI,EAAE;IACtB,MAAMI,OAAO,GAAGX,IAAI,CAACU,GAAG,CAAC;IAEzB,IAAIE,KAAK,CAACC,OAAO,CAACF,OAAO,CAAC,EAAE;MAC1B,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,OAAO,CAACI,MAAM,EAAED,CAAC,EAAE,EAAE;QACvC,MAAME,KAAK,GAAGL,OAAO,CAACG,CAAC,CAAC;QACxB,IAAI,CAACE,KAAK,EAAE;QAEZV,SAAS,CAACW,IAAI,CAAC;UACbjB,IAAI;UACJU,GAAG;UACHQ,KAAK,EAAEJ;QACT,CAAC,CAAC;QAEFT,kBAAkB,CAACW,KAAK,EAAEb,KAAK,EAAEC,IAAI,EAAEF,KAAK,EAAEI,SAAS,CAAC;QAExDA,SAAS,CAACa,GAAG,CAAC,CAAC;MACjB;IACF,CAAC,MAAM,IAAIR,OAAO,EAAE;MAClBL,SAAS,CAACW,IAAI,CAAC;QACbjB,IAAI;QACJU;MACF,CAAC,CAAC;MAEFL,kBAAkB,CAACM,OAAO,EAAER,KAAK,EAAEC,IAAI,EAAEF,KAAK,EAAEI,SAAS,CAAC;MAE1DA,SAAS,CAACa,GAAG,CAAC,CAAC;IACjB;EACF;EAEA,IAAIf,IAAI,EAAEA,IAAI,CAACJ,IAAI,EAAEM,SAAS,EAAEJ,KAAK,CAAC;AACxC","ignoreList":[]}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"E F A B","2":"mC","8":"K D"},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 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","4":"nC LC"},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 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","2":"sC SC"},F:{"1":"0 1 2 3 4 5 6 7 8 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 6C 7C FC kC 8C GC","2":"F 4C 5C"},G:{"1":"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:{"1":"LC J I XD YD ZD aD lC bD cD"},J:{"1":"D A"},K:{"1":"B C H FC kC GC","2":"A"},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:1,C:"Web Storage - name/value pairs",D:true};
|
||||
@@ -0,0 +1,3 @@
|
||||
const version = "8.3.0";
|
||||
|
||||
export default version;
|
||||
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _classStaticPrivateFieldDestructureSet;
|
||||
var _classApplyDescriptorDestructureSet = require("classApplyDescriptorDestructureSet");
|
||||
var _assertClassBrand = require("assertClassBrand");
|
||||
var _classCheckPrivateStaticFieldDescriptor = require("classCheckPrivateStaticFieldDescriptor");
|
||||
function _classStaticPrivateFieldDestructureSet(receiver, classConstructor, descriptor) {
|
||||
_assertClassBrand(classConstructor, receiver);
|
||||
_classCheckPrivateStaticFieldDescriptor(descriptor, "set");
|
||||
return _classApplyDescriptorDestructureSet(receiver, descriptor);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=classStaticPrivateFieldDestructureSet.js.map
|
||||
Binary file not shown.
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* @fileoverview ESLint Processor Service
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
/* eslint class-methods-use-this: off -- Anticipate future constructor arguments. */
|
||||
|
||||
"use strict";
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const path = require("node:path");
|
||||
const { VFile } = require("../linter/vfile.js");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Types
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/** @typedef {import("../shared/types.js").LintMessage} LintMessage */
|
||||
/** @typedef {import("../linter/vfile.js").VFile} VFile */
|
||||
/** @typedef {import("@eslint/core").Language} Language */
|
||||
/** @typedef {import("@eslint/core").LanguageOptions} LanguageOptions */
|
||||
/** @typedef {import("eslint").Linter.Processor} Processor */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* The service that applies processors to files.
|
||||
*/
|
||||
class ProcessorService {
|
||||
/**
|
||||
* Preprocesses the given file synchronously.
|
||||
* @param {VFile} file The file to preprocess.
|
||||
* @param {{processor:Processor}} config The configuration to use.
|
||||
* @returns {{ok:boolean, files?: Array<VFile>, errors?: Array<LintMessage>}} An array of preprocessed files or errors.
|
||||
* @throws {Error} If the preprocessor returns a promise.
|
||||
*/
|
||||
preprocessSync(file, config) {
|
||||
const { processor } = config;
|
||||
let blocks;
|
||||
|
||||
try {
|
||||
blocks = processor.preprocess(file.rawBody, file.path);
|
||||
} catch (ex) {
|
||||
// If the message includes a leading line number, strip it:
|
||||
const message = `Preprocessing error: ${ex.message.replace(/^line \d+:/iu, "").trim()}`;
|
||||
|
||||
return {
|
||||
ok: false,
|
||||
errors: [
|
||||
{
|
||||
ruleId: null,
|
||||
fatal: true,
|
||||
severity: 2,
|
||||
message,
|
||||
line: ex.lineNumber,
|
||||
column: ex.column,
|
||||
nodeType: null,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof blocks.then === "function") {
|
||||
throw new Error("Unsupported: Preprocessor returned a promise.");
|
||||
}
|
||||
|
||||
return {
|
||||
ok: true,
|
||||
files: blocks.map((block, i) => {
|
||||
// Legacy behavior: return the block as a string
|
||||
if (typeof block === "string") {
|
||||
return block;
|
||||
}
|
||||
|
||||
const filePath = path.join(file.path, `${i}_${block.filename}`);
|
||||
|
||||
return new VFile(filePath, block.text, {
|
||||
physicalPath: file.physicalPath,
|
||||
});
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Postprocesses the given messages synchronously.
|
||||
* @param {VFile} file The file to postprocess.
|
||||
* @param {LintMessage[][]} messages The messages to postprocess.
|
||||
* @param {{processor:Processor}} config The configuration to use.
|
||||
* @returns {LintMessage[]} The postprocessed messages.
|
||||
*/
|
||||
postprocessSync(file, messages, config) {
|
||||
const { processor } = config;
|
||||
|
||||
return processor.postprocess(messages, file.path);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { ProcessorService };
|
||||
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _toSetter;
|
||||
function _toSetter(fn, args, thisArg) {
|
||||
if (!args) args = [];
|
||||
var l = args.length++;
|
||||
return Object.defineProperty({}, "_", {
|
||||
set: function (v) {
|
||||
args[l] = v;
|
||||
fn.apply(thisArg, args);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=toSetter.js.map
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="64"
|
||||
height="64"
|
||||
viewBox="0 0 64 64">
|
||||
<path
|
||||
d="M 25.470843,9.4933766 C 25.30219,12.141818 30.139101,14.445969 34.704831,13.529144 40.62635,12.541995 41.398833,7.3856498 35.97505,5.777863 31.400921,4.1549155 25.157674,6.5445892 25.470843,9.4933766 z M 4.5246282,17.652051 C 4.068249,11.832873 9.2742983,5.9270407 18.437379,3.0977088 29.751911,-0.87185184 45.495663,1.4008022 53.603953,7.1104009 c 9.275765,6.1889221 7.158128,16.2079421 -3.171076,21.5939521 -1.784316,1.635815 -6.380222,1.21421 -7.068351,3.186186 -1.04003,0.972427 -1.288046,2.050158 -1.232864,3.168203 1.015111,2.000108 -3.831548,1.633216 -3.270553,3.759574 0.589477,5.264544 -0.179276,10.53738 -0.362842,15.806257 -0.492006,2.184998 1.163456,4.574232 -0.734888,6.610642 -2.482919,2.325184 -7.30604,2.189143 -9.193497,-0.274767 -2.733688,-1.740626 -8.254447,-3.615254 -6.104247,-6.339626 3.468112,-1.708686 -2.116197,-3.449897 0.431242,-5.080274 5.058402,-1.39256 -2.393215,-2.304318 -0.146889,-4.334645 3.069198,-0.977415 2.056986,-2.518352 -0.219121,-3.540397 1.876567,-1.807151 1.484149,-4.868919 -2.565455,-5.942205 0.150866,-1.805474 2.905737,-4.136876 -1.679967,-5.20493 C 10.260902,27.882167 4.6872697,22.95045 4.5245945,17.652051 z"
|
||||
id="path604"
|
||||
style="fill:#ffff00;fill-opacity:1;stroke:#000000;stroke-width:1.72665179;stroke-opacity:1" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1 @@
|
||||
module.exports={C:{"57":0.01855,"72":0.00133,"115":0.2968,"127":0.00133,"128":0.00133,"132":0.00133,"133":0.00133,"134":0.00795,"135":0.03843,"136":0.13515,"137":0.00133,_:"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 52 53 54 55 56 58 59 60 61 62 63 64 65 66 67 68 69 70 71 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 120 121 122 123 124 125 126 129 130 131 138 139 140 3.5 3.6"},D:{"11":0.00398,"44":0.00133,"49":0.00133,"50":0.00133,"55":0.00265,"59":0.00133,"64":0.00133,"68":0.00398,"69":0.00133,"70":0.00133,"74":0.00133,"79":0.01325,"81":0.0053,"83":0.00265,"86":0.00133,"87":0.01325,"88":0.00795,"93":0.00265,"94":0.00133,"95":0.00663,"98":0.00133,"103":0.00398,"105":0.00398,"106":0.00928,"108":0.00133,"109":0.07155,"110":0.00133,"111":0.00398,"114":0.00795,"116":0.00265,"117":0.00133,"118":0.00928,"119":0.00663,"120":0.00928,"121":0.00795,"122":0.00265,"123":0.00398,"124":0.00265,"125":0.00133,"126":0.0053,"127":0.00398,"128":0.00795,"129":0.00663,"130":0.00928,"131":0.02518,"132":0.02253,"133":0.45845,"134":0.6625,"135":0.00398,"136":0.00133,_:"4 5 6 7 8 9 10 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 45 46 47 48 51 52 53 54 56 57 58 60 61 62 63 65 66 67 71 72 73 75 76 77 78 80 84 85 89 90 91 92 96 97 99 100 101 102 104 107 112 113 115 137 138"},F:{"34":0.00133,"37":0.00265,"46":0.00133,"62":0.00398,"64":0.00265,"79":0.00265,"86":0.0053,"87":0.01855,"88":0.00133,"95":0.0106,"112":0.00133,"113":0.00133,"114":0.00795,"115":0.00265,"116":0.00795,"117":0.19478,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 35 36 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 63 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 85 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"12":0.00265,"14":0.00133,"17":0.00265,"18":0.00663,"84":0.00133,"89":0.00133,"90":0.00265,"92":0.00928,"100":0.00265,"109":0.00265,"122":0.00133,"125":0.00133,"128":0.00133,"129":0.00133,"130":0.01193,"131":0.01458,"132":0.00795,"133":0.16298,"134":0.31668,_:"13 15 16 79 80 81 83 85 86 87 88 91 93 94 95 96 97 98 99 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 118 119 120 121 123 124 126 127"},E:{"14":0.00133,_:"0 4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 15.1 15.2-15.3 15.4 15.5 16.0 16.1 16.2 16.3 16.4 16.5 17.0 17.3","13.1":0.00265,"14.1":0.00398,"15.6":0.00928,"16.6":0.0053,"17.1":0.00133,"17.2":0.00133,"17.4":0.00133,"17.5":0.00265,"17.6":0.00795,"18.0":0.00133,"18.1":0.00133,"18.2":0.00265,"18.3":0.0265,"18.4":0.00265},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00172,"5.0-5.1":0,"6.0-6.1":0.00516,"7.0-7.1":0.00344,"8.1-8.4":0,"9.0-9.2":0.00258,"9.3":0.01204,"10.0-10.2":0.00086,"10.3":0.01977,"11.0-11.2":0.09113,"11.3-11.4":0.00602,"12.0-12.1":0.00344,"12.2-12.5":0.08511,"13.0-13.1":0.00172,"13.2":0.00258,"13.3":0.00344,"13.4-13.7":0.01204,"14.0-14.4":0.03009,"14.5-14.8":0.03611,"15.0-15.1":0.01977,"15.2-15.3":0.01977,"15.4":0.02407,"15.5":0.02751,"15.6-15.8":0.33872,"16.0":0.04814,"16.1":0.09886,"16.2":0.05158,"16.3":0.08941,"16.4":0.01977,"16.5":0.03697,"16.6-16.7":0.40148,"17.0":0.02407,"17.1":0.04298,"17.2":0.03267,"17.3":0.04556,"17.4":0.09113,"17.5":0.20289,"17.6-17.7":0.58889,"18.0":0.16506,"18.1":0.53989,"18.2":0.24157,"18.3":5.04897,"18.4":0.07479},P:{"4":0.01081,"20":0.01081,"21":0.01081,"22":0.04322,"23":0.01081,"24":0.02161,"25":0.04322,"26":0.09725,"27":0.23773,_:"5.0-5.4 6.2-6.4 8.2 10.1 12.0 13.0 14.0 15.0 17.0","7.2-7.4":0.01081,"9.2":0.04322,"11.1-11.2":0.03242,"16.0":0.02161,"18.0":0.01081,"19.0":0.01081},I:{"0":0.02597,"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.00003},K:{"0":6.20675,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.00133,_:"6 7 8 9 10 5.5"},S:{"2.5":0.00868,_:"3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.02603},Q:{"14.9":0.00868},O:{"0":0.06073},H:{"0":0.82},L:{"0":80.44768}};
|
||||
Reference in New Issue
Block a user