Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start to remove app utils #600

Merged
merged 9 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bundle and transform filesystem module to cjs for builders
  • Loading branch information
antony committed Mar 23, 2021
commit 3238b4ed817cf66bf696d02bf342c44d93ac4e44
8 changes: 4 additions & 4 deletions packages/kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
},
"devDependencies": {
"@rollup/plugin-replace": "^2.4.1",
"@sveltejs/app-utils": "workspace:*",
"@types/amphtml-validator": "^1.0.1",
"@types/mime": "^2.0.3",
"@types/node": "^14.14.33",
Expand Down Expand Up @@ -63,10 +62,11 @@
"import": "./dist/ssr.js"
},
"./http": {
"require": "./dist/http/index.js"
"import": "./dist/http.js"
},
"./files": {
"import": "./dist/files/index.js"
"./filesystem": {
"import": "./dist/filesystem.js",
"require": "./dist/filesystem.cjs"
},
"./types.d.ts": "./types.d.ts"
},
Expand Down
31 changes: 30 additions & 1 deletion packages/kit/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export default [
{
input: {
cli: 'src/cli.js',
ssr: 'src/runtime/server/index.js'
ssr: 'src/runtime/server/index.js',
filesystem: 'src/core/filesystem/index.js',
http: 'src/core/http/index.js'
},
output: {
dir: 'dist',
Expand All @@ -63,5 +65,32 @@ export default [
commonjs()
],
preserveEntrySignatures: true
},

{
input: {
http: 'src/core/filesystem/index.js'
},
output: {
dir: 'dist',
format: 'cjs',
chunkFileNames: 'chunks/[name].cjs'
},
external: (id) => {
return external.includes(id);
},
plugins: [
replace({
preventAssignment: true,
values: {
__VERSION__: pkg.version
}
}),
resolve({
extensions: ['.mjs', '.js', '.ts']
}),
commonjs()
],
preserveEntrySignatures: true
}
];
2 changes: 1 addition & 1 deletion packages/kit/src/core/adapt/Builder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { copy, rimraf, mkdirp } from '../filesystem/filesystem.js';
import { copy, rimraf, mkdirp } from '../filesystem/index.js';
import { prerender } from './prerender.js';

export default class Builder {
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/core/adapt/prerender.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { existsSync, readFileSync, writeFileSync } from 'fs';
import { dirname, join, resolve as resolve_path, sep as path_separator } from 'path';
import { parse, pathToFileURL, resolve, URLSearchParams } from 'url';
import glob from 'tiny-glob/sync.js';
import { mkdirp } from '../filesystem/filesystem.js';
import { mkdirp } from '../filesystem/index.js';

/** @param {string} html */
function clean_html(html) {
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/core/build/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs';
import path from 'path';
import { rimraf } from '../filesystem/filesystem';
import { rimraf } from '../filesystem/index.js';
import create_manifest_data from '../../core/create_manifest_data/index.js';
import { copy_assets } from '../utils.js';
import { create_app } from '../../core/create_app/index.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/core/create_app/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs';
import path from 'path';
import { mkdirp } from '../filesystem/filesystem';
import { mkdirp } from '../filesystem/index.js';

/** @type {Map<string, string>} */
const previous_contents = new Map();
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/core/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import amp_validator from 'amphtml-validator';
import vite from 'vite';
import create_manifest_data from '../../core/create_manifest_data/index.js';
import { create_app } from '../../core/create_app/index.js';
import { rimraf } from '../filesystem/filesystem.js';
import { rimraf } from '../filesystem/index.js';
import { ssr } from '../../runtime/server/index.js';
import { get_body } from '../http/index.js';
import { copy_assets } from '../utils.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/core/start/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs';
import http from 'http';
import { parse, pathToFileURL, URLSearchParams } from 'url';
import sirv from 'sirv';
import { get_body } from '../http';
import { get_body } from '../http/index.js';
import { join, resolve } from 'path';

/** @param {string} dir */
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/core/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { dirname, resolve } from 'path';
import colors from 'kleur';
import { copy } from './filesystem/filesystem';
import { copy } from './filesystem/index.js';
import { fileURLToPath } from 'url';
import { existsSync } from 'fs';

Expand Down
2 changes: 0 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.