dorian 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +15 -0
- data/.github/workflows/ci.yml +38 -0
- data/.gitignore +30 -0
- data/.node-version +1 -0
- data/.prettierignore +2 -0
- data/.rubocop.yml +129 -0
- data/.ruby-version +1 -0
- data/.tool-versions +3 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +186 -0
- data/LICENSE +19 -0
- data/README.md +24 -0
- data/VERSION +1 -1
- data/bin/bundle +123 -0
- data/bin/bundle-audit +31 -0
- data/bin/bundler-audit +31 -0
- data/bin/rspec +31 -0
- data/bin/rubocop +31 -0
- data/dorian.gemspec +35 -0
- data/lib/dorian/bin.rb +739 -81
- data/package-lock.json +39 -0
- data/package.json +11 -0
- data/samples/books.json +33 -0
- data/samples/books.jsonl +3 -0
- data/samples/config.yml +27 -0
- data/samples/config_2.yml +22 -0
- data/samples/maths.js +1 -0
- data/samples/numbers.raw +10 -0
- data/samples/people.csv +6 -0
- data/samples/people.yml +28 -0
- data/samples/query.sql +7 -0
- data/samples/user.json +31 -0
- data/spec/dorian_spec.rb +276 -0
- data/spec/spec_helper.rb +3 -0
- data/vendor/groovy-beautify/LICENSE.MD +21 -0
- data/vendor/groovy-beautify/README.md +65 -0
- data/vendor/groovy-beautify/dist/__tests__/index.test.d.ts +1 -0
- data/vendor/groovy-beautify/dist/cjs/index.js +573 -0
- data/vendor/groovy-beautify/dist/cjs/package.json +3 -0
- data/vendor/groovy-beautify/dist/es/index.js +682 -0
- data/vendor/groovy-beautify/dist/es/package.json +3 -0
- data/vendor/groovy-beautify/dist/formatter/FormatRule.d.ts +14 -0
- data/vendor/groovy-beautify/dist/formatter/Formatter.d.ts +11 -0
- data/vendor/groovy-beautify/dist/formatter/GroovyFormatRules.d.ts +3 -0
- data/vendor/groovy-beautify/dist/formatter/__tests__/formatter.test.d.ts +1 -0
- data/vendor/groovy-beautify/dist/index.d.ts +5 -0
- data/vendor/groovy-beautify/dist/parser/GroovyParseRules.d.ts +3 -0
- data/vendor/groovy-beautify/dist/parser/ParseRule.d.ts +23 -0
- data/vendor/groovy-beautify/dist/parser/Parser.d.ts +29 -0
- data/vendor/groovy-beautify/dist/parser/__tests__/parser.test.d.ts +1 -0
- data/vendor/groovy-beautify/dist/parser/types.d.ts +6 -0
- data/vendor/groovy-beautify/dist/utils/text.d.ts +4 -0
- data/vendor/groovy-beautify/package.json +55 -0
- data/vendor/prettier/LICENSE +4379 -0
- data/vendor/prettier/README.md +109 -0
- data/vendor/prettier/bin/prettier.cjs +71 -0
- data/vendor/prettier/doc.d.ts +243 -0
- data/vendor/prettier/doc.js +1545 -0
- data/vendor/prettier/doc.mjs +1503 -0
- data/vendor/prettier/index.cjs +825 -0
- data/vendor/prettier/index.d.ts +941 -0
- data/vendor/prettier/index.mjs +25899 -0
- data/vendor/prettier/internal/cli.mjs +4366 -0
- data/vendor/prettier/package.json +198 -0
- data/vendor/prettier/plugins/acorn.d.ts +6 -0
- data/vendor/prettier/plugins/acorn.js +6618 -0
- data/vendor/prettier/plugins/acorn.mjs +6456 -0
- data/vendor/prettier/plugins/angular.d.ts +8 -0
- data/vendor/prettier/plugins/angular.js +2435 -0
- data/vendor/prettier/plugins/angular.mjs +2375 -0
- data/vendor/prettier/plugins/babel.d.ts +18 -0
- data/vendor/prettier/plugins/babel.js +14271 -0
- data/vendor/prettier/plugins/babel.mjs +13986 -0
- data/vendor/prettier/plugins/estree.d.ts +1 -0
- data/vendor/prettier/plugins/estree.js +9487 -0
- data/vendor/prettier/plugins/estree.mjs +9279 -0
- data/vendor/prettier/plugins/flow.d.ts +5 -0
- data/vendor/prettier/plugins/flow.js +51477 -0
- data/vendor/prettier/plugins/flow.mjs +51219 -0
- data/vendor/prettier/plugins/glimmer.d.ts +5 -0
- data/vendor/prettier/plugins/glimmer.js +8534 -0
- data/vendor/prettier/plugins/glimmer.mjs +8421 -0
- data/vendor/prettier/plugins/graphql.d.ts +5 -0
- data/vendor/prettier/plugins/graphql.js +2421 -0
- data/vendor/prettier/plugins/graphql.mjs +2347 -0
- data/vendor/prettier/plugins/html.d.ts +8 -0
- data/vendor/prettier/plugins/html.js +8182 -0
- data/vendor/prettier/plugins/html.mjs +8077 -0
- data/vendor/prettier/plugins/markdown.d.ts +7 -0
- data/vendor/prettier/plugins/markdown.js +9068 -0
- data/vendor/prettier/plugins/markdown.mjs +8977 -0
- data/vendor/prettier/plugins/meriyah.d.ts +5 -0
- data/vendor/prettier/plugins/meriyah.js +5953 -0
- data/vendor/prettier/plugins/meriyah.mjs +5800 -0
- data/vendor/prettier/plugins/postcss.d.ts +7 -0
- data/vendor/prettier/plugins/postcss.js +9244 -0
- data/vendor/prettier/plugins/postcss.mjs +9046 -0
- data/vendor/prettier/plugins/typescript.d.ts +5 -0
- data/vendor/prettier/plugins/typescript.js +38058 -0
- data/vendor/prettier/plugins/typescript.mjs +37732 -0
- data/vendor/prettier/plugins/yaml.d.ts +5 -0
- data/vendor/prettier/plugins/yaml.js +7425 -0
- data/vendor/prettier/plugins/yaml.mjs +7329 -0
- data/vendor/prettier/standalone.d.ts +33 -0
- data/vendor/prettier/standalone.js +3984 -0
- data/vendor/prettier/standalone.mjs +3938 -0
- data/vendor/sql-formatter.js +18762 -0
- metadata +205 -2
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { CodeBlock } from "./types";
|
2
|
+
export declare type MatchExpression =
|
3
|
+
| RegExp
|
4
|
+
| string
|
5
|
+
| ((currentBlock: CodeBlock, currentText: string) => string | undefined);
|
6
|
+
export default class ParseRule {
|
7
|
+
name: string;
|
8
|
+
exclusive: boolean;
|
9
|
+
wholeword: boolean;
|
10
|
+
start: MatchExpression | MatchExpression[];
|
11
|
+
skip?: MatchExpression | MatchExpression[];
|
12
|
+
end?: MatchExpression | MatchExpression[];
|
13
|
+
constructor(
|
14
|
+
name: string,
|
15
|
+
options: {
|
16
|
+
exclusive?: boolean;
|
17
|
+
wholeword?: boolean;
|
18
|
+
start: MatchExpression | MatchExpression[];
|
19
|
+
end?: MatchExpression | MatchExpression[];
|
20
|
+
skip?: MatchExpression | MatchExpression[];
|
21
|
+
},
|
22
|
+
);
|
23
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import ParseRule, { MatchExpression } from "./ParseRule";
|
2
|
+
import { CodeBlock } from "./types";
|
3
|
+
export declare class Parser {
|
4
|
+
text: string;
|
5
|
+
textLength: number;
|
6
|
+
textPosition: number;
|
7
|
+
rules: ParseRule[];
|
8
|
+
/**
|
9
|
+
* @param text - Text to parse
|
10
|
+
* @param rules - Array of parsing rules. If none of specified rules match default rule with type text will be used.
|
11
|
+
*/
|
12
|
+
constructor(text: string, rules?: ParseRule[]);
|
13
|
+
scan(): string | null;
|
14
|
+
isDone(): boolean;
|
15
|
+
move(length: number): void;
|
16
|
+
match(
|
17
|
+
cb: CodeBlock,
|
18
|
+
expression?: MatchExpression | MatchExpression[],
|
19
|
+
wholeword?: boolean,
|
20
|
+
): string | undefined;
|
21
|
+
matchStart(cb: CodeBlock, rule: ParseRule): string | undefined;
|
22
|
+
matchEnd(cb: CodeBlock, rule: ParseRule): string | undefined;
|
23
|
+
matchSkip(cb: CodeBlock, rule: ParseRule): string | undefined;
|
24
|
+
createDefaultTextObject(text: string): {
|
25
|
+
type: string;
|
26
|
+
start: string;
|
27
|
+
};
|
28
|
+
parse(): CodeBlock;
|
29
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,4 @@
|
|
1
|
+
export declare function padLeft(text: string, indent: number): string;
|
2
|
+
export declare function padRight(text: string, indent: number): string;
|
3
|
+
export declare function trimSpacesAndTabsLeft(text: string): string;
|
4
|
+
export declare function trimSpacesAndTabsRight(text: string): string;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
{
|
2
|
+
"name": "groovy-beautify",
|
3
|
+
"version": "0.0.17",
|
4
|
+
"description": "A simple beautifier which allows formatting and indenting Groovy scripts",
|
5
|
+
"main": "./dist/cjs/index.js",
|
6
|
+
"module": "./dist/es/index.js",
|
7
|
+
"types": "./dist/index.d.ts",
|
8
|
+
"exports": {
|
9
|
+
"types": "./dist/index.d.ts",
|
10
|
+
"require": "./dist/cjs/index.js",
|
11
|
+
"import": "./dist/es/index.js",
|
12
|
+
"default": "./dist/es/index.js"
|
13
|
+
},
|
14
|
+
"files": [
|
15
|
+
"dist/**/*.json",
|
16
|
+
"dist/**/*.js",
|
17
|
+
"dist/**/*.ts"
|
18
|
+
],
|
19
|
+
"scripts": {
|
20
|
+
"dev": "vite",
|
21
|
+
"build": "tsc --noEmit && vite build && tsc --emitDeclarationOnly && prettier --write ./dist",
|
22
|
+
"lint": "eslint . --ext .ts",
|
23
|
+
"preview": "vite preview",
|
24
|
+
"test": "jest",
|
25
|
+
"test:update": "jest --updateSnapshot"
|
26
|
+
},
|
27
|
+
"repository": {
|
28
|
+
"type": "git",
|
29
|
+
"url": "git+https://github.com/joycollector/groovy-beautify.git"
|
30
|
+
},
|
31
|
+
"keywords": [
|
32
|
+
"groovy",
|
33
|
+
"beautify",
|
34
|
+
"beautifier"
|
35
|
+
],
|
36
|
+
"author": "Sergei Kasoverskij",
|
37
|
+
"license": "MIT",
|
38
|
+
"bugs": {
|
39
|
+
"url": "https://github.com/joycollector/groovy-beautify/issues"
|
40
|
+
},
|
41
|
+
"homepage": "https://github.com/joycollector/groovy-beautify#readme",
|
42
|
+
"devDependencies": {
|
43
|
+
"@types/jest": "^28.1.3",
|
44
|
+
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
45
|
+
"@typescript-eslint/parser": "^5.29.0",
|
46
|
+
"eslint": "^8.18.0",
|
47
|
+
"eslint-config-prettier": "^8.5.0",
|
48
|
+
"eslint-plugin-prettier": "^4.0.0",
|
49
|
+
"jest": "^28.1.1",
|
50
|
+
"prettier": "^2.7.1",
|
51
|
+
"ts-jest": "^28.0.5",
|
52
|
+
"typescript": "^4.5.4",
|
53
|
+
"vite": "^2.9.9"
|
54
|
+
}
|
55
|
+
}
|