mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-12 16:57:26 +00:00
Much simpler project structure
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -7,7 +7,5 @@ build
|
||||
|
||||
# Auto-generated by lib/feature-plugin.js
|
||||
src/features-worker/index.ts
|
||||
src/features-worker/tsconfig.json
|
||||
src/client/lazy-app/worker-bridge/meta.ts
|
||||
src/client/lazy-app/feature-meta/index.ts
|
||||
src/client/tsconfig.json
|
||||
|
||||
12
client-tsconfig.json
Normal file
12
client-tsconfig.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": "./generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["esnext", "dom", "dom.iterable"],
|
||||
"types": []
|
||||
},
|
||||
"include": [
|
||||
"src/features/**/client/**/*",
|
||||
"src/features/**/shared/**/*",
|
||||
"src/shared/**/*"
|
||||
]
|
||||
}
|
||||
@@ -59,23 +59,7 @@ export default function () {
|
||||
.flat(Infinity)
|
||||
.join('\n');
|
||||
|
||||
const workerTsConfig = {
|
||||
extends: '../../generic-tsconfig.json',
|
||||
compilerOptions: {
|
||||
lib: ['webworker', 'esnext'],
|
||||
},
|
||||
references: featuresWorkerTsNames.map(([tsImport]) => ({
|
||||
path: path.dirname(tsImport),
|
||||
})),
|
||||
};
|
||||
|
||||
await Promise.all([
|
||||
fsp.writeFile(
|
||||
path.join(workerBasePath, 'tsconfig.json'),
|
||||
autoGenComment + JSON.stringify(workerTsConfig, null, ' '),
|
||||
),
|
||||
fsp.writeFile(path.join(workerBasePath, 'index.ts'), workerFile),
|
||||
]);
|
||||
await fsp.writeFile(path.join(workerBasePath, 'index.ts'), workerFile);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,7 +155,6 @@ export default function () {
|
||||
'lazy-app',
|
||||
'feature-meta',
|
||||
);
|
||||
const clientBasePath = path.join(process.cwd(), 'src', 'client');
|
||||
|
||||
const joinedMetas = metas.flat().join();
|
||||
|
||||
@@ -194,13 +177,6 @@ export default function () {
|
||||
const preprocessorMetaTsNames = preprocessorMetas.map((tsImport) =>
|
||||
getTsName(tsImport),
|
||||
);
|
||||
const tsConfigEncoderPaths = encoderMetas.flatMap((tsImport) => [
|
||||
path.relative(clientBasePath, tsImport.replace(/\/meta$/, '')),
|
||||
path.relative(
|
||||
clientBasePath,
|
||||
tsImport.replace(/shared\/meta$/, 'client'),
|
||||
),
|
||||
]);
|
||||
|
||||
const featureMeta = [
|
||||
autoGenComment,
|
||||
@@ -267,29 +243,10 @@ export default function () {
|
||||
.flat(Infinity)
|
||||
.join('\n');
|
||||
|
||||
const lazyTsConfig = {
|
||||
extends: '../../generic-tsconfig.json',
|
||||
compilerOptions: {
|
||||
lib: ['esnext', 'dom', 'dom.iterable'],
|
||||
types: [],
|
||||
},
|
||||
references: [
|
||||
{ path: '../features-worker' },
|
||||
{ path: '../shared' },
|
||||
{ path: '../features/processors/resize/client' },
|
||||
...tsConfigEncoderPaths.map((projectPath) => ({
|
||||
path: projectPath,
|
||||
})),
|
||||
],
|
||||
};
|
||||
|
||||
await Promise.all([
|
||||
fsp.writeFile(
|
||||
path.join(process.cwd(), 'src', 'client', 'tsconfig.json'),
|
||||
autoGenComment + JSON.stringify(lazyTsConfig, null, ' '),
|
||||
),
|
||||
fsp.writeFile(path.join(featureMetaBasePath, 'index.ts'), featureMeta),
|
||||
]);
|
||||
await fsp.writeFile(
|
||||
path.join(featureMetaBasePath, 'index.ts'),
|
||||
featureMeta,
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
import avifDecoder, { AVIFModule } from 'codecs/avif/dec/avif_dec';
|
||||
import wasmUrl from 'url:codecs/avif/dec/avif_dec.wasm';
|
||||
import { initEmscriptenModule, blobToArrayBuffer } from 'features/util';
|
||||
import { initEmscriptenModule, blobToArrayBuffer } from 'features/worker-utils';
|
||||
|
||||
let emscriptenModule: Promise<AVIFModule>;
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }]
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
import webpDecoder, { WebPModule } from 'codecs/webp/dec/webp_dec';
|
||||
import wasmUrl from 'url:codecs/webp/dec/webp_dec.wasm';
|
||||
import { initEmscriptenModule, blobToArrayBuffer } from 'features/util';
|
||||
import { initEmscriptenModule, blobToArrayBuffer } from 'features/worker-utils';
|
||||
|
||||
let emscriptenModule: Promise<WebPModule>;
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["esnext", "dom", "dom.iterable"],
|
||||
"types": []
|
||||
},
|
||||
"include": [
|
||||
"./*.ts",
|
||||
"../../../../client/lazy-app/worker-bridge/index.ts",
|
||||
"../shared/*.ts"
|
||||
],
|
||||
"references": [{ "path": "../shared" }]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }]
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
import avifEncoder, { AVIFModule } from 'codecs/avif/enc/avif_enc';
|
||||
import type { EncodeOptions } from '../shared/meta';
|
||||
import wasmUrl from 'url:codecs/avif/enc/avif_enc.wasm';
|
||||
import { initEmscriptenModule } from 'features/util';
|
||||
import { initEmscriptenModule } from 'features/worker-utils';
|
||||
|
||||
let emscriptenModule: Promise<AVIFModule>;
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }, { "path": "../shared" }]
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["esnext", "dom", "dom.iterable"],
|
||||
"types": []
|
||||
},
|
||||
"include": [
|
||||
"./*.ts",
|
||||
"../../../../client/lazy-app/util.ts",
|
||||
"../../../../client/lazy-app/worker-bridge/index.ts",
|
||||
"../shared/*.ts"
|
||||
],
|
||||
"references": [{ "path": "../shared" }]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }]
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["esnext", "dom", "dom.iterable"],
|
||||
"types": []
|
||||
},
|
||||
"include": [
|
||||
"./*.ts",
|
||||
"../../../../client/lazy-app/util.ts",
|
||||
"../../../../client/lazy-app/worker-bridge/index.ts",
|
||||
"../shared/*.ts"
|
||||
],
|
||||
"references": [{ "path": "../shared" }]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }]
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["esnext", "dom", "dom.iterable"],
|
||||
"types": []
|
||||
},
|
||||
"include": [
|
||||
"./*.ts",
|
||||
"../../../../client/lazy-app/util.ts",
|
||||
"../../../../client/lazy-app/worker-bridge/index.ts",
|
||||
"../shared/*.ts"
|
||||
],
|
||||
"references": [{ "path": "../shared" }]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }]
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["esnext", "dom", "dom.iterable"],
|
||||
"types": []
|
||||
},
|
||||
"include": [
|
||||
"*.ts",
|
||||
"../../../../client/lazy-app/worker-bridge/index.ts",
|
||||
"../shared/*.ts"
|
||||
],
|
||||
"references": [{ "path": "../shared" }]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }]
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
import mozjpeg_enc, { MozJPEGModule } from 'codecs/mozjpeg_enc/mozjpeg_enc';
|
||||
import { EncodeOptions } from '../shared/meta';
|
||||
import wasmUrl from 'url:codecs/mozjpeg_enc/mozjpeg_enc.wasm';
|
||||
import { initEmscriptenModule } from 'features/util';
|
||||
import { initEmscriptenModule } from 'features/worker-utils';
|
||||
|
||||
let emscriptenModule: Promise<MozJPEGModule>;
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }, { "path": "../shared" }]
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["esnext", "dom", "dom.iterable"],
|
||||
"types": []
|
||||
},
|
||||
"include": [
|
||||
"./*.ts",
|
||||
"../../../../client/lazy-app/util.ts",
|
||||
"../../../../client/lazy-app/worker-bridge/index.ts",
|
||||
"../shared/*.ts"
|
||||
],
|
||||
"references": [{ "path": "../shared" }]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }, { "path": "../shared" }]
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["esnext", "dom", "dom.iterable"],
|
||||
"types": []
|
||||
},
|
||||
"include": [
|
||||
"./*.ts",
|
||||
"../../../../client/lazy-app/worker-bridge/index.ts",
|
||||
"../shared/*.ts"
|
||||
],
|
||||
"references": [{ "path": "../shared" }]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }, { "path": "../shared" }]
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
import webpEncoder, { WebPModule } from 'codecs/webp/enc/webp_enc';
|
||||
import wasmUrl from 'url:codecs/webp/enc/webp_enc.wasm';
|
||||
import { initEmscriptenModule } from 'features/util';
|
||||
import { initEmscriptenModule } from 'features/worker-utils';
|
||||
import type { EncodeOptions } from '../shared/meta';
|
||||
|
||||
let emscriptenModule: Promise<WebPModule>;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }, { "path": "../shared" }]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }]
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
import imagequant, { QuantizerModule } from 'codecs/imagequant/imagequant';
|
||||
import wasmUrl from 'url:codecs/imagequant/imagequant.wasm';
|
||||
import { initEmscriptenModule } from 'features/util';
|
||||
import { initEmscriptenModule } from 'features/worker-utils';
|
||||
import { Options } from '../shared/meta';
|
||||
|
||||
let emscriptenModule: Promise<QuantizerModule>;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }, { "path": "../shared" }]
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["esnext", "dom", "dom.iterable"],
|
||||
"types": []
|
||||
},
|
||||
"include": [
|
||||
"./*.ts",
|
||||
"../../../../client/lazy-app/util.ts",
|
||||
"../../../../client/lazy-app/Compress/index.tsx",
|
||||
"../shared/*.ts"
|
||||
],
|
||||
"references": [{ "path": "../shared" }]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../../../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"references": [{ "path": "../../../" }, { "path": "../shared" }]
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": "../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"include": ["util.ts", "*.d.ts"],
|
||||
"references": []
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["esnext", "dom", "dom.iterable"],
|
||||
"types": []
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": "../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["esnext", "dom"],
|
||||
"types": ["node"]
|
||||
},
|
||||
"references": [{ "path": "../shared" }]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "../../generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
}
|
||||
}
|
||||
8
static-build-tsconfig.json
Normal file
8
static-build-tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["esnext", "dom"],
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src/shared/**/*", "src/static-build/**/*"]
|
||||
}
|
||||
@@ -2,9 +2,8 @@
|
||||
"extends": "./generic-tsconfig.json",
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./src/client" },
|
||||
{ "path": "./src/static-build" },
|
||||
{ "path": "./src/shared" },
|
||||
{ "path": "./src/sw" }
|
||||
{ "path": "./client-tsconfig.json" },
|
||||
{ "path": "./worker-tsconfig.json" },
|
||||
{ "path": "./static-build-tsconfig.json" }
|
||||
]
|
||||
}
|
||||
|
||||
13
worker-tsconfig.json
Normal file
13
worker-tsconfig.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "./generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["webworker", "esnext"]
|
||||
},
|
||||
"include": [
|
||||
"src/features/**/worker/**/*",
|
||||
"src/features/**/shared/**/*",
|
||||
"src/features/worker-utils/**/*",
|
||||
"src/features-worker/**/*",
|
||||
"src/sw/**/*"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user