Complete residential site build with Docker Compose & Gitea Actions deployment
This commit is contained in:
+59
@@ -0,0 +1,59 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Fred K. Schott
|
||||
|
||||
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.
|
||||
|
||||
"""
|
||||
This license applies to parts of the `packages/create-astro` and `packages/astro` subdirectories originating from the https://github.com/sveltejs/kit repository:
|
||||
|
||||
Copyright (c) 2020 [these people](https://github.com/sveltejs/kit/graphs/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.
|
||||
"""
|
||||
|
||||
"""
|
||||
This license applies to parts of the `packages/create-astro` and `packages/astro` subdirectories originating from the https://github.com/vitejs/vite repository:
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019-present, Yuxi (Evan) You and Vite 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.
|
||||
"""
|
||||
+1
@@ -0,0 +1 @@
|
||||
export { VIRTUAL_CODE_ID, type YAML2TSResult, yaml2ts } from './yaml2ts';
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.yaml2ts = exports.VIRTUAL_CODE_ID = void 0;
|
||||
var yaml2ts_1 = require("./yaml2ts");
|
||||
Object.defineProperty(exports, "VIRTUAL_CODE_ID", { enumerable: true, get: function () { return yaml2ts_1.VIRTUAL_CODE_ID; } });
|
||||
Object.defineProperty(exports, "yaml2ts", { enumerable: true, get: function () { return yaml2ts_1.yaml2ts; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import type { VirtualCode } from '@volar/language-core';
|
||||
import type { YAMLError } from 'yaml';
|
||||
export declare const VIRTUAL_CODE_ID = "frontmatter-ts";
|
||||
export type YAML2TSResult = {
|
||||
errors: YAMLError[];
|
||||
virtualCode: VirtualCode;
|
||||
};
|
||||
export declare function yaml2ts(frontmatter: string, collection: string): YAML2TSResult;
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.VIRTUAL_CODE_ID = void 0;
|
||||
exports.yaml2ts = yaml2ts;
|
||||
const yaml_1 = __importStar(require("yaml"));
|
||||
exports.VIRTUAL_CODE_ID = 'frontmatter-ts';
|
||||
const ONLY_NAV_CODE_INFO = {
|
||||
verification: false,
|
||||
completion: false,
|
||||
semantic: false,
|
||||
navigation: true,
|
||||
structure: false,
|
||||
format: false,
|
||||
};
|
||||
function yaml2ts(frontmatter, collection) {
|
||||
const frontmatterMappings = [];
|
||||
const frontmatterContent = (0, yaml_1.parseDocument)(frontmatter, {
|
||||
keepSourceTokens: true,
|
||||
customTags: ['timestamp'], // Handle YAML timestamps
|
||||
// Those two options prevent `yaml` from throwing errors when it encounters parsing errors, which is useful for handling incomplete content
|
||||
strict: false,
|
||||
logLevel: 'silent',
|
||||
});
|
||||
let fullResult = 'import type { InferEntrySchema } from "astro:content";\n\n(\n';
|
||||
let objectContent = frontmatter.trim().length > 0 ? '' : '{}'; // If there's no content, provide an empty object so that there's no syntax error
|
||||
yaml_1.default.visit(frontmatterContent, {
|
||||
Value(key, value) {
|
||||
if ((0, yaml_1.isCollection)(value)) {
|
||||
if ((0, yaml_1.isMap)(value)) {
|
||||
mapMap(value, key);
|
||||
}
|
||||
if ((0, yaml_1.isSeq)(value)) {
|
||||
mapSeq(value);
|
||||
}
|
||||
}
|
||||
// If we didn't hit any of the above, we have a scalar value which in almost all cases is a Pair that's just not fully written yet
|
||||
if ((0, yaml_1.isScalar)(value)) {
|
||||
const itemKey = mapScalarKey(value);
|
||||
// We don't care about values, just keys, since we're only interested in the structure
|
||||
objectContent += `${itemKey}: null\n`;
|
||||
}
|
||||
return yaml_1.default.visit.REMOVE;
|
||||
},
|
||||
});
|
||||
function mapMap(map, key) {
|
||||
objectContent += '{\n';
|
||||
// Go through all the items in the map
|
||||
map.items.forEach((item) => {
|
||||
// Pairs keys are not always scalars (they can even be totally arbitrary nodes), but in practice, it's really rare for them to be anything other than scalars
|
||||
// Anyway, Zod does not support non-scalar keys, so it's fine to just not handle anything other than scalars
|
||||
if ((0, yaml_1.isScalar)(item.key)) {
|
||||
const itemKey = mapScalarKey(item.key);
|
||||
if ((0, yaml_1.isScalar)(item.value) || item.value === null) {
|
||||
objectContent += `${itemKey}: null,\n`; // Don't care about value, just key
|
||||
}
|
||||
if ((0, yaml_1.isMap)(item.value)) {
|
||||
objectContent += `${itemKey}: `;
|
||||
mapMap(item.value);
|
||||
}
|
||||
if ((0, yaml_1.isSeq)(item.value)) {
|
||||
objectContent += `${itemKey}: `;
|
||||
mapSeq(item.value);
|
||||
}
|
||||
}
|
||||
return yaml_1.default.visit.REMOVE;
|
||||
});
|
||||
objectContent += '}';
|
||||
if (key !== null) {
|
||||
objectContent += ',';
|
||||
}
|
||||
objectContent += '\n';
|
||||
return yaml_1.default.visit.REMOVE;
|
||||
}
|
||||
function mapSeq(seq) {
|
||||
objectContent += '[';
|
||||
seq.items.forEach((item) => {
|
||||
if ((0, yaml_1.isScalar)(item)) {
|
||||
objectContent += `null,`;
|
||||
}
|
||||
if ((0, yaml_1.isMap)(item)) {
|
||||
mapMap(item);
|
||||
}
|
||||
if ((0, yaml_1.isSeq)(item)) {
|
||||
mapSeq(item);
|
||||
}
|
||||
return yaml_1.default.visit.REMOVE;
|
||||
});
|
||||
objectContent += '],\n';
|
||||
return yaml_1.default.visit.REMOVE;
|
||||
}
|
||||
function mapScalarKey(scalar) {
|
||||
// Stringify a YAML scalar key, handling invalid JS identifiers, escaping quotes etc. correctly.
|
||||
const itemKey = JSON.stringify(scalar.toJS(frontmatterContent));
|
||||
// Get the length of the original written key
|
||||
// This condition will always be true because we're only handling scalar keys
|
||||
const sourceTokenLength = yaml_1.CST.isScalar(scalar.srcToken) ? scalar.srcToken.source.length : 0;
|
||||
frontmatterMappings.push({
|
||||
generatedOffsets: [fullResult.length + objectContent.length],
|
||||
sourceOffsets: [scalar.range[0]], // For scalar keys, the range is always defined
|
||||
lengths: [sourceTokenLength],
|
||||
generatedLengths: [itemKey.length],
|
||||
data: ONLY_NAV_CODE_INFO,
|
||||
});
|
||||
return itemKey;
|
||||
}
|
||||
fullResult += `${objectContent}) satisfies InferEntrySchema<"${collection}">;\n\n`;
|
||||
return {
|
||||
errors: frontmatterContent.errors,
|
||||
virtualCode: {
|
||||
id: exports.VIRTUAL_CODE_ID,
|
||||
languageId: 'typescript',
|
||||
snapshot: {
|
||||
getText: (start, end) => fullResult.substring(start, end),
|
||||
getLength: () => fullResult.length,
|
||||
getChangeRange: () => undefined,
|
||||
},
|
||||
mappings: frontmatterMappings,
|
||||
},
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=yaml2ts.js.map
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "@astrojs/yaml2ts",
|
||||
"version": "0.2.3",
|
||||
"description": "Package to convert a YAML string to a Volar VirtualCode, to be used by the Astro language server to provide intellisense",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/withastro/astro.git",
|
||||
"directory": "packages/language-tools/yaml2ts"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"main": "dist/index.js",
|
||||
"files": [
|
||||
"dist/**/*.js",
|
||||
"dist/**/*.d.ts"
|
||||
],
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"yaml": "^2.8.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@volar/language-core": "~2.4.28",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"dev": "tsc --watch"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user