@sveltejs/adapter-node
Advanced tools
Comparing version 1.0.0-next.85 to 1.0.0-next.86
@@ -1,5 +0,5 @@ | ||
import './shims-ff515308.js'; | ||
import './shims-7fd472a1.js'; | ||
import 'fs'; | ||
import 'path'; | ||
export { h as handler } from './handler-393b2283.js'; | ||
export { h as handler } from './handler-aee37ee5.js'; | ||
import 'url'; | ||
@@ -6,0 +6,0 @@ import 'SERVER'; |
@@ -1,4 +0,4 @@ | ||
import { p as parse$1, e as env, h as handler } from './handler-393b2283.js'; | ||
import { p as parse$1, e as env, h as handler } from './handler-aee37ee5.js'; | ||
import http from 'http'; | ||
import './shims-ff515308.js'; | ||
import './shims-7fd472a1.js'; | ||
import 'assert'; | ||
@@ -5,0 +5,0 @@ import 'net'; |
@@ -1,2 +0,2 @@ | ||
import './shims-ff515308.js'; | ||
import './shims-7fd472a1.js'; | ||
import 'assert'; | ||
@@ -3,0 +3,0 @@ import 'net'; |
54
index.js
@@ -1,10 +0,4 @@ | ||
import { createReadStream, createWriteStream, existsSync, statSync, writeFileSync } from 'fs'; | ||
import { pipeline } from 'stream'; | ||
import glob from 'tiny-glob'; | ||
import { writeFileSync } from 'fs'; | ||
import { fileURLToPath } from 'url'; | ||
import { promisify } from 'util'; | ||
import zlib from 'zlib'; | ||
const pipe = promisify(pipeline); | ||
const files = fileURLToPath(new URL('./files', import.meta.url).href); | ||
@@ -52,4 +46,4 @@ | ||
builder.log.minor('Compressing assets'); | ||
await compress(`${out}/client`); | ||
await compress(`${out}/prerendered`); | ||
await builder.compress(`${out}/client`); | ||
await builder.compress(`${out}/prerendered`); | ||
} | ||
@@ -59,43 +53,1 @@ } | ||
} | ||
/** | ||
* @param {string} directory | ||
*/ | ||
async function compress(directory) { | ||
if (!existsSync(directory)) { | ||
return; | ||
} | ||
const files = await glob('**/*.{html,js,json,css,svg,xml,wasm}', { | ||
cwd: directory, | ||
dot: true, | ||
absolute: true, | ||
filesOnly: true | ||
}); | ||
await Promise.all( | ||
files.map((file) => Promise.all([compress_file(file, 'gz'), compress_file(file, 'br')])) | ||
); | ||
} | ||
/** | ||
* @param {string} file | ||
* @param {'gz' | 'br'} format | ||
*/ | ||
async function compress_file(file, format = 'gz') { | ||
const compress = | ||
format == 'br' | ||
? zlib.createBrotliCompress({ | ||
params: { | ||
[zlib.constants.BROTLI_PARAM_MODE]: zlib.constants.BROTLI_MODE_TEXT, | ||
[zlib.constants.BROTLI_PARAM_QUALITY]: zlib.constants.BROTLI_MAX_QUALITY, | ||
[zlib.constants.BROTLI_PARAM_SIZE_HINT]: statSync(file).size | ||
} | ||
}) | ||
: zlib.createGzip({ level: zlib.constants.Z_BEST_COMPRESSION }); | ||
const source = createReadStream(file); | ||
const destination = createWriteStream(`${file}.${format}`); | ||
await pipe(source, compress, destination); | ||
} |
{ | ||
"name": "@sveltejs/adapter-node", | ||
"version": "1.0.0-next.85", | ||
"version": "1.0.0-next.86", | ||
"repository": { | ||
@@ -25,8 +25,5 @@ "type": "git", | ||
], | ||
"dependencies": { | ||
"tiny-glob": "^0.2.9" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@sveltejs/kit": "1.0.0-next.395", | ||
"@sveltejs/kit": "1.0.0-next.405", | ||
"@types/node": "^16.11.36", | ||
@@ -33,0 +30,0 @@ "c8": "^7.11.3", |
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance 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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
782412
0
17887
18
- Removedtiny-glob@^0.2.9
- Removedglobalyzer@0.1.0(transitive)
- Removedglobrex@0.1.2(transitive)
- Removedtiny-glob@0.2.9(transitive)