@reddoorla/maintenance 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Minimal shape we touch — the full type lives in @sveltejs/kit's `Config`.
3
+ * We don't import it directly to avoid a peer dependency for what amounts
4
+ * to a small config helper. Sites get full type-checking from their own
5
+ * `@sveltejs/kit` install when they invoke createSvelteConfig.
6
+ */
7
+ type WarningFilter = (warning: {
8
+ code?: string;
9
+ message?: string;
10
+ }) => boolean;
11
+ type SvelteConfigLike = {
12
+ kit?: unknown;
13
+ preprocess?: unknown;
14
+ compilerOptions?: {
15
+ warningFilter?: WarningFilter;
16
+ [k: string]: unknown;
17
+ };
18
+ [k: string]: unknown;
19
+ };
20
+ /**
21
+ * Compose a Svelte/Kit config with reddoor's canonical compilerOptions
22
+ * layered in. Sites pass their site-specific bits (`kit.adapter`,
23
+ * `preprocess`, etc.) and get back a complete config with the canonical
24
+ * warning filter applied.
25
+ *
26
+ * If the site supplies its own `compilerOptions.warningFilter`, the filters
27
+ * compose: a warning is shown only when both filters allow it.
28
+ *
29
+ * @example
30
+ * import { createSvelteConfig } from "@reddoorla/maintenance/configs/svelte";
31
+ * import adapter from "@sveltejs/adapter-auto";
32
+ *
33
+ * export default createSvelteConfig({ kit: { adapter: adapter() } });
34
+ */
35
+ declare function createSvelteConfig(siteConfig?: SvelteConfigLike): SvelteConfigLike & {
36
+ compilerOptions: NonNullable<SvelteConfigLike["compilerOptions"]>;
37
+ };
38
+
39
+ export { type SvelteConfigLike, createSvelteConfig, createSvelteConfig as default };
@@ -0,0 +1,30 @@
1
+ // src/configs/svelte.ts
2
+ var SILENCED_WARNING_CODES = /* @__PURE__ */ new Set([
3
+ // `<div ... />` shorthand is widely used across reddoor codebases; the
4
+ // Svelte 5 strictness change for non-void self-closing tags would flood
5
+ // dev logs with no actionable signal.
6
+ "element_invalid_self_closing_tag"
7
+ ]);
8
+ function isSilenced(warning) {
9
+ return warning.code !== void 0 && SILENCED_WARNING_CODES.has(warning.code);
10
+ }
11
+ function createSvelteConfig(siteConfig = {}) {
12
+ const siteCompiler = siteConfig.compilerOptions ?? {};
13
+ const siteFilter = siteCompiler.warningFilter;
14
+ return {
15
+ ...siteConfig,
16
+ compilerOptions: {
17
+ ...siteCompiler,
18
+ warningFilter: (warning) => {
19
+ if (isSilenced(warning)) return false;
20
+ return siteFilter ? siteFilter(warning) : true;
21
+ }
22
+ }
23
+ };
24
+ }
25
+ var svelte_default = createSvelteConfig;
26
+ export {
27
+ createSvelteConfig,
28
+ svelte_default as default
29
+ };
30
+ //# sourceMappingURL=svelte.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/configs/svelte.ts"],"sourcesContent":["/**\n * Minimal shape we touch — the full type lives in @sveltejs/kit's `Config`.\n * We don't import it directly to avoid a peer dependency for what amounts\n * to a small config helper. Sites get full type-checking from their own\n * `@sveltejs/kit` install when they invoke createSvelteConfig.\n */\ntype WarningFilter = (warning: { code?: string; message?: string }) => boolean;\n\nexport type SvelteConfigLike = {\n kit?: unknown;\n preprocess?: unknown;\n compilerOptions?: {\n warningFilter?: WarningFilter;\n [k: string]: unknown;\n };\n [k: string]: unknown;\n};\n\n/** Compiler-level warnings the canonical reddoor stack treats as noise. */\nconst SILENCED_WARNING_CODES = new Set<string>([\n // `<div ... />` shorthand is widely used across reddoor codebases; the\n // Svelte 5 strictness change for non-void self-closing tags would flood\n // dev logs with no actionable signal.\n \"element_invalid_self_closing_tag\",\n]);\n\nfunction isSilenced(warning: { code?: string }): boolean {\n return warning.code !== undefined && SILENCED_WARNING_CODES.has(warning.code);\n}\n\n/**\n * Compose a Svelte/Kit config with reddoor's canonical compilerOptions\n * layered in. Sites pass their site-specific bits (`kit.adapter`,\n * `preprocess`, etc.) and get back a complete config with the canonical\n * warning filter applied.\n *\n * If the site supplies its own `compilerOptions.warningFilter`, the filters\n * compose: a warning is shown only when both filters allow it.\n *\n * @example\n * import { createSvelteConfig } from \"@reddoorla/maintenance/configs/svelte\";\n * import adapter from \"@sveltejs/adapter-auto\";\n *\n * export default createSvelteConfig({ kit: { adapter: adapter() } });\n */\nexport function createSvelteConfig(siteConfig: SvelteConfigLike = {}): SvelteConfigLike & {\n compilerOptions: NonNullable<SvelteConfigLike[\"compilerOptions\"]>;\n} {\n const siteCompiler = siteConfig.compilerOptions ?? {};\n const siteFilter = siteCompiler.warningFilter;\n\n return {\n ...siteConfig,\n compilerOptions: {\n ...siteCompiler,\n warningFilter: (warning) => {\n if (isSilenced(warning)) return false;\n return siteFilter ? siteFilter(warning) : true;\n },\n },\n };\n}\n\nexport default createSvelteConfig;\n"],"mappings":";AAmBA,IAAM,yBAAyB,oBAAI,IAAY;AAAA;AAAA;AAAA;AAAA,EAI7C;AACF,CAAC;AAED,SAAS,WAAW,SAAqC;AACvD,SAAO,QAAQ,SAAS,UAAa,uBAAuB,IAAI,QAAQ,IAAI;AAC9E;AAiBO,SAAS,mBAAmB,aAA+B,CAAC,GAEjE;AACA,QAAM,eAAe,WAAW,mBAAmB,CAAC;AACpD,QAAM,aAAa,aAAa;AAEhC,SAAO;AAAA,IACL,GAAG;AAAA,IACH,iBAAiB;AAAA,MACf,GAAG;AAAA,MACH,eAAe,CAAC,YAAY;AAC1B,YAAI,WAAW,OAAO,EAAG,QAAO;AAChC,eAAO,aAAa,WAAW,OAAO,IAAI;AAAA,MAC5C;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,iBAAQ;","names":[]}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as Site, a as AuditResult, A as AuditName, b as RecipeResult, R as RecipeName, I as InventoryProvider } from './sync-configs-D_Dm-68_.js';
2
- export { C as ConfigName, c as SyncConfigsOptions, s as syncConfigs } from './sync-configs-D_Dm-68_.js';
1
+ import { S as Site, a as AuditResult, A as AuditName, b as RecipeResult, R as RecipeName, I as InventoryProvider } from './sync-configs-C56tK7Go.js';
2
+ export { C as ConfigName, c as SyncConfigsOptions, s as syncConfigs } from './sync-configs-C56tK7Go.js';
3
3
 
4
4
  type SpawnResult = {
5
5
  code: number;
package/dist/index.js CHANGED
@@ -702,7 +702,25 @@ var playwrightA11y = {
702
702
  contents: `export { default } from "@reddoorla/maintenance/configs/playwright-a11y";
703
703
  `
704
704
  };
705
- var ALL_TEMPLATES = [eslint, prettier, lighthouse, playwrightA11y];
705
+ var svelte = {
706
+ config: "svelte",
707
+ path: "svelte.config.js",
708
+ contents: `import { createSvelteConfig } from "@reddoorla/maintenance/configs/svelte";
709
+ import adapter from "@sveltejs/adapter-auto";
710
+
711
+ /** @type {import('@sveltejs/kit').Config} */
712
+ export default createSvelteConfig({
713
+ kit: { adapter: adapter() },
714
+ });
715
+ `
716
+ };
717
+ var ALL_TEMPLATES = [
718
+ eslint,
719
+ prettier,
720
+ lighthouse,
721
+ playwrightA11y,
722
+ svelte
723
+ ];
706
724
  function templatesByName(which) {
707
725
  return ALL_TEMPLATES.filter((t) => which.includes(t.config));
708
726
  }