dorian 2.3.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +15 -0
  3. data/.github/workflows/ci.yml +38 -0
  4. data/.gitignore +30 -0
  5. data/.node-version +1 -0
  6. data/.prettierignore +2 -0
  7. data/.rubocop.yml +129 -0
  8. data/.ruby-version +1 -0
  9. data/.tool-versions +3 -0
  10. data/Gemfile +20 -0
  11. data/Gemfile.lock +186 -0
  12. data/LICENSE +19 -0
  13. data/README.md +24 -0
  14. data/VERSION +1 -1
  15. data/bin/bundle +123 -0
  16. data/bin/bundle-audit +31 -0
  17. data/bin/bundler-audit +31 -0
  18. data/bin/rspec +31 -0
  19. data/bin/rubocop +31 -0
  20. data/dorian.gemspec +35 -0
  21. data/lib/dorian/bin.rb +921 -14
  22. data/package-lock.json +39 -0
  23. data/package.json +11 -0
  24. data/samples/books.json +33 -0
  25. data/samples/books.jsonl +3 -0
  26. data/samples/config.yml +27 -0
  27. data/samples/config_2.yml +22 -0
  28. data/samples/maths.js +1 -0
  29. data/samples/numbers.raw +10 -0
  30. data/samples/people.csv +6 -0
  31. data/samples/people.yml +28 -0
  32. data/samples/query.sql +7 -0
  33. data/samples/user.json +31 -0
  34. data/spec/dorian_spec.rb +276 -0
  35. data/spec/spec_helper.rb +3 -0
  36. data/vendor/groovy-beautify/LICENSE.MD +21 -0
  37. data/vendor/groovy-beautify/README.md +65 -0
  38. data/vendor/groovy-beautify/dist/__tests__/index.test.d.ts +1 -0
  39. data/vendor/groovy-beautify/dist/cjs/index.js +573 -0
  40. data/vendor/groovy-beautify/dist/cjs/package.json +3 -0
  41. data/vendor/groovy-beautify/dist/es/index.js +682 -0
  42. data/vendor/groovy-beautify/dist/es/package.json +3 -0
  43. data/vendor/groovy-beautify/dist/formatter/FormatRule.d.ts +14 -0
  44. data/vendor/groovy-beautify/dist/formatter/Formatter.d.ts +11 -0
  45. data/vendor/groovy-beautify/dist/formatter/GroovyFormatRules.d.ts +3 -0
  46. data/vendor/groovy-beautify/dist/formatter/__tests__/formatter.test.d.ts +1 -0
  47. data/vendor/groovy-beautify/dist/index.d.ts +5 -0
  48. data/vendor/groovy-beautify/dist/parser/GroovyParseRules.d.ts +3 -0
  49. data/vendor/groovy-beautify/dist/parser/ParseRule.d.ts +23 -0
  50. data/vendor/groovy-beautify/dist/parser/Parser.d.ts +29 -0
  51. data/vendor/groovy-beautify/dist/parser/__tests__/parser.test.d.ts +1 -0
  52. data/vendor/groovy-beautify/dist/parser/types.d.ts +6 -0
  53. data/vendor/groovy-beautify/dist/utils/text.d.ts +4 -0
  54. data/vendor/groovy-beautify/package.json +55 -0
  55. data/vendor/prettier/LICENSE +4379 -0
  56. data/vendor/prettier/README.md +109 -0
  57. data/vendor/prettier/bin/prettier.cjs +71 -0
  58. data/vendor/prettier/doc.d.ts +243 -0
  59. data/vendor/prettier/doc.js +1545 -0
  60. data/vendor/prettier/doc.mjs +1503 -0
  61. data/vendor/prettier/index.cjs +825 -0
  62. data/vendor/prettier/index.d.ts +941 -0
  63. data/vendor/prettier/index.mjs +25899 -0
  64. data/vendor/prettier/internal/cli.mjs +4366 -0
  65. data/vendor/prettier/package.json +198 -0
  66. data/vendor/prettier/plugins/acorn.d.ts +6 -0
  67. data/vendor/prettier/plugins/acorn.js +6618 -0
  68. data/vendor/prettier/plugins/acorn.mjs +6456 -0
  69. data/vendor/prettier/plugins/angular.d.ts +8 -0
  70. data/vendor/prettier/plugins/angular.js +2435 -0
  71. data/vendor/prettier/plugins/angular.mjs +2375 -0
  72. data/vendor/prettier/plugins/babel.d.ts +18 -0
  73. data/vendor/prettier/plugins/babel.js +14271 -0
  74. data/vendor/prettier/plugins/babel.mjs +13986 -0
  75. data/vendor/prettier/plugins/estree.d.ts +1 -0
  76. data/vendor/prettier/plugins/estree.js +9487 -0
  77. data/vendor/prettier/plugins/estree.mjs +9279 -0
  78. data/vendor/prettier/plugins/flow.d.ts +5 -0
  79. data/vendor/prettier/plugins/flow.js +51477 -0
  80. data/vendor/prettier/plugins/flow.mjs +51219 -0
  81. data/vendor/prettier/plugins/glimmer.d.ts +5 -0
  82. data/vendor/prettier/plugins/glimmer.js +8534 -0
  83. data/vendor/prettier/plugins/glimmer.mjs +8421 -0
  84. data/vendor/prettier/plugins/graphql.d.ts +5 -0
  85. data/vendor/prettier/plugins/graphql.js +2421 -0
  86. data/vendor/prettier/plugins/graphql.mjs +2347 -0
  87. data/vendor/prettier/plugins/html.d.ts +8 -0
  88. data/vendor/prettier/plugins/html.js +8182 -0
  89. data/vendor/prettier/plugins/html.mjs +8077 -0
  90. data/vendor/prettier/plugins/markdown.d.ts +7 -0
  91. data/vendor/prettier/plugins/markdown.js +9068 -0
  92. data/vendor/prettier/plugins/markdown.mjs +8977 -0
  93. data/vendor/prettier/plugins/meriyah.d.ts +5 -0
  94. data/vendor/prettier/plugins/meriyah.js +5953 -0
  95. data/vendor/prettier/plugins/meriyah.mjs +5800 -0
  96. data/vendor/prettier/plugins/postcss.d.ts +7 -0
  97. data/vendor/prettier/plugins/postcss.js +9244 -0
  98. data/vendor/prettier/plugins/postcss.mjs +9046 -0
  99. data/vendor/prettier/plugins/typescript.d.ts +5 -0
  100. data/vendor/prettier/plugins/typescript.js +38058 -0
  101. data/vendor/prettier/plugins/typescript.mjs +37732 -0
  102. data/vendor/prettier/plugins/yaml.d.ts +5 -0
  103. data/vendor/prettier/plugins/yaml.js +7425 -0
  104. data/vendor/prettier/plugins/yaml.mjs +7329 -0
  105. data/vendor/prettier/standalone.d.ts +33 -0
  106. data/vendor/prettier/standalone.js +3984 -0
  107. data/vendor/prettier/standalone.mjs +3938 -0
  108. data/vendor/sql-formatter.js +18762 -0
  109. metadata +207 -4
@@ -0,0 +1,5 @@
1
+ import { FormatterOptions } from "./formatter/Formatter";
2
+ export default function (
3
+ groovyCode: string,
4
+ options?: FormatterOptions,
5
+ ): string;
@@ -0,0 +1,3 @@
1
+ import ParseRule from "./ParseRule";
2
+ declare const _default: ParseRule[];
3
+ export default _default;
@@ -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,6 @@
1
+ export declare type CodeBlock = {
2
+ type: string;
3
+ start: string;
4
+ end?: string;
5
+ children?: Array<CodeBlock>;
6
+ };
@@ -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
+ }