@human-synthesis/norns 0.0.1

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.
package/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Human Synthesis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ This package is part of the Norns framework, which builds on SvelteKit
26
+ (https://github.com/sveltejs/kit) and Svelte (https://github.com/sveltejs/svelte),
27
+ Copyright (c) Svelte Contributors, MIT licensed.
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # @human-synthesis/norns
2
+
3
+ SvelteKit with CoffeeScript, Pug, and UnoCSS preconfigured.
4
+
5
+ Builds on top of [`@human-synthesis/norns-core`](https://github.com/human-synthesis/norns-core) and adds first-class support for `.coffee` SvelteKit special files (`+page.coffee`, `+page.server.coffee`, `hooks.server.coffee`, `+server.coffee`, etc.).
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ pnpm add -D @human-synthesis/norns @sveltejs/kit svelte unocss vite
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ `svelte.config.js`:
16
+
17
+ ```js
18
+ import { nornsConfig } from '@human-synthesis/norns/config';
19
+
20
+ export default nornsConfig({
21
+ // your overrides here, e.g.:
22
+ // kit: { adapter: adapterNode() }
23
+ });
24
+ ```
25
+
26
+ `vite.config.js`:
27
+
28
+ ```js
29
+ import { defineConfig } from 'vite';
30
+ import { sveltekit } from '@sveltejs/kit/vite';
31
+ import { nornsCoffeePlugin, nornsUno } from '@human-synthesis/norns';
32
+
33
+ export default defineConfig({
34
+ plugins: [nornsCoffeePlugin(), nornsUno(), sveltekit()]
35
+ });
36
+ ```
37
+
38
+ ## What this gives you
39
+
40
+ - **`.svelte` files** with `<script lang="coffee">`, `<template lang="pug">`, and UnoCSS class attributes
41
+ - **`.coffee` Kit modules** — write `+page.coffee`, `+page.server.coffee`, `+layout.coffee`, `+server.coffee`, `hooks.server.coffee` instead of `.js`/`.ts`
42
+ - **UnoCSS** preset stack (Uno, Attributify, Icons, Typography) wired into Vite
43
+
44
+ ## Example route
45
+
46
+ `src/routes/+page.svelte`:
47
+
48
+ ```svelte
49
+ <template lang="pug">
50
+ h1.text-3xl.font-bold Hello {data.name}
51
+ button(on:click="{() => count++}") count is {count}
52
+ </template>
53
+
54
+ <script lang="coffee">
55
+ export let data
56
+ count = 0
57
+ </script>
58
+ ```
59
+
60
+ `src/routes/+page.server.coffee`:
61
+
62
+ ```coffee
63
+ export load = ->
64
+ name: 'Norns'
65
+ ```
66
+
67
+ ## License & attribution
68
+
69
+ MIT © Human Synthesis. Built on top of [SvelteKit](https://github.com/sveltejs/kit) and [Svelte](https://github.com/sveltejs/svelte) © Svelte Contributors, MIT licensed.
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@human-synthesis/norns",
3
+ "version": "0.0.1",
4
+ "description": "Norns — SvelteKit with CoffeeScript, Pug, and UnoCSS preconfigured",
5
+ "license": "MIT",
6
+ "author": "Human Synthesis",
7
+ "type": "module",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/human-synthesis/norns.git"
11
+ },
12
+ "files": [
13
+ "src",
14
+ "README.md"
15
+ ],
16
+ "exports": {
17
+ ".": "./src/index.js",
18
+ "./config": "./src/config.js",
19
+ "./vite": "./src/vite.js",
20
+ "./preprocess": "./src/preprocess.js",
21
+ "./uno": "./src/uno.js",
22
+ "./package.json": "./package.json"
23
+ },
24
+ "peerDependencies": {
25
+ "@sveltejs/kit": "^2.0.0",
26
+ "svelte": "^5.0.0",
27
+ "unocss": "^0.65.0",
28
+ "vite": "^5.0.0 || ^6.0.0"
29
+ },
30
+ "dependencies": {
31
+ "@human-synthesis/norns-core": "^0.0.1",
32
+ "coffeescript": "^2.7.0"
33
+ },
34
+ "engines": {
35
+ "node": ">=18"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ }
40
+ }
package/src/config.js ADDED
@@ -0,0 +1,23 @@
1
+ import { nornsPreprocess } from '@human-synthesis/norns-core/preprocess';
2
+
3
+ /**
4
+ * Build a SvelteKit config preconfigured for Norns: Coffee/Pug preprocessing
5
+ * and `.coffee` recognized as a SvelteKit module extension (so files like
6
+ * `+page.coffee` and `hooks.server.coffee` work).
7
+ *
8
+ * Spread your own overrides at the call site to extend or replace defaults.
9
+ *
10
+ * @param {import('@sveltejs/kit').Config} [overrides]
11
+ * @returns {import('@sveltejs/kit').Config}
12
+ */
13
+ export function nornsConfig(overrides = {}) {
14
+ const { kit: kitOverrides = {}, preprocess: preprocessOverride, ...rest } = overrides;
15
+ return {
16
+ preprocess: preprocessOverride ?? nornsPreprocess(),
17
+ kit: {
18
+ moduleExtensions: ['.js', '.ts', '.coffee'],
19
+ ...kitOverrides
20
+ },
21
+ ...rest
22
+ };
23
+ }
package/src/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { nornsConfig } from './config.js';
2
+ export { nornsCoffeePlugin } from './vite.js';
3
+ export { nornsPreprocess } from './preprocess.js';
4
+ export { nornsUno } from './uno.js';
@@ -0,0 +1 @@
1
+ export { nornsPreprocess } from '@human-synthesis/norns-core/preprocess';
package/src/uno.js ADDED
@@ -0,0 +1 @@
1
+ export { nornsUno } from '@human-synthesis/norns-core/uno';
package/src/vite.js ADDED
@@ -0,0 +1,29 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import CoffeeScript from 'coffeescript';
3
+
4
+ /**
5
+ * Vite plugin that compiles .coffee files to JavaScript.
6
+ * Used so SvelteKit special files like +page.coffee, +page.server.coffee,
7
+ * hooks.server.coffee, and +server.coffee work the same as their .js / .ts
8
+ * counterparts.
9
+ *
10
+ * @returns {import('vite').Plugin}
11
+ */
12
+ export function nornsCoffeePlugin() {
13
+ return {
14
+ name: 'norns:coffee',
15
+ enforce: 'pre',
16
+ async load(id) {
17
+ const [path] = id.split('?');
18
+ if (!path.endsWith('.coffee')) return null;
19
+ const source = await readFile(path, 'utf8');
20
+ const { js, sourceMap } = CoffeeScript.compile(source, {
21
+ bare: true,
22
+ sourceMap: true,
23
+ inlineMap: false,
24
+ filename: path
25
+ });
26
+ return { code: js, map: sourceMap?.generate?.() ?? null };
27
+ }
28
+ };
29
+ }