@trebired/bundler 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/LICENSE +661 -0
- package/README.md +155 -0
- package/dist/cli/run-cli.d.ts +14 -0
- package/dist/cli/run-cli.d.ts.map +1 -0
- package/dist/cli/run-cli.js +104 -0
- package/dist/cli/run-cli.js.map +1 -0
- package/dist/cli.d.ts +5 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +10 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +32 -0
- package/dist/config/index.js.map +1 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -0
- package/dist/core/build.d.ts +4 -0
- package/dist/core/build.d.ts.map +1 -0
- package/dist/core/build.js +40 -0
- package/dist/core/build.js.map +1 -0
- package/dist/core/esbuild-options.d.ts +25 -0
- package/dist/core/esbuild-options.d.ts.map +1 -0
- package/dist/core/esbuild-options.js +91 -0
- package/dist/core/esbuild-options.js.map +1 -0
- package/dist/core/shared.d.ts +12 -0
- package/dist/core/shared.d.ts.map +1 -0
- package/dist/core/shared.js +41 -0
- package/dist/core/shared.js.map +1 -0
- package/dist/core/watch.d.ts +4 -0
- package/dist/core/watch.d.ts.map +1 -0
- package/dist/core/watch.js +61 -0
- package/dist/core/watch.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/logging.d.ts +4 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +12 -0
- package/dist/logging.js.map +1 -0
- package/dist/plugins/scss.d.ts +11 -0
- package/dist/plugins/scss.d.ts.map +1 -0
- package/dist/plugins/scss.js +44 -0
- package/dist/plugins/scss.js.map +1 -0
- package/dist/plugins/source-annotations.d.ts +17 -0
- package/dist/plugins/source-annotations.d.ts.map +1 -0
- package/dist/plugins/source-annotations.js +78 -0
- package/dist/plugins/source-annotations.js.map +1 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { context as createContext } from "esbuild";
|
|
2
|
+
import { logPackageInitialized } from "@trebired/logger-adapter";
|
|
3
|
+
import { BUNDLER_LOG_GROUP, BUNDLER_PACKAGE_NAME } from "../constants.js";
|
|
4
|
+
import { resolveLogger } from "../logging.js";
|
|
5
|
+
import { createEsbuildOptions, normalizeBundlerOptions } from "./esbuild-options.js";
|
|
6
|
+
import { cleanOutDir, formatFailure, logWarnings, toBuildResult } from "./shared.js";
|
|
7
|
+
async function watch(options) {
|
|
8
|
+
const normalized = normalizeBundlerOptions(options || {});
|
|
9
|
+
const logger = resolveLogger(normalized.logger, normalized.loggerAdapter);
|
|
10
|
+
logPackageInitialized({
|
|
11
|
+
adapter: normalized.loggerAdapter,
|
|
12
|
+
fallback: "console",
|
|
13
|
+
group: BUNDLER_LOG_GROUP,
|
|
14
|
+
logger: normalized.logger,
|
|
15
|
+
source: BUNDLER_PACKAGE_NAME,
|
|
16
|
+
});
|
|
17
|
+
if (normalized.clean) {
|
|
18
|
+
logger.info("watch", `clean :: ${normalized.outDir}`);
|
|
19
|
+
await cleanOutDir(normalized.outDir);
|
|
20
|
+
}
|
|
21
|
+
const context = await createContext(createEsbuildOptions(normalized, logger));
|
|
22
|
+
const executeRebuild = async () => {
|
|
23
|
+
const startedAt = Date.now();
|
|
24
|
+
const result = await context.rebuild();
|
|
25
|
+
logWarnings(logger, result.warnings);
|
|
26
|
+
const summary = toBuildResult({
|
|
27
|
+
result,
|
|
28
|
+
rootDir: normalized.rootDir,
|
|
29
|
+
startedAt,
|
|
30
|
+
});
|
|
31
|
+
logger.info("watch", `rebuilt :: outputs=${summary.outputs.length} warnings=${summary.warnings}`);
|
|
32
|
+
return summary;
|
|
33
|
+
};
|
|
34
|
+
try {
|
|
35
|
+
logger.info("watch", "start");
|
|
36
|
+
await executeRebuild();
|
|
37
|
+
await context.watch();
|
|
38
|
+
return {
|
|
39
|
+
async rebuild() {
|
|
40
|
+
try {
|
|
41
|
+
return await executeRebuild();
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
logger.fail("watch", `rebuild-failed :: ${formatFailure(error)}`);
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
async dispose() {
|
|
49
|
+
logger.info("watch", "dispose");
|
|
50
|
+
await context.dispose();
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
logger.fail("watch", `failed :: ${formatFailure(error)}`);
|
|
56
|
+
await context.dispose();
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export { watch };
|
|
61
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/core/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAErF,KAAK,UAAU,KAAK,CAAC,OAAuB;IAC1C,MAAM,UAAU,GAAG,uBAAuB,CAA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C,KAAK,EAAE,CAAC;QAEtB,OAAO;YACL,KAAK,CAAC,OAAO;gBACX,IAAI,CAAC;oBACH,OAAO,MAAM,cAAc,EAAE,CAAC;gBAChC,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,qBAAqB,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;oBAClE,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;YACD,KAAK,CAAC,OAAO;gBACX,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;gBAChC,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;YAC1B,CAAC;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC1D,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACxB,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { BUNDLER_LOG_GROUP, BUNDLER_PACKAGE_NAME } from "./constants.js";
|
|
2
|
+
export { bundle } from "./core/build.js";
|
|
3
|
+
export { watch } from "./core/watch.js";
|
|
4
|
+
export { defineBundlerConfig } from "./config/index.js";
|
|
5
|
+
export { resolveLogger } from "./logging.js";
|
|
6
|
+
export { buildSourceAnnotation, injectSourceAnnotation, resolveSourceLabel } from "./plugins/source-annotations.js";
|
|
7
|
+
export { createScssPlugin } from "./plugins/scss.js";
|
|
8
|
+
export { runCli } from "./cli/run-cli.js";
|
|
9
|
+
export type { BundlerBuildResult, BundlerGenericLogMethod, BundlerLogEvent, BundlerLogger, BundlerLoggerAdapter, BundlerLogMethod, BundlerOptions, BundlerWatchSession, LoadedBundlerConfig, NormalizedBundlerLogger, } from "./types.js";
|
|
10
|
+
export { bundle as default } from "./core/build.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACpH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,YAAY,EACV,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { BUNDLER_LOG_GROUP, BUNDLER_PACKAGE_NAME } from "./constants.js";
|
|
2
|
+
export { bundle } from "./core/build.js";
|
|
3
|
+
export { watch } from "./core/watch.js";
|
|
4
|
+
export { defineBundlerConfig } from "./config/index.js";
|
|
5
|
+
export { resolveLogger } from "./logging.js";
|
|
6
|
+
export { buildSourceAnnotation, injectSourceAnnotation, resolveSourceLabel } from "./plugins/source-annotations.js";
|
|
7
|
+
export { createScssPlugin } from "./plugins/scss.js";
|
|
8
|
+
export { runCli } from "./cli/run-cli.js";
|
|
9
|
+
export { bundle as default } from "./core/build.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACpH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAe1C,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BundlerLogger, BundlerLoggerAdapter, NormalizedBundlerLogger } from "./types.js";
|
|
2
|
+
declare function resolveLogger(logger?: BundlerLogger, adapter?: BundlerLoggerAdapter): NormalizedBundlerLogger;
|
|
3
|
+
export { resolveLogger };
|
|
4
|
+
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB,iBAAS,aAAa,CACpB,MAAM,CAAC,EAAE,aAAa,EACtB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,uBAAuB,CAOzB;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/logging.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { resolveLogger as resolveSharedLogger } from "@trebired/logger-adapter";
|
|
2
|
+
import { BUNDLER_PACKAGE_NAME } from "./constants.js";
|
|
3
|
+
function resolveLogger(logger, adapter) {
|
|
4
|
+
return resolveSharedLogger({
|
|
5
|
+
adapter,
|
|
6
|
+
fallback: "console",
|
|
7
|
+
logger,
|
|
8
|
+
source: BUNDLER_PACKAGE_NAME,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export { resolveLogger };
|
|
12
|
+
//# sourceMappingURL=logging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAOtD,SAAS,aAAa,CACpB,MAAsB,EACtB,OAA8B;IAE9B,OAAO,mBAAmB,CAAC;QACzB,OAAO;QACP,QAAQ,EAAE,SAAS;QACnB,MAAM;QACN,MAAM,EAAE,oBAAoB;KAC7B,CAA4B,CAAC;AAChC,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Plugin } from "esbuild";
|
|
2
|
+
import type { NormalizedBundlerLogger } from "../types.js";
|
|
3
|
+
type ScssPluginOptions = {
|
|
4
|
+
annotateSources: boolean;
|
|
5
|
+
logger: NormalizedBundlerLogger;
|
|
6
|
+
rootDir: string;
|
|
7
|
+
sourcemapEnabled: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare function createScssPlugin(options: ScssPluginOptions): Plugin;
|
|
10
|
+
export { createScssPlugin };
|
|
11
|
+
//# sourceMappingURL=scss.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scss.d.ts","sourceRoot":"","sources":["../../src/plugins/scss.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGtC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,KAAK,iBAAiB,GAAG;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,uBAAuB,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,iBAAS,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAuC5D;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { compileAsync } from "sass-embedded";
|
|
3
|
+
import { injectSourceAnnotation } from "./source-annotations.js";
|
|
4
|
+
function createScssPlugin(options) {
|
|
5
|
+
return {
|
|
6
|
+
name: "trebired-scss",
|
|
7
|
+
setup(build) {
|
|
8
|
+
build.onLoad({ filter: /\.scss$/ }, async (args) => {
|
|
9
|
+
try {
|
|
10
|
+
const result = await compileAsync(args.path, {
|
|
11
|
+
loadPaths: [options.rootDir],
|
|
12
|
+
sourceMap: options.sourcemapEnabled,
|
|
13
|
+
sourceMapIncludeSources: options.sourcemapEnabled,
|
|
14
|
+
style: "expanded",
|
|
15
|
+
});
|
|
16
|
+
const contents = options.annotateSources
|
|
17
|
+
? injectSourceAnnotation({
|
|
18
|
+
contents: result.css,
|
|
19
|
+
filePath: args.path,
|
|
20
|
+
kind: "css",
|
|
21
|
+
rootDir: options.rootDir,
|
|
22
|
+
})
|
|
23
|
+
: result.css;
|
|
24
|
+
return {
|
|
25
|
+
contents,
|
|
26
|
+
loader: "css",
|
|
27
|
+
resolveDir: path.dirname(args.path),
|
|
28
|
+
watchFiles: result.loadedUrls
|
|
29
|
+
.filter((url) => url.protocol === "file:")
|
|
30
|
+
.map((url) => url.pathname),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
options.logger.error("scss", `compile-failed :: ${args.path}`, {
|
|
35
|
+
error: error instanceof Error ? error.message : String(error),
|
|
36
|
+
});
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export { createScssPlugin };
|
|
44
|
+
//# sourceMappingURL=scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scss.js","sourceRoot":"","sources":["../../src/plugins/scss.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAUjE,SAAS,gBAAgB,CAAC,OAA0B;IAClD,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,KAAK,CAAC,KAAK;YACT,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;gBACjD,IAAI,CAAC;oBACH,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE;wBAC3C,SAAS,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;wBAC5B,SAAS,EAAE,OAAO,CAAC,gBAAgB;wBACnC,uBAAuB,EAAE,OAAO,CAAC,gBAAgB;wBACjD,KAAK,EAAE,UAAU;qBAClB,CAAC,CAAC;oBAEH,MAAM,QAAQ,GAAG,OAAO,CAAC,eAAe;wBACtC,CAAC,CAAC,sBAAsB,CAAC;4BACvB,QAAQ,EAAE,MAAM,CAAC,GAAG;4BACpB,QAAQ,EAAE,IAAI,CAAC,IAAI;4BACnB,IAAI,EAAE,KAAK;4BACX,OAAO,EAAE,OAAO,CAAC,OAAO;yBACzB,CAAC;wBACF,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;oBAEf,OAAO;wBACL,QAAQ;wBACR,MAAM,EAAE,KAAK;wBACb,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;wBACnC,UAAU,EAAE,MAAM,CAAC,UAAU;6BAC1B,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,OAAO,CAAC;6BACzC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;qBAC9B,CAAC;gBACJ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,qBAAqB,IAAI,CAAC,IAAI,EAAE,EAAE;wBAC7D,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBAC9D,CAAC,CAAC;oBACH,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Plugin } from "esbuild";
|
|
2
|
+
import type { NormalizedBundlerLogger } from "../types.js";
|
|
3
|
+
type SourceAnnotationsPluginOptions = {
|
|
4
|
+
logger: NormalizedBundlerLogger;
|
|
5
|
+
rootDir: string;
|
|
6
|
+
};
|
|
7
|
+
declare function resolveSourceLabel(filePath: string, rootDir: string): string;
|
|
8
|
+
declare function buildSourceAnnotation(filePath: string, rootDir: string): string;
|
|
9
|
+
declare function injectSourceAnnotation(args: {
|
|
10
|
+
contents: string;
|
|
11
|
+
filePath: string;
|
|
12
|
+
kind: "code" | "css";
|
|
13
|
+
rootDir: string;
|
|
14
|
+
}): string;
|
|
15
|
+
declare function createSourceAnnotationsPlugin(options: SourceAnnotationsPluginOptions): Plugin;
|
|
16
|
+
export { buildSourceAnnotation, createSourceAnnotationsPlugin, injectSourceAnnotation, resolveSourceLabel };
|
|
17
|
+
//# sourceMappingURL=source-annotations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-annotations.d.ts","sourceRoot":"","sources":["../../src/plugins/source-annotations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,KAAK,8BAA8B,GAAG;IACpC,MAAM,EAAE,uBAAuB,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAMF,iBAAS,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAErE;AAED,iBAAS,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAExE;AAeD,iBAAS,sBAAsB,CAAC,IAAI,EAAE;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,MAAM,CAYT;AAYD,iBAAS,6BAA6B,CAAC,OAAO,EAAE,8BAA8B,GAAG,MAAM,CA6BtF;AAED,OAAO,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
function toPosixPath(value) {
|
|
4
|
+
return value.replace(/\\/g, "/");
|
|
5
|
+
}
|
|
6
|
+
function resolveSourceLabel(filePath, rootDir) {
|
|
7
|
+
return toPosixPath(path.relative(rootDir, filePath) || path.basename(filePath));
|
|
8
|
+
}
|
|
9
|
+
function buildSourceAnnotation(filePath, rootDir) {
|
|
10
|
+
return `/*! @trebired/source: ${resolveSourceLabel(filePath, rootDir)} */`;
|
|
11
|
+
}
|
|
12
|
+
function insertAfterShebang(contents, annotation) {
|
|
13
|
+
const newlineIndex = contents.indexOf("\n");
|
|
14
|
+
if (newlineIndex === -1)
|
|
15
|
+
return `${contents}\n${annotation}\n`;
|
|
16
|
+
return `${contents.slice(0, newlineIndex + 1)}${annotation}\n${contents.slice(newlineIndex + 1)}`;
|
|
17
|
+
}
|
|
18
|
+
function insertAfterCharset(contents, annotation) {
|
|
19
|
+
const charsetMatch = contents.match(/^(@charset\s+(?:"[^"]*"|'[^']*');\s*)/i);
|
|
20
|
+
if (!charsetMatch)
|
|
21
|
+
return `${annotation}\n${contents}`;
|
|
22
|
+
const prefix = charsetMatch[1];
|
|
23
|
+
return `${prefix}${annotation}\n${contents.slice(prefix.length)}`;
|
|
24
|
+
}
|
|
25
|
+
function injectSourceAnnotation(args) {
|
|
26
|
+
const annotation = buildSourceAnnotation(args.filePath, args.rootDir);
|
|
27
|
+
if (args.kind === "css") {
|
|
28
|
+
return insertAfterCharset(args.contents, annotation);
|
|
29
|
+
}
|
|
30
|
+
if (args.contents.startsWith("#!")) {
|
|
31
|
+
return insertAfterShebang(args.contents, annotation);
|
|
32
|
+
}
|
|
33
|
+
return `${annotation}\n${args.contents}`;
|
|
34
|
+
}
|
|
35
|
+
function resolveLoader(filePath) {
|
|
36
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
37
|
+
if (ext === ".css")
|
|
38
|
+
return "css";
|
|
39
|
+
if (ext === ".tsx")
|
|
40
|
+
return "tsx";
|
|
41
|
+
if (ext === ".jsx")
|
|
42
|
+
return "jsx";
|
|
43
|
+
if (ext === ".ts" || ext === ".mts" || ext === ".cts")
|
|
44
|
+
return "ts";
|
|
45
|
+
return "js";
|
|
46
|
+
}
|
|
47
|
+
function createSourceAnnotationsPlugin(options) {
|
|
48
|
+
return {
|
|
49
|
+
name: "trebired-source-annotations",
|
|
50
|
+
setup(build) {
|
|
51
|
+
build.onLoad({ filter: /\.(?:[mc]?js|[mc]?ts|jsx|tsx|css)$/ }, async (args) => {
|
|
52
|
+
try {
|
|
53
|
+
const original = await fs.readFile(args.path, "utf8");
|
|
54
|
+
const kind = path.extname(args.path).toLowerCase() === ".css" ? "css" : "code";
|
|
55
|
+
const contents = injectSourceAnnotation({
|
|
56
|
+
contents: original,
|
|
57
|
+
filePath: args.path,
|
|
58
|
+
kind,
|
|
59
|
+
rootDir: options.rootDir,
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
contents,
|
|
63
|
+
loader: resolveLoader(args.path),
|
|
64
|
+
watchFiles: [args.path],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
options.logger.error("annotate", `load-failed :: ${args.path}`, {
|
|
69
|
+
error: error instanceof Error ? error.message : String(error),
|
|
70
|
+
});
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export { buildSourceAnnotation, createSourceAnnotationsPlugin, injectSourceAnnotation, resolveSourceLabel };
|
|
78
|
+
//# sourceMappingURL=source-annotations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-annotations.js","sourceRoot":"","sources":["../../src/plugins/source-annotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAU7B,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAgB,EAAE,OAAe;IAC3D,OAAO,WAAW,CAAC,IAA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;wBACnB,IAAI;wBACJ,OAAO,EAAE,OAAO,CAAC,OAAO;qBACzB,CAAC,CAAC;oBAEH,OAAO;wBACL,QAAQ;wBACR,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;wBAChC,UAAU,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;qBACxB,CAAC;gBACJ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,kBAAkB,IAAI,CAAC,IAAI,EAAE,EAAE;wBAC9D,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBAC9D,CAAC,CAAC;oBACH,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Metafile, Format, Platform } from "esbuild";
|
|
2
|
+
import type { LoggerAdapterEvent, LoggerAdapterGenericLogMethod, LoggerAdapterLogger, LoggerAdapterLogMethod, LoggerAdapterWriter, NormalizedLoggerAdapter } from "@trebired/logger-adapter";
|
|
3
|
+
type BundlerLogger = LoggerAdapterLogger;
|
|
4
|
+
type BundlerLoggerAdapter = LoggerAdapterWriter;
|
|
5
|
+
type BundlerLogMethod = LoggerAdapterLogMethod;
|
|
6
|
+
type BundlerGenericLogMethod = LoggerAdapterGenericLogMethod;
|
|
7
|
+
type BundlerLogEvent = LoggerAdapterEvent;
|
|
8
|
+
type NormalizedBundlerLogger = NormalizedLoggerAdapter;
|
|
9
|
+
type BundlerOptions = {
|
|
10
|
+
entries: string[] | Record<string, string>;
|
|
11
|
+
outDir: string;
|
|
12
|
+
rootDir?: string;
|
|
13
|
+
platform?: Platform;
|
|
14
|
+
format?: Format;
|
|
15
|
+
target?: string | string[];
|
|
16
|
+
minify?: boolean;
|
|
17
|
+
sourcemap?: boolean | "inline" | "external";
|
|
18
|
+
splitting?: boolean;
|
|
19
|
+
publicPath?: string;
|
|
20
|
+
external?: string[];
|
|
21
|
+
define?: Record<string, string>;
|
|
22
|
+
clean?: boolean;
|
|
23
|
+
annotateSources?: boolean;
|
|
24
|
+
logger?: BundlerLogger;
|
|
25
|
+
loggerAdapter?: BundlerLoggerAdapter;
|
|
26
|
+
};
|
|
27
|
+
type BundlerBuildResult = {
|
|
28
|
+
outputs: string[];
|
|
29
|
+
warnings: number;
|
|
30
|
+
metafile?: Metafile;
|
|
31
|
+
durationMs: number;
|
|
32
|
+
};
|
|
33
|
+
type BundlerWatchSession = {
|
|
34
|
+
rebuild(): Promise<BundlerBuildResult>;
|
|
35
|
+
dispose(): Promise<void>;
|
|
36
|
+
};
|
|
37
|
+
type LoadedBundlerConfig = {
|
|
38
|
+
config: BundlerOptions;
|
|
39
|
+
configPath: string;
|
|
40
|
+
};
|
|
41
|
+
export type { BundlerBuildResult, BundlerGenericLogMethod, BundlerLogEvent, BundlerLogger, BundlerLoggerAdapter, BundlerLogMethod, BundlerOptions, BundlerWatchSession, LoadedBundlerConfig, NormalizedBundlerLogger, };
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,KAAK,EACV,kBAAkB,EAClB,6BAA6B,EAC7B,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAElC,KAAK,aAAa,GAAG,mBAAmB,CAAC;AACzC,K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CAAC;CAC1B,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,YAAY,EACV,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,GACxB,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@trebired/bundler",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Fast esbuild-based bundler wrapper with SCSS support, watch mode, and inline source path annotations.",
|
|
5
|
+
"license": "AGPL-3.0-only",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"bundler",
|
|
8
|
+
"esbuild",
|
|
9
|
+
"scss",
|
|
10
|
+
"typescript",
|
|
11
|
+
"bun",
|
|
12
|
+
"node"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/trebired/bundler.git"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/trebired/bundler/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/trebired/bundler#readme",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18",
|
|
25
|
+
"bun": ">=1.0.0"
|
|
26
|
+
},
|
|
27
|
+
"private": false,
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"packageManager": "bun@1.3.12",
|
|
32
|
+
"main": "./dist/index.js",
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"bin": {
|
|
35
|
+
"trebired-bundler": "./dist/cli.js"
|
|
36
|
+
},
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"import": "./dist/index.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist",
|
|
45
|
+
"CHANGELOG.md",
|
|
46
|
+
"LICENSE",
|
|
47
|
+
"README.md"
|
|
48
|
+
],
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
51
|
+
"demo": "bun run examples/dummy.ts",
|
|
52
|
+
"prepublishOnly": "bun run typecheck && bun test && bun run build",
|
|
53
|
+
"test": "bun test",
|
|
54
|
+
"typecheck": "tsc --noEmit"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@trebired/logger-adapter": "^0.2.0",
|
|
58
|
+
"esbuild": "^0.28.0",
|
|
59
|
+
"sass-embedded": "^1.100.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/bun": "^1.3.4",
|
|
63
|
+
"@types/node": "^24.10.1",
|
|
64
|
+
"typescript": "^6.0.2"
|
|
65
|
+
}
|
|
66
|
+
}
|