-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore!: sapper -> sveltekit migration 🚀
- Loading branch information
1 parent
ef831b7
commit 9f88ff8
Showing
295 changed files
with
7,905 additions
and
10,890 deletions.
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
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 @@ | ||
{ | ||
"editor.formatOnSave": false, | ||
"prettier.singleQuote": 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
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
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
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 |
---|---|---|
@@ -1,26 +1,30 @@ | ||
import { get } from 'lodash-es' | ||
import { DEFAULT_LOCALE, LOCALE } from '../src/routes/_static/intl' | ||
import path from 'path' | ||
import get from 'lodash-es/get.js'; | ||
import { DEFAULT_LOCALE, LOCALE } from '../src/routes/_static/intl.js'; | ||
import path from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
|
||
const intl = require(path.join(__dirname, '../src/intl', LOCALE + '.js')) | ||
const defaultIntl = require(path.join(__dirname, '../src/intl', DEFAULT_LOCALE + '.js')) | ||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
export function warningOrError (message) { // avoid crashing the whole server on `yarn dev` | ||
if (process.env.NODE_ENV === 'production') { | ||
throw new Error(message) | ||
const {default: intl} = await import(path.join(__dirname, '../src/intl', LOCALE + '.js')) | ||
const {default: defaultIntl} = await import(path.join(__dirname, '../src/intl', DEFAULT_LOCALE + '.js')) | ||
|
||
export function warningOrError(message) { | ||
// avoid crashing the whole server on `yarn dev` | ||
if (import.meta.env.PROD) { | ||
throw new Error(message); | ||
} | ||
console.warn(message) | ||
return '(Placeholder intl string)' | ||
return '(Placeholder intl string)'; | ||
} | ||
|
||
export function getIntl (path) { | ||
const res = get(intl, path, get(defaultIntl, path)) | ||
export function getIntl(path) { | ||
const res = get(intl, path, get(defaultIntl, path)); | ||
if (typeof res !== 'string') { | ||
return warningOrError('Unknown intl string: ' + JSON.stringify(path)) | ||
return warningOrError('Unknown intl string: ' + JSON.stringify(path)); | ||
} | ||
return res | ||
return res; | ||
} | ||
|
||
export function trimWhitespace (str) { | ||
return str.trim().replace(/\s+/g, ' ') | ||
export function trimWhitespace(str) { | ||
return str.trim().replace(/\s+/g, ' '); | ||
} |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = { | ||
export default { | ||
ecma: 8, | ||
mangle: true, | ||
compress: { | ||
|
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,18 @@ | ||
import svelteIntlLoader from './svelte-intl-loader' | ||
|
||
const fileRegex = /\.(js|html|svelte)$/ | ||
|
||
export default function intlLoader () { | ||
return { | ||
name: 'intl-loader', | ||
enforce: 'pre', | ||
transform (src, id) { | ||
if (fileRegex.test(id)) { | ||
return { | ||
code: svelteIntlLoader(src), | ||
map: null // provide source map if available | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.