This commit is contained in:
2025-12-05 09:15:15 +01:00
commit 8837c20d66
1752 changed files with 1123339 additions and 0 deletions

21
node_modules/prettier-plugin-go-template/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2021 Niklas Portmann
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.

197
node_modules/prettier-plugin-go-template/README.md generated vendored Normal file
View File

@@ -0,0 +1,197 @@
# prettier-plugin-go-template
[![NPM Badge](https://img.shields.io/npm/v/prettier-plugin-go-template)](https://www.npmjs.com/package/prettier-plugin-go-template) [![CodeCov Badge](https://img.shields.io/codecov/c/github/niklaspor/prettier-plugin-go-template)](https://codecov.io/gh/NiklasPor/prettier-plugin-go-template) [![Contributions Badge](https://img.shields.io/github/all-contributors/niklaspor/prettier-plugin-go-template)](#contributors-)
Formatter plugin for go template files. The only peer dependency is [prettier](https://www.npmjs.com/package/prettier). Test you own code on the [**playground**](https://prettier-plugin-go-template-playground.niklaspor.dev/).
```bash
npm install --save-dev prettier prettier-plugin-go-template
```
The following file types are detected automatically:
`.gohtml`, `.gotmpl`, `.go.tmpl`, `.tmpl`, `.tpl`, `.html.tmpl`
<table>
<tr>
<th>Input</th>
<th>Output</th>
</tr>
<tr>
<td>
<!-- prettier-ignore-start -->
```html
{{ if or .Prev .Next -}}
{{ $p := where site.Pages }}
<div class="my-navigation">
{{ with $p.Next . -}}
<a href="{{ .RelPermalink }}">
<div class="row">
<div class="cell py-2">
{{ .Title }}
</div> </div> </a>
{{ end -}}
</div>
{{ end -}}
```
<!-- prettier-ignore-end -->
</td>
<td>
<!-- prettier-ignore-start -->
```html
{{ if or .Prev .Next -}}
{{ $p := where site.Pages }}
<div class="my-navigation">
{{ with $p.Next . -}}
<a href="{{ .RelPermalink }}">
<div class="row">
<div class="cell py-2">{{ .Title }}</div>
</div>
</a>
{{ end -}}
</div>
{{ end -}}
```
<!-- prettier-ignore-end -->
</td>
</tr>
</table>
## GoHugo / `.html`
To use it with GoHugo and basic `.html` files, you'll have to override the used parser inside your `.prettierrc` file:
```js
{
overrides: [
{
files: ["*.html"],
options: {
parser: "go-template",
},
},
],
}
```
## VSCode
Make sure to always have installed **both** dependencies:
- `prettier`
- `prettier-plugin-go-template`
Also make sure that they are installed inside the same scope.
Install both globally (`npm i -g`) or locally otherwise prettier may not pick up the plugin.
> Note: The global setup additional requires setting your VSCode prettier path to your global prettier path. You can read in [this issue](https://github.com/NiklasPor/prettier-plugin-go-template/issues/58#issuecomment-1085060511) how to set it up should be doable in less than a minute if you have npm & VSCode already running.
## Additional Options
```js
// .prettierrc
{
/**
* Enables & disables spacing between go statements.
* E.g. {{ statement }} vs {{statement}}.
* Default: true
*/
"goTemplateBracketSpacing": true
}
```
## Ignoring Code
#### Single Block
```html
<div>
<!-- prettier-ignore -->
{{if }}
{{end }}
</div>
```
#### Multiline
```html
<html>
{{/* prettier-ignore-start */}}
<script>
{{if }}
Whatever.
{{else }}
Psych.
{{end }}
</script>
{{/* prettier-ignore-end */}}
</html>
```
## Changelog
### v0.0.12
- Fix several formatting issues
- Improve unformattable script & style detection
- Huge thanks to @jasikpark for validating & cleaning up the issues 🎉
### v0.0.11
- AST rewrite
- Fix inline actions
- If / Else / Else-If support
- Ignore formatting for blocks with `{{/* prettier-ignore */}}
- Ignore large code sections with `{{/* prettier-ignore-start */}}...{{/* prettier-ignore-end */}}
- Tweak general formatting
- Support for multiline actions
### v0.0.10
- Resolve bug #19: Fix template comments.
### v0.0.9
- Resolve bug of single line if statements.
### v0.0.8
- Go block statements will now be indented accordingly. Except for `else`.
- if, range, block, with, define, end
### v0.0.7
- Fix broken shortcodes. Thanks to @alqu for discovering & fixing the bug.
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://github.com/alqu"><img src="https://avatars1.githubusercontent.com/u/12250845?v=4?s=100" width="100px;" alt=""/><br /><sub><b>alqu</b></sub></a><br /><a href="https://github.com/NiklasPor/prettier-plugin-go-template/issues?q=author%3Aalqu" title="Bug reports">🐛</a> <a href="https://github.com/NiklasPor/prettier-plugin-go-template/commits?author=alqu" title="Tests">⚠️</a> <a href="https://github.com/NiklasPor/prettier-plugin-go-template/commits?author=alqu" title="Code">💻</a></td>
<td align="center"><a href="https://www.gabrielmaldi.com"><img src="https://avatars3.githubusercontent.com/u/3728897?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gabriel Monteagudo</b></sub></a><br /><a href="https://github.com/NiklasPor/prettier-plugin-go-template/issues?q=author%3Agabrielmaldi" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/bgold0"><img src="https://avatars1.githubusercontent.com/u/4645400?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Bryan</b></sub></a><br /><a href="https://github.com/NiklasPor/prettier-plugin-go-template/issues?q=author%3Abgold0" title="Bug reports">🐛</a></td>
<td align="center"><a href="http://richtera.org"><img src="https://avatars2.githubusercontent.com/u/708186?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Andreas Richter</b></sub></a><br /><a href="https://github.com/NiklasPor/prettier-plugin-go-template/issues?q=author%3Arichtera" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://noahbrenner.github.io/"><img src="https://avatars3.githubusercontent.com/u/24858379?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Noah Brenner</b></sub></a><br /><a href="https://github.com/NiklasPor/prettier-plugin-go-template/commits?author=noahbrenner" title="Code">💻</a> <a href="https://github.com/NiklasPor/prettier-plugin-go-template/commits?author=noahbrenner" title="Documentation">📖</a></td>
<td align="center"><a href="https://silverwind.io"><img src="https://avatars1.githubusercontent.com/u/115237?v=4?s=100" width="100px;" alt=""/><br /><sub><b>silverwind</b></sub></a><br /><a href="#ideas-silverwind" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://codeberg.org/cpence"><img src="https://avatars0.githubusercontent.com/u/297075?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Charles Pence</b></sub></a><br /><a href="https://github.com/NiklasPor/prettier-plugin-go-template/issues?q=author%3Acpence" title="Bug reports">🐛</a></td>
</tr>
<tr>
<td align="center"><a href="http://jasik.xyz"><img src="https://avatars.githubusercontent.com/u/10626596?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Caleb Jasik</b></sub></a><br /><a href="https://github.com/NiklasPor/prettier-plugin-go-template/issues?q=author%3Ajasikpark" title="Bug reports">🐛</a> <a href="https://github.com/NiklasPor/prettier-plugin-go-template/commits?author=jasikpark" title="Documentation">📖</a> <a href="#example-jasikpark" title="Examples">💡</a> <a href="#ideas-jasikpark" title="Ideas, Planning, & Feedback">🤔</a> <a href="#maintenance-jasikpark" title="Maintenance">🚧</a> <a href="#question-jasikpark" title="Answering Questions">💬</a></td>
<td align="center"><a href="http://DanGold.me"><img src="https://avatars.githubusercontent.com/u/8890238?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dan Gold</b></sub></a><br /><a href="https://github.com/NiklasPor/prettier-plugin-go-template/issues?q=author%3ALandGod" title="Bug reports">🐛</a></td>
</tr>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

View File

@@ -0,0 +1 @@
export declare function createIdGenerator(): () => string;

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createIdGenerator = void 0;
const ulid_1 = require("ulid");
function createIdGenerator() {
return () => (0, ulid_1.ulid)();
}
exports.createIdGenerator = createIdGenerator;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlLWlkLWdlbmVyYXRvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGUtaWQtZ2VuZXJhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUE0QjtBQUU1QixTQUFnQixpQkFBaUI7SUFDL0IsT0FBTyxHQUFHLEVBQUUsQ0FBQyxJQUFBLFdBQUksR0FBRSxDQUFDO0FBQ3RCLENBQUM7QUFGRCw4Q0FFQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHVsaWQgfSBmcm9tIFwidWxpZFwiO1xuXG5leHBvcnQgZnVuY3Rpb24gY3JlYXRlSWRHZW5lcmF0b3IoKTogKCkgPT4gc3RyaW5nIHtcbiAgcmV0dXJuICgpID0+IHVsaWQoKTtcbn1cbiJdfQ==

View File

@@ -0,0 +1,15 @@
import { Parser, Printer, SupportLanguage } from "prettier";
import { GoNode } from "./parse";
export declare type PrettierPluginGoTemplateParserOptions = {
goTemplateBracketSpacing: boolean;
};
export declare const options: {
[K in keyof PrettierPluginGoTemplateParserOptions]: any;
};
export declare const languages: SupportLanguage[];
export declare const parsers: {
"go-template": Parser<GoNode>;
};
export declare const printers: {
"go-template": Printer<GoNode>;
};

249
node_modules/prettier-plugin-go-template/lib/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,47 @@
import { Parser } from "prettier";
export declare const parseGoTemplate: Parser<GoNode>["parse"];
export declare type GoNode = GoRoot | GoBlock | GoInline | GoMultiBlock | GoUnformattable;
export declare type GoBlockKeyword = "if" | "range" | "block" | "with" | "define" | "else" | "prettier-ignore-start" | "prettier-ignore-end" | "end";
export declare type GoRoot = {
type: "root";
} & Omit<GoBlock, "type" | "keyword" | "parent" | "statement" | "id" | "startDelimiter" | "endDelimiter" | "start" | "end">;
export interface GoBaseNode<Type extends string> {
id: string;
type: Type;
index: number;
length: number;
parent: GoBlock | GoRoot | GoMultiBlock;
}
export interface GoBlock extends GoBaseNode<"block">, WithDelimiter {
keyword: GoBlockKeyword;
children: {
[id: string]: GoNode;
};
start: GoInline;
end: GoInline | null;
content: string;
aliasedContent: string;
contentStart: number;
}
export interface GoMultiBlock extends GoBaseNode<"double-block"> {
blocks: (GoBlock | GoMultiBlock)[];
keyword: GoBlockKeyword;
}
export declare type GoSharedDelimiter = "%" | "-" | "";
export declare type GoInlineStartDelimiter = "<" | "/*" | GoSharedDelimiter;
export declare type GoInlineEndDelimiter = ">" | "*/" | GoSharedDelimiter;
export interface GoUnformattable extends GoBaseNode<"unformattable"> {
content: string;
}
export interface WithDelimiter {
startDelimiter: GoInlineStartDelimiter;
endDelimiter: GoInlineEndDelimiter;
}
export interface GoInline extends GoBaseNode<"inline">, WithDelimiter {
statement: string;
}
export declare function isInline(node: GoNode): node is GoInline;
export declare function isBlock(node: GoNode): node is GoBlock;
export declare function isMultiBlock(node: GoNode): node is GoMultiBlock;
export declare function isRoot(node: GoNode): node is GoRoot;
export declare function isUnformattable(node: GoNode): node is GoRoot;

183
node_modules/prettier-plugin-go-template/lib/parse.js generated vendored Normal file

File diff suppressed because one or more lines are too long

83
node_modules/prettier-plugin-go-template/package.json generated vendored Normal file
View File

@@ -0,0 +1,83 @@
{
"name": "prettier-plugin-go-template",
"version": "0.0.13",
"description": "Prettier plugin for formatting Go & GoHugo templates.",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/NiklasPor/prettier-plugin-go-template"
},
"author": {
"name": "Niklas Portmann",
"email": "niklaspor@gmail.com"
},
"keywords": [
"prettier",
"plugin",
"go",
"hugo",
"gohugo",
"template",
"html"
],
"files": [
"lib"
],
"main": "lib/index",
"types": "lib/index",
"scripts": {
"lint": "tslint --project .",
"test": "jest",
"coverage": "jest --coverage --no-cache",
"publish:coverage": "codecov -t $npm_config_prettier_plugin_go_html_codecov",
"release:coverage": "npm run coverage && npm run publish:coverage",
"build": "tsc --pretty",
"watch": "npm run build -- --watch",
"watch:test": "jest --watch",
"release:plugin": "npm run build && npm run release:coverage && npm publish",
"release:plugin:beta": "npm run build && npm run release:coverage && npm publish --tag beta",
"website:build": "rollup -c",
"website:serve": "rollup -c -w",
"website:start": "sirv website/public --no-clear",
"check": "svelte-check --tsconfig ./tsconfig.json"
},
"peerDependencies": {
"prettier": "^2.0.0"
},
"devDependencies": {
"@types/jest": "^26.0.15",
"@types/node": "^14.14.2",
"@types/prettier": "^2.2.3",
"codecov": "^3.8.0",
"jest": "^26.6.1",
"prettier": "^2.3.0",
"ts-jest": "^26.4.2",
"ts-node": "^9.0.0",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typescript": "^4.0.0",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"rollup": "^2.3.4",
"rollup-plugin-css-only": "^3.1.0",
"rollup-plugin-livereload": "^2.0.0",
"rollup-plugin-svelte": "^7.0.0",
"rollup-plugin-terser": "^7.0.0",
"svelte": "^3.0.0",
"sirv-cli": "^2.0.0",
"svelte-check": "^2.0.0",
"svelte-preprocess": "^4.0.0",
"@rollup/plugin-typescript": "^8.0.0",
"tslib": "^2.0.0",
"@tsconfig/svelte": "^2.0.0"
},
"engines": {
"node": ">=14.0.0"
},
"jest": {
"preset": "ts-jest"
},
"dependencies": {
"ulid": "^2.3.0"
}
}