mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-14 12:04:39 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
278be67228 | ||
|
|
64921dfc3c | ||
|
|
c8962ccf8c | ||
|
|
664c093391 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -11,4 +11,5 @@ test/app/build
|
|||||||
sapper
|
sapper
|
||||||
runtime.js
|
runtime.js
|
||||||
dist
|
dist
|
||||||
!rollup.config.js
|
!rollup.config.js
|
||||||
|
templates/*.js
|
||||||
@@ -1,5 +1,13 @@
|
|||||||
# sapper changelog
|
# sapper changelog
|
||||||
|
|
||||||
|
## 0.22.2
|
||||||
|
|
||||||
|
* Make paths in generated code relative to project
|
||||||
|
|
||||||
|
## 0.22.1
|
||||||
|
|
||||||
|
* Fix `pkg.files`
|
||||||
|
|
||||||
## 0.22.0
|
## 0.22.0
|
||||||
|
|
||||||
* Move generated files into `__sapper__` ([#453](https://github.com/sveltejs/sapper/pull/453))
|
* Move generated files into `__sapper__` ([#453](https://github.com/sveltejs/sapper/pull/453))
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "sapper",
|
"name": "sapper",
|
||||||
"version": "0.22.0",
|
"version": "0.22.2",
|
||||||
"description": "Military-grade apps, engineered by Svelte",
|
"description": "Military-grade apps, engineered by Svelte",
|
||||||
"bin": {
|
"bin": {
|
||||||
"sapper": "./sapper"
|
"sapper": "./sapper"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"*.js",
|
"*.js",
|
||||||
"runtime",
|
|
||||||
"webpack",
|
"webpack",
|
||||||
"config",
|
"config",
|
||||||
"sapper",
|
"sapper",
|
||||||
"components",
|
"dist/*.js",
|
||||||
"dist/*.js"
|
"templates/*.js"
|
||||||
],
|
],
|
||||||
"directories": {
|
"directories": {
|
||||||
"test": "test"
|
"test": "test"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function template(kind, external) {
|
|||||||
return {
|
return {
|
||||||
input: `templates/src/${kind}/index.ts`,
|
input: `templates/src/${kind}/index.ts`,
|
||||||
output: {
|
output: {
|
||||||
file: `templates/dist/${kind}.js`,
|
file: `templates/${kind}.js`,
|
||||||
format: 'es'
|
format: 'es'
|
||||||
},
|
},
|
||||||
external,
|
external,
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ function generate_client(
|
|||||||
bundler: string,
|
bundler: string,
|
||||||
dev_port?: number
|
dev_port?: number
|
||||||
) {
|
) {
|
||||||
const template_file = path.resolve(__dirname, '../templates/dist/client.js');
|
const template_file = path.resolve(__dirname, '../templates/client.js');
|
||||||
const template = fs.readFileSync(template_file, 'utf-8');
|
const template = fs.readFileSync(template_file, 'utf-8');
|
||||||
|
|
||||||
const page_ids = new Set(manifest_data.pages.map(page =>
|
const page_ids = new Set(manifest_data.pages.map(page =>
|
||||||
@@ -145,7 +145,7 @@ function generate_server(
|
|||||||
manifest_data: ManifestData,
|
manifest_data: ManifestData,
|
||||||
path_to_routes: string
|
path_to_routes: string
|
||||||
) {
|
) {
|
||||||
const template_file = path.resolve(__dirname, '../templates/dist/server.js');
|
const template_file = path.resolve(__dirname, '../templates/server.js');
|
||||||
const template = fs.readFileSync(template_file, 'utf-8');
|
const template = fs.readFileSync(template_file, 'utf-8');
|
||||||
|
|
||||||
const imports = [].concat(
|
const imports = [].concat(
|
||||||
@@ -204,9 +204,12 @@ function generate_server(
|
|||||||
error
|
error
|
||||||
};`.replace(/^\t\t/gm, '').trim();
|
};`.replace(/^\t\t/gm, '').trim();
|
||||||
|
|
||||||
|
const build_dir = path.relative(process.cwd(), locations.dest());
|
||||||
|
const src_dir = path.relative(process.cwd(), locations.src());
|
||||||
|
|
||||||
return `// This file is generated by Sapper — do not edit it!\n` + template
|
return `// This file is generated by Sapper — do not edit it!\n` + template
|
||||||
.replace('__BUILD__DIR__', JSON.stringify(locations.dest()))
|
.replace('__BUILD__DIR__', JSON.stringify(build_dir))
|
||||||
.replace('__SRC__DIR__', JSON.stringify(locations.src()))
|
.replace('__SRC__DIR__', JSON.stringify(src_dir))
|
||||||
.replace('__DEV__', dev() ? 'true' : 'false')
|
.replace('__DEV__', dev() ? 'true' : 'false')
|
||||||
.replace(/const manifest = __MANIFEST__;/, code);
|
.replace(/const manifest = __MANIFEST__;/, code);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user