-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
724 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.DS_Store | ||
node_modules | ||
/build | ||
/.svelte-kit | ||
/package | ||
.env | ||
.env.* | ||
!.env.example | ||
/src/app.html | ||
|
||
# Ignore files for PNPM, NPM and YARN | ||
pnpm-lock.yaml | ||
package-lock.json | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* @type {import("eslint").Linter.Config} | ||
*/ | ||
module.exports = { | ||
root: true, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:svelte/recommended', | ||
'prettier', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint'], | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 2024, | ||
extraFileExtensions: ['.svelte'], | ||
}, | ||
env: { | ||
browser: true, | ||
es2017: true, | ||
node: true, | ||
}, | ||
globals: { | ||
Bun: 'readonly', | ||
}, | ||
rules: { | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'func-names': ['error', 'always'], | ||
/** | ||
* Remember to set "eslint.validate": ["javascript", "svelte"] in settings.json. | ||
*/ | ||
// @see https://astexplorer.net/ | ||
'no-restricted-syntax': [ | ||
'error', | ||
{ | ||
selector: 'ArrowFunctionExpression', | ||
message: 'Shorthand arrow functions are not allowed.', | ||
}, | ||
{ | ||
selector: 'ClassDeclaration', | ||
message: 'Classes are not allowed, use object literals instead.', | ||
}, | ||
], | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['*.svelte'], | ||
parser: 'svelte-eslint-parser', | ||
parserOptions: { | ||
parser: '@typescript-eslint/parser', | ||
}, | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | ||
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | ||
|
||
name: Node.js Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
- run: npm i | ||
- run: npm run lint:fix | ||
- run: npm run build | ||
|
||
publish-npm: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm i | ||
- run: npm run lint:fix | ||
- run: npm run build | ||
- run: npm run package | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.npm_token}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.DS_Store | ||
node_modules | ||
/build | ||
/dist | ||
/.svelte-kit | ||
/package | ||
.env | ||
.env.* | ||
!.env.example | ||
vite.config.js.timestamp-* | ||
vite.config.ts.timestamp-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
engine-strict=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore files for PNPM, NPM and YARN | ||
pnpm-lock.yaml | ||
package-lock.json | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"arrowParens": "avoid", | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"printWidth": 80, | ||
"plugins": ["prettier-plugin-svelte"], | ||
"semi": false, | ||
"svelteSortOrder": "options-styles-scripts-markup", | ||
"svelteStrictMode": false, | ||
"svelteBracketNewLine": true, | ||
"svelteIndentScriptAndStyle": true, | ||
"useTabs": false, | ||
"pluginSearchDirs": ["."], | ||
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }], | ||
"bracketSpacing": true, | ||
"quoteProps": "consistent" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "bun", | ||
"internalConsoleOptions": "neverOpen", | ||
"request": "launch", | ||
"name": "Debug File", | ||
"program": "${file}", | ||
"cwd": "${workspaceFolder}", | ||
"stopOnEntry": false, | ||
"watchMode": false | ||
}, | ||
{ | ||
"type": "bun", | ||
"internalConsoleOptions": "neverOpen", | ||
"request": "launch", | ||
"name": "Run File", | ||
"program": "${file}", | ||
"cwd": "${workspaceFolder}", | ||
"noDebug": true, | ||
"watchMode": false | ||
}, | ||
{ | ||
"type": "bun", | ||
"internalConsoleOptions": "neverOpen", | ||
"request": "attach", | ||
"name": "Attach Bun", | ||
"url": "ws://localhost:6499/", | ||
"stopOnEntry": false | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# SvelteKit Session | ||
|
||
This library provides an easy way to create and read sessions on the server. | ||
|
||
Install with: | ||
|
||
```sh | ||
npm i -D sveltekit-session | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"extends": "./.svelte-kit/tsconfig.json", | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"checkJs": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"resolveJsonModule": true, | ||
"skipLibCheck": true, | ||
"sourceMap": true, | ||
"strict": true, | ||
"types": ["bun-types"], | ||
"isolatedModules": true, | ||
"lib": ["esnext", "DOM", "DOM.Iterable"], | ||
"moduleResolution": "node", | ||
"module": "esnext", | ||
"target": "esnext", | ||
"ignoreDeprecations": "5.0", | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"name": "sveltekit-session", | ||
"version": "0.1.0", | ||
"scripts": { | ||
"dev": "vite dev", | ||
"build": "vite build && npm run package", | ||
"preview": "vite preview", | ||
"package": "svelte-kit sync && svelte-package && publint", | ||
"prepublishOnly": "npm run package", | ||
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json", | ||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch", | ||
"lint": "prettier --check . && eslint .", | ||
"lint:fix": "eslint --no-error-on-unmatched-pattern --fix \"./src/**/*.{js,ts,html,svelte}\"", | ||
"format": "prettier --write ." | ||
}, | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"svelte": "./dist/index.js" | ||
} | ||
}, | ||
"files": [ | ||
"dist", | ||
"!dist/**/*.test.*", | ||
"!dist/**/*.spec.*" | ||
], | ||
"peerDependencies": { | ||
"@microsoft/fetch-event-source": "^2.0.1", | ||
"@sveltejs/kit": "^1.25.2 || ^2.0.0", | ||
"svelte": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@sveltejs/adapter-auto": "^3.0.0", | ||
"@sveltejs/adapter-node": "^5.0.1", | ||
"@sveltejs/kit": "^2.0.0", | ||
"@sveltejs/package": "^2.0.0", | ||
"@sveltejs/vite-plugin-svelte": "^3.0.0", | ||
"@types/eslint": "8.56.0", | ||
"@typescript-eslint/eslint-plugin": "^6.19.1", | ||
"@typescript-eslint/parser": "^6.19.1", | ||
"bun-types": "latest", | ||
"eslint": "^8.56.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-svelte": "^2.35.1", | ||
"install": "^0.13.0", | ||
"npm": "^10.2.5", | ||
"prettier": "^3.1.1", | ||
"prettier-plugin-svelte": "^3.1.2", | ||
"publint": "^0.1.9", | ||
"svelte": "^4.2.7", | ||
"svelte-check": "^3.6.0", | ||
"tslib": "^2.4.1", | ||
"typescript": "^5.0.0", | ||
"vite": "^5.0.11" | ||
}, | ||
"svelte": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"type": "module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// See https://kit.svelte.dev/docs/types#app | ||
// for information about these interfaces | ||
declare global { | ||
namespace App { | ||
// interface Error {} | ||
// interface Locals {} | ||
// interface PageData {} | ||
// interface PageState {} | ||
// interface Platform {} | ||
} | ||
} | ||
|
||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html/> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%sveltekit.assets%/favicon.png" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
%sveltekit.head% | ||
</head> | ||
<body data-sveltekit-preload-data="hover"> | ||
<div>%sveltekit.body%</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const IS_BROWSER = typeof document !== 'undefined' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @template [T=void] | ||
* @param {string|Error|unknown} value | ||
* @returns {import("./types").Unsafe<T>} | ||
*/ | ||
export function error(value) { | ||
if (value instanceof Error) { | ||
// @ts-ignore | ||
return { value: null, error: value } | ||
} | ||
// @ts-ignore | ||
return { value: null, error: new Error(`${value}`) } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { source } from './source.js' | ||
import { events } from './events.js' | ||
export * from './types.js' | ||
export { source, events } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* @template [T=void] | ||
* @param {T} [value] | ||
* @returns {import("./types").Unsafe<T>} | ||
*/ | ||
export function ok(value) { | ||
// @ts-ignore | ||
return { value, error: false } | ||
} |
Oops, something went wrong.