@sveltejs/adapter-node
Advanced tools
Comparing version 0.0.3 to 0.0.4
56
index.js
const fs = require('fs'); | ||
const path = require('path'); | ||
const glob = require('tiny-glob/sync'); | ||
const { copy, prerender } = require('@sveltejs/app-utils'); | ||
const mkdirp = dir => { | ||
try { | ||
fs.mkdirSync(dir, { recursive: true }); | ||
} catch {} | ||
} | ||
module.exports = async function adapter({ | ||
dir, | ||
manifest, | ||
log | ||
}) { | ||
const out = 'build'; // TODO implement adapter options | ||
module.exports = function builder({ | ||
input, | ||
output, | ||
manifest | ||
}, opts = {}) { | ||
mkdirp(`${output}/assets/_app`); | ||
copy(`${dir}/client`, `${out}/assets/_app`, file => file[0] !== '.'); | ||
copy(`${dir}/server`, out); | ||
copy(`${__dirname}/server.js`, `${out}/index.js`); | ||
copy(`${dir}/client.json`, `${out}/client.json`); | ||
copy('src/app.html', `${out}/app.html`); | ||
// copy client code | ||
const client_code = path.resolve(input, 'client'); | ||
glob('**/*', { cwd: client_code, filesOnly: true }).forEach(file => { | ||
if (file[0] !== '.') { | ||
fs.copyFileSync(`${client_code}/${file}`, `${output}/assets/_app/${file}`); | ||
} | ||
}); | ||
log.minor('Prerendering static pages...'); | ||
// copy server code | ||
const server_code = path.resolve(input, 'server'); | ||
glob('**/*', { cwd: server_code, filesOnly: true }).forEach(file => { | ||
if (file[0] !== '.') { | ||
mkdirp(path.dirname(`${output}/${file}`)); | ||
fs.copyFileSync(`${server_code}/${file}`, `${output}/${file}`); | ||
} | ||
await prerender({ | ||
dir, | ||
out, | ||
manifest, | ||
log | ||
}); | ||
// copy the server entry point | ||
fs.copyFileSync(path.resolve(__dirname, 'server.js'), `${output}/index.js`); | ||
// generate manifest | ||
@@ -51,9 +39,3 @@ const written_manifest = `module.exports = { | ||
fs.writeFileSync(`${output}/manifest.js`, written_manifest); | ||
// copy client manifest | ||
fs.copyFileSync(`${input}/client.json`, `${output}/client.json`); | ||
// copy template | ||
fs.copyFileSync(`src/app.html`, `${output}/app.html`); | ||
fs.writeFileSync(`${out}/manifest.js`, written_manifest); | ||
}; |
{ | ||
"name": "@sveltejs/adapter-node", | ||
"version": "0.0.3", | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^15.1.0", | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"@rollup/plugin-sucrase": "^3.1.0", | ||
"@sveltejs/eslint-config": "github:sveltejs/eslint-config#v5.2.0", | ||
"@typescript-eslint/eslint-plugin": "^4.4.0", | ||
"cookie": "^0.4.1", | ||
"devalue": "^2.0.1", | ||
"eslint": "^7.11.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"node-fetch": "^2.6.1", | ||
"rollup": "^2.29.0", | ||
"sirv": "^1.0.6", | ||
"svelte": "^3.29.0", | ||
"typescript": "^4.0.3" | ||
}, | ||
"main": "index.js", | ||
"files": [ | ||
"server.js" | ||
], | ||
"scripts": { | ||
"dev": "rollup -cw", | ||
"build": "rollup -c", | ||
"prepublish": "npm run build" | ||
} | ||
"name": "@sveltejs/adapter-node", | ||
"version": "0.0.4", | ||
"devDependencies": { | ||
"rollup": "^2.32.0", | ||
"sirv": "^1.0.7" | ||
}, | ||
"main": "index.js", | ||
"files": [ | ||
"server.js" | ||
], | ||
"scripts": { | ||
"dev": "rollup -cw", | ||
"build": "rollup -c", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"dependencies": { | ||
"@sveltejs/app-utils": "0.0.7" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
111531
2
6
0
2554
1
11
+ Added@sveltejs/app-utils@0.0.7
+ Added@sveltejs/app-utils@0.0.7(transitive)
+ Addedmime@2.6.0(transitive)