feat: docker compose maybe

This commit is contained in:
2023-11-13 16:10:04 -05:00
parent 180b261e40
commit b625ccd8d6
8031 changed files with 2182966 additions and 0 deletions

View File

@ -0,0 +1,5 @@
import type { AST } from 'svelte-eslint-parser';
import type { RuleContext } from '../../../types';
import type { TransformResult } from './types';
export declare function transform(node: AST.SvelteScriptElement, text: string, context: RuleContext): TransformResult | null;
export declare function hasBabel(context: RuleContext): boolean;

View File

@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hasBabel = exports.transform = void 0;
const load_module_1 = require("../../../utils/load-module");
const compat_1 = require("../../../utils/compat");
function transform(node, text, context) {
const babel = loadBabel(context);
if (!babel) {
return null;
}
let inputRange;
if (node.endTag) {
inputRange = [node.startTag.range[1], node.endTag.range[0]];
}
else {
inputRange = [node.startTag.range[1], node.range[1]];
}
const code = text.slice(...inputRange);
try {
const output = babel.transformSync(code, {
sourceType: 'module',
sourceMaps: true,
minified: false,
ast: false,
code: true,
cwd: (0, compat_1.getCwd)(context)
});
if (!output) {
return null;
}
return {
inputRange,
output: output.code,
mappings: output.map.mappings
};
}
catch (_e) {
return null;
}
}
exports.transform = transform;
function hasBabel(context) {
return Boolean(loadBabel(context));
}
exports.hasBabel = hasBabel;
function loadBabel(context) {
return (0, load_module_1.loadModule)(context, '@babel/core');
}

View File

@ -0,0 +1,4 @@
import type { AST } from 'svelte-eslint-parser';
import type { RuleContext } from '../../../types';
import type { TransformResult } from './types';
export declare function transform(node: AST.SvelteStyleElement, text: string, context: RuleContext): TransformResult | null;

View File

@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.transform = void 0;
const load_module_1 = require("../../../utils/load-module");
const compat_1 = require("../../../utils/compat");
function transform(node, text, context) {
const less = loadLess(context);
if (!less) {
return null;
}
let inputRange;
if (node.endTag) {
inputRange = [node.startTag.range[1], node.endTag.range[0]];
}
else {
inputRange = [node.startTag.range[1], node.range[1]];
}
const code = text.slice(...inputRange);
const filename = `${(0, compat_1.getFilename)(context)}.less`;
try {
let output;
less.render(code, {
sourceMap: {},
syncImport: true,
filename,
lint: false
}, (_error, result) => {
output = result;
});
if (!output) {
return null;
}
return {
inputRange,
output: output.css,
mappings: JSON.parse(output.map).mappings
};
}
catch (_e) {
return null;
}
}
exports.transform = transform;
function loadLess(context) {
return (0, load_module_1.loadModule)(context, 'less');
}

View File

@ -0,0 +1,4 @@
import type { AST } from 'svelte-eslint-parser';
import type { RuleContext } from '../../../types';
import type { TransformResult } from './types';
export declare function transform(node: AST.SvelteStyleElement, text: string, context: RuleContext): TransformResult | null;

View File

@ -0,0 +1,46 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.transform = void 0;
const postcss_1 = __importDefault(require("postcss"));
const postcss_load_config_1 = __importDefault(require("postcss-load-config"));
const compat_1 = require("../../../utils/compat");
function transform(node, text, context) {
const postcssConfig = context.settings?.svelte?.compileOptions?.postcss;
if (postcssConfig === false) {
return null;
}
let inputRange;
if (node.endTag) {
inputRange = [node.startTag.range[1], node.endTag.range[0]];
}
else {
inputRange = [node.startTag.range[1], node.range[1]];
}
const code = text.slice(...inputRange);
const filename = `${(0, compat_1.getFilename)(context)}.css`;
try {
const configFilePath = postcssConfig?.configFilePath;
const config = postcss_load_config_1.default.sync({
cwd: (0, compat_1.getCwd)(context),
from: filename
}, typeof configFilePath === 'string' ? configFilePath : undefined);
const result = (0, postcss_1.default)(config.plugins).process(code, {
...config.options,
map: {
inline: false
}
});
return {
inputRange,
output: result.content,
mappings: result.map.toJSON().mappings
};
}
catch (_e) {
return null;
}
}
exports.transform = transform;

