aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md12
-rw-r--r--src/bundler.zig38
2 files changed, 37 insertions, 13 deletions
diff --git a/README.md b/README.md
index 3c3e351f5..8dc076164 100644
--- a/README.md
+++ b/README.md
@@ -99,7 +99,17 @@ bun build ./routes --outdir=./out
Unlike many other bundlers, `Bun` only bundles `node_modules`. This is great for development, where most people add/update packages much less frequently than app code (which is also great for caching in browsers). To make that distinction clear, the filename defaults to `node_modules.bun`. We recommend storing `node_modules.bun` in your git repository. Since it's a binary file, it shouldn't clutter your git history and it will make your entire frontend development team move faster if they don't have to re-bundle dependencies.
-# Not implemented yet
+# Things that don't work yet
+
+| Feature | In |
+| ---------------------------------------------------- | --------------------- |
+| [Private Class Fields](1) | JavaScript Transpiler |
+| [Import Assertions](2) | JavaScript Transpiler |
+| Un-quoted `.env` string values | .env loader |
+| Sharing `.bun` files (must not write absolute paths) | JavaScript Bundler |
+
+[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields
+[2]: https://github.com/tc39/proposal-import-assertions
# Building from source
diff --git a/src/bundler.zig b/src/bundler.zig
index b80bc9c78..8b86203f5 100644
--- a/src/bundler.zig
+++ b/src/bundler.zig
@@ -422,8 +422,12 @@ pub fn NewBundler(cache_files: bool) type {
};
worker.data.shared_buffer = try MutableString.init(generator.allocator, 0);
worker.data.scan_pass_result = js_parser.ScanPassResult.init(generator.allocator);
+ worker.data.log = generator.log.*;
- defer worker.data.deinit(generator.allocator);
+ defer {
+ generator.log.* = worker.data.log;
+ worker.data.deinit(generator.allocator);
+ }
while (generator.queue.next()) |item| {
try generator.processFile(worker, item);
@@ -438,6 +442,10 @@ pub fn NewBundler(cache_files: bool) type {
}
for (this.workers[0..this.workers_used]) |*worker| {
+ worker.data.log.appendTo(generator.log) catch {};
+ }
+
+ for (this.workers[0..this.workers_used]) |*worker| {
@atomicStore(bool, &worker.quit, true, .Release);
}
@@ -471,6 +479,7 @@ pub fn NewBundler(cache_files: bool) type {
pub const WorkerData = struct {
shared_buffer: MutableString = undefined,
scan_pass_result: js_parser.ScanPassResult = undefined,
+ log: logger.Log,
pub fn deinit(this: *WorkerData, allocator: *std.mem.Allocator) void {
this.shared_buffer.deinit();
@@ -523,11 +532,15 @@ pub fn NewBundler(cache_files: bool) type {
js_ast.Expr.Data.Store.create(this.generator.allocator);
js_ast.Stmt.Data.Store.create(this.generator.allocator);
this.data = this.generator.allocator.create(WorkerData) catch unreachable;
- this.data.* = WorkerData{};
+ this.data.* = WorkerData{
+ .log = logger.Log.init(this.generator.allocator),
+ };
this.data.shared_buffer = try MutableString.init(this.generator.allocator, 0);
this.data.scan_pass_result = js_parser.ScanPassResult.init(this.generator.allocator);
- defer this.data.deinit(this.generator.allocator);
+ defer {
+ this.data.deinit(this.generator.allocator);
+ }
this.notifyStarted();
@@ -1072,6 +1085,7 @@ pub fn NewBundler(cache_files: bool) type {
defer scan_pass_result.reset();
defer shared_buffer.reset();
defer this.bundler.resetStore();
+ var log = &worker.data.log;
// If we're in a node_module, build that almost normally
if (is_from_node_modules) {
@@ -1108,7 +1122,7 @@ pub fn NewBundler(cache_files: bool) type {
const module_data = BundledModuleData.get(this, &resolve) orelse {
const source = logger.Source.initPathString(file_path.text, entry.contents);
- this.log.addResolveError(
+ log.addResolveError(
&source,
logger.Range.None,
this.allocator,
@@ -1163,7 +1177,7 @@ pub fn NewBundler(cache_files: bool) type {
bundler.allocator,
opts,
bundler.options.define,
- this.log,
+ log,
&source,
)) orelse return;
if (ast.import_records.len > 0) {
@@ -1227,7 +1241,7 @@ pub fn NewBundler(cache_files: bool) type {
error.ModuleNotFound => {
if (isPackagePath(import_record.path.text)) {
if (this.bundler.options.platform.isWebLike() and options.ExternalModules.isNodeBuiltin(import_record.path.text)) {
- try this.log.addResolveError(
+ try log.addResolveErrorWithTextDupe(
&source,
import_record.range,
this.allocator,
@@ -1236,7 +1250,7 @@ pub fn NewBundler(cache_files: bool) type {
import_record.kind,
);
} else {
- try this.log.addResolveError(
+ try log.addResolveErrorWithTextDupe(
&source,
import_record.range,
this.allocator,
@@ -1246,7 +1260,7 @@ pub fn NewBundler(cache_files: bool) type {
);
}
} else {
- try this.log.addResolveError(
+ try log.addResolveErrorWithTextDupe(
&source,
import_record.range,
this.allocator,
@@ -1480,7 +1494,7 @@ pub fn NewBundler(cache_files: bool) type {
scan_pass_result,
opts,
bundler.options.define,
- this.log,
+ log,
&source,
);
@@ -1521,7 +1535,7 @@ pub fn NewBundler(cache_files: bool) type {
error.ModuleNotFound => {
if (isPackagePath(import_record.path.text)) {
if (this.bundler.options.platform.isWebLike() and options.ExternalModules.isNodeBuiltin(import_record.path.text)) {
- try this.log.addResolveError(
+ try log.addResolveErrorWithTextDupe(
&source,
import_record.range,
this.allocator,
@@ -1530,7 +1544,7 @@ pub fn NewBundler(cache_files: bool) type {
import_record.kind,
);
} else {
- try this.log.addResolveError(
+ try log.addResolveErrorWithTextDupe(
&source,
import_record.range,
this.allocator,
@@ -1540,7 +1554,7 @@ pub fn NewBundler(cache_files: bool) type {
);
}
} else {
- try this.log.addResolveError(
+ try log.addResolveErrorWithTextDupe(
&source,
import_record.range,
this.allocator,