View File

@ -0,0 +1,4 @@
import type { AST } from 'svelte-eslint-parser';
import type { RuleContext } from '../../../types';
import type { TransformResult } from './types';
export declare function transform(node: AST.SvelteStyleElement, text: string, context: RuleContext, type: 'scss' | 'sass'): TransformResult | null;

View File

@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.transform = void 0;
const load_module_1 = require("../../../utils/load-module");
function transform(node, text, context, type) {
const sass = loadSass(context);
if (!sass) {
return null;
}
let inputRange;
if (node.endTag) {
inputRange = [node.startTag.range[1], node.endTag.range[0]];
}
else {
inputRange = [node.startTag.range[1], node.range[1]];
}
const code = text.slice(...inputRange);
try {
const output = sass.compileString(code, {
sourceMap: true,
syntax: type === 'sass' ? 'indented' : undefined
});
if (!output) {
return null;
}
return {
inputRange,
output: output.css,
mappings: output.sourceMap.mappings
};
}
catch (_e) {
return null;
}
}
exports.transform = transform;
function loadSass(context) {
return (0, load_module_1.loadModule)(context, 'sass');
}

View File

@ -0,0 +1,4 @@
import type { AST } from 'svelte-eslint-parser';
import type { RuleContext } from '../../../types';
import type { TransformResult } from './types';
export declare function transform(node: AST.SvelteStyleElement, text: string, context: RuleContext): TransformResult | null;

View File

@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.transform = void 0;
const load_module_1 = require("../../../utils/load-module");
const compat_1 = require("../../../utils/compat");
function transform(node, text, context) {
const stylus = loadStylus(context);
if (!stylus) {
return null;
}
let inputRange;
if (node.endTag) {
inputRange = [node.startTag.range[1], node.endTag.range[0]];
}
else {
inputRange = [node.startTag.range[1], node.range[1]];
}
const code = text.slice(...inputRange);
const filename = `${(0, compat_1.getFilename)(context)}.stylus`;
try {
let output;
const style = stylus(code, {
filename
}).set('sourcemap', {});
style.render((_error, code) => {
output = code;
});
if (output == null) {
return null;
}
return {
inputRange,
output,
mappings: style.sourcemap.mappings
};
}
catch (_e) {
return null;
}
}
exports.transform = transform;
function loadStylus(context) {
return (0, load_module_1.loadModule)(context, 'stylus');
}

View File

@ -0,0 +1,6 @@
import type { AST } from 'svelte-eslint-parser';
export type TransformResult = {
inputRange: AST.Range;
output: string;
mappings: string;
};

View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -0,0 +1,5 @@
import type { AST } from 'svelte-eslint-parser';
import type { RuleContext } from '../../../types';
import type { TransformResult } from './types';
export declare function transform(node: AST.SvelteScriptElement, text: string, context: RuleContext): TransformResult | null;
export declare function hasTypeScript(context: RuleContext): boolean;

View File

@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hasTypeScript = exports.transform = void 0;
const load_module_1 = require("../../../utils/load-module");
const compat_1 = require("../../../utils/compat");
function transform(node, text, context) {
const ts = loadTs(context);
if (!ts) {
return null;
}
let inputRange;
if (node.endTag) {
inputRange = [node.startTag.range[1], node.endTag.range[0]];
}
else {
inputRange = [node.startTag.range[1], node.range[1]];
}
const code = text.slice(...inputRange);
try {
const output = ts.transpileModule(code, {
reportDiagnostics: false,
compilerOptions: {
target: (0, compat_1.getSourceCode)(context).parserServices.program?.getCompilerOptions()?.target ||
ts.ScriptTarget.ESNext,
module: ts.ModuleKind.ESNext,
importsNotUsedAsValues: ts.ImportsNotUsedAsValues.Preserve,
sourceMap: true
}
});
return {
inputRange,
output: output.outputText,
mappings: JSON.parse(output.sourceMapText).mappings
};
}
catch {
return null;
}
}
exports.transform = transform;
function hasTypeScript(context) {
return Boolean(loadTs(context));
}
exports.hasTypeScript = hasTypeScript;
function loadTs(context) {
return (0, load_module_1.loadModule)(context, 'typescript');
}