Commit Graph

49 Commits

Author SHA1 Message Date
Nayeem Rahman
fa3d65cd58
fix(strip): Transform static class fields to assignments (#1487)
swc_ecam_transforms_compat:
 - Deprecate `typescript_class_properties`.

swc_ecma_tranforms_typescript:
 - Merge `typescript_class_properties` into `strip`.

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-03-26 13:48:55 +09:00
강동윤
c047e0e54d
fix(bundler): Fix bundler (#1427)
swc_bundler:
 - Create variables for export while preparing a module. (denoland/deno#9560)
 - Fix order of statements.
 - Invoke dce multiple time if required. (denoland/deno#9546)

swc_ecma_transforms_optimization:
 - dce: Track modifications correctly.
2021-02-26 18:21:42 +09:00
강동윤
7f5bfdcc00
fix(bundler): Fix bugs (#1382)
swc_bundler:
 - Improve performance
 - Use `Vec<AHashSet<usize>>` instead of `AHashSet<(usize, usize)>`.
 - Fix statement orderings. (denoland/deno#9464) 
 - Fix wrapped esm mixed with circular imports. (denoland/deno#8224)
 - Store content of wrapped esm at top level. (denoland/deno#8224)
2021-02-22 17:27:40 +09:00
강동윤
9dabf00200
fix(es): Fix bugs (#1395)
swc_ecma_codegen:
 - Implement `emit_ts_type_assertion`.
 - Implement `emit_ts_type_cast_expr`. 
 - Implement `emit_ts_ns_export_decl`.
 - Implement `emit_ts_signature_decl`.

swc_ecma_parser:
 - Ensure that we report an error for invalid input. (#1391)

swc_ecma_transforms_base:
 - fixer: Handle `await (await foo)()`. (#1397)
2021-02-14 22:18:05 +09:00
강동윤
bf445a75c4
fix(swc): Fix bugs (#1372)
swc_ecma_ast:
 - Support import assertions for exports.

swc_ecma_parser:
 - Support import assertions for exports.

swc_ecma_transform_typescript:
 - Strip `declare globals` correctly. (#1383)

spack:
 - Re-enable multi-entry tests.
2021-02-10 17:25:28 +09:00
강동윤
af25a88902
fix(swc): Fix bugs for v1.2.47 (#1368)
swc_ecma_parser:
 - Fix generic parsing issue in jsx context. (#1299)

swc_ecma_transforms_module:
 - Allow importing a module multiple time. (#1232)
 - Handle imports in the constructor of an exported class decl. (#1213)

swc:
 - Respect `sourceMappingURL`. (#1236)
 - Resolve `sourceMappingURL` relative from file. (#1255)
 - Respect `isModule: false` (#1258)

spack:
 - Support loading json files. (#1225)
2021-01-29 22:19:04 +09:00
강동윤
947161b43b
fix(bundler): Fix bugs (#1349)
swc_bundler:
 - Fix deglobbing of imports. (denoland/deno#8985)
 - Use correct syntax context while deglobbing imports. (denoland/deno#9212)
 - Allow reexporting from wrapped esms. (denoland/deno#8959, denoland/deno#9200)
 - Fix statement orderings. (denoland/deno#9250)
 - Emit injected items as early as possible. (denoland/deno#9250)
 - Respect `external_modules`. (#1338)
 - Fix cjs suppport. (#1328)

swc_ecma_transforms_base:
 - hygiene: Fix for hoisting. (denoland/deno#9212)
2021-01-25 21:15:42 +09:00
강동윤
17f17e82e6
fix(bundler): Fix bugs (#1342)
swc_bundler:
 - Add a testing system for constant inliner.

swc_ecma_transforms_optimization:
 - const_propagation: Handle export specifiers.
 - const_propagation: Handle inlining of variables whose initializer is inlined.
 - dce: Allow dropping identifiers used in `exported` part of export specifiers.
2021-01-20 16:10:12 +09:00
강동윤
23aebacade
fix(bundler): Fix bundler (#1318)
swc_bundler:
 - Use two-context system properly.
 - Remove old logic.
 - keywords: Handle assignment pattern property.
 - keywords: Handle shorthand property.
 - keywords: Handle identifiers in declarations.

swc_ecma_transforms_typescript:
 - Do not remove import if there's non-type usage. (Related to denoland/deno#8978)

swc_ecma_transforms_optimization:
 - dce: Handle new expression correctly.
2021-01-11 19:38:20 +09:00
강동윤
ba13db54db
fix(bundler): Fix remaining bugs (#1296)
swc_bundler:
 -  Allow `export *` and `import` from same source. (denoland/deno#8828, denoland/deno#8725)
 -  Handle contextual keywords. (denoland/deno#8680)
 -  Prevent duplicated identifiers. (denoland/deno#8725)

swc_ecma_transforms:
 - dce: Preserve tags in tagged template literals. (denoland/deno#8746)
 - dce: Handle throw statement correctly. (denoland/deno#8736)
2020-12-28 19:53:40 +09:00
강동윤
b66ee58ee3
fix(bundler): Fix statement ordering issue (#1264)
swc_bundler:
 - Reduce binary size by reducing usage of visitor / folders.
 - Handle `export *` and `export { default }` from same source. (denoland/deno#8530, denoland/deno#8679)
 - Fix ordering of statements. (denoland/deno#8545)
 - Sort statements in wrapped modules. (https://github.com/denoland/deno/issues/8211#issuecomment-741070299)
 - Exclude default export while handling `export *`.
 - Exclude `export { default }` and `export { foo as default }` while handling `export *`.
 - Make statements from same module to be injected together. (denoland/deno#8620)

swc_ecma_transforms:
 - fixer: Handle assignments in the callee of `new`  correctly.
 - fixer: Handle seqence expression in the callee of `new`  correctly.
2020-12-27 19:02:41 +09:00
강동윤
8a8db58f1c
fix(ecmascript): Fix bugs related to string literals (#1287)
swc_ecma_ast:
 - Add `Str.kind`.

swc_ecma_transforms:
 - Fix quotes in template literals. (#1280)

swc_ecma_codegen:
 - Fix escape of single quotes. (#1259)
 - Fix codegen of wrong escapes. (#1276)

swc:
 - Ensure that #1271 is about napi's deserialization.
2020-12-22 04:27:18 +09:00
강동윤
2e29d78281
fix: Decorator metadata (#1248)
swc_ecma_transforms:
 - Emit proper typename for `design:type` used with enum. (#1160)
2020-12-04 05:03:26 +09:00
강동윤
19cbdc34ff
Fix bundler (#1245)
swc_bundler:
 - Handle `default` while merging reexports. (https://github.com/denoland/deno/issues/8211#issuecomment-736498065)
2020-12-02 14:51:54 +09:00
강동윤
6888c69bda
Fix codegen: preserve input (#1221)
swc_ecma_codegen:
 - Preserve input. (#1204)
2020-11-21 02:04:29 +09:00
강동윤
4294b5e7ba
bundler: Fix issues (#1212)
swc_bundler:
 - Bundler rework. (denoland/deno#6802)
 - Reexports are not transitive. (denoland/deno#8246)
 - Dependencies of module with circular dependency. (denoland/deno#8302)
 - Order of injection between import vs export. (denoland/deno#8302)
 - `export *` in wrapped modules. (denoland/deno#8308, denoland/deno#8399)
 - `export { a as b }` in wrapped modules.
 - Fix denoland/deno#8314.
 - Fix denoland/deno#8325.
 - Fix denoland/deno#8344.
 - Make deno test verify exported names. 
 - Handle `export * from './foo'`.

swc_ecma_parser:
 - Don't panic on private name in interface (Closes #1211)

swc_ecma_transforms:
 -  dce: Prevent infinite loop
 -  Faster constant propagation pass.
2020-11-19 20:42:56 +09:00
강동윤
c6cfa9d73f
Fix bundler: stack overflow and circular imports (#1205)
swc_bundler:
 - Fix infinte loop (denoland/deno#8224)
 - Fix order of merging with circular imports. (Fixes denoland/deno#8246)
 - Fix detection of circular imports.
 - Fix logic of lca calculation.
 - Fix sorting algorithm.
2020-11-06 18:42:04 +09:00
강동윤
0a5e23f97c
bundler: Handle swc helpers (#1199)
swc_bundler:
 - Handle helpers from `swc_ecma_transforms`.

swc_ecma_transforms:
 - dce: Remove unused self-referential functions.
2020-11-05 09:53:18 +09:00
Nayeem Rahman
64942b5006
bundler: Use a local variable for import.meta (#1201)
swc_bundler:
 - Convert `import.meta` into a local variable.
2020-11-04 18:34:05 +09:00
Nayeem Rahman
3cdb62bfd8
bundler: Improve hook for import.meta (#1195)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-11-02 15:22:21 +09:00
강동윤
b2aec35eb6
Fix issues (#1189)
swc_bundler:
 - Support emitting iife. (Closes #1184)

swc_ecma_parser:
 - Auto-detect script / module (Closes #1164)
 - lexer: Error recovery for strict mode and module mode.
 - More error recovery logic for strict mode violation.
 - Fix panic on invalid input. (Closes #1170)
2020-10-28 21:20:11 +09:00
강동윤
41d1738b82
bundler: Make output deterministic (#1166)
swc_bundler:
 - Make output deterministic
2020-10-16 18:02:42 +09:00
강동윤
ad7cb6544d
bundler: Handle computed accesses correctly (#1159)
swc_bundler:
 - Handle computed accesses to imports correctly.
 - Make planning deterministic.
 - Prefer exports over imports while planning.
 - Fix https://deno.land/x/oak@v6.3.1/examples/server.ts
2020-10-14 23:28:38 +09:00
강동윤
f0ea70cb25
bundler: Allow importing and exporting from same module (#1152)
swc_bundler:
 - Allow importing and exporting from same module. (#1150)
2020-10-09 19:10:25 +09:00
강동윤
75a6211e2d
Fix hygiene and bundler (#1144)
swc_bundler:
 - Change order of execution of modules with circular imports. (#1139)

swc_ecma_transforms:
 - hygiene: Fix handling of default in object patterns. (#1138)
2020-10-07 14:55:02 +09:00
강동윤
e4ddfcc899
export * as ns is part of ES2020 (#1142)
swc_bundler:
 - Add direct support for `export * as ns from 'foo';`. (#1137)

swc_ecma_transforms:
 - Split `export` pass to `export_namespace_from` and `export_default_from`.

swc:
 - Enable `export * as ns` for targets lower than es2020.
2020-10-06 20:48:29 +09:00
강동윤
c127cb2b48
bundler: fix bugs (#1141)
swc_bundler:
 - Handle aliased imports of reexports correctly. (#1138)
 - Fix import deglobber. (#1139)
2020-10-06 13:39:25 +09:00
강동윤
9879fa59c8
bundler: fix bugs (#1105)
swc_bundler:
 - Correct lca for circular dependencies.
 - Handle namespaced imports. (#1109)
 - Handle namespaced reexports. (#1110)
 - Handle shorthand properly. (#1111)
 - Implement `import.meta` (#1115)
 - Handle reexport mixed with imports correctly. (#1116)
 - Handle export default decls in computed-key modules. 
 - Remove all export * from. output. (#1118)
 - Handle export of class or function declaration in a computed module properly. (#1119)


swc_ecma_transforms:
 - Do not rename class members. (#1117)
2020-10-02 11:07:40 +09:00
강동윤
ab8df21797
Fix optional chaining in argument position (#1104) 2020-09-24 15:14:30 +09:00
강동윤
fa756a1b48
bundler: Handle export * properly (#1083) 2020-09-18 18:30:02 +09:00
강동윤
24c597f097
bundler: fix for deno (#1078)
swc_bundler:
 - Run fixer before returning bundles.
 - Fix planning of circular imports.
 - Support circular imports of root entries.
 - Remark properly while merging complex imports mixed with exports.
2020-09-17 21:05:47 +09:00
강동윤
1af1840d01
Fix swc_bundler (#1075)
swc_bundler:
 - Skip least_common_ancestor for roots.
 - Correct planning for circular imports mixed with normal imports.
 - Correct merging of circular imports mixed with normal imports.
2020-09-16 18:28:10 +09:00
강동윤
2fff66d985
codegen: Don't emit newline after a block comment (#1062) 2020-09-11 15:09:35 +09:00
강동윤
350973553a
Fix spack, third step (#1034)
swc_bundler:
 - Add support for common js modules
2020-09-07 20:36:17 +09:00
강동윤
468abb9832
Fix spack, second step (#1031)
swc_bundler:
 - Support almost all kind of imports / exports (except computed key access to an es module)
 - Parallelize processing of exports
2020-09-04 22:40:03 +09:00
강동윤
8a01e2b7b6
Fix spack (#1016)
swc_ecma_transforms:
 - Add tests for #898 
 - dce preserves `export * from 'foo';`

swc_bundler:
 - Fix some concurrency bugs
 - Run dce only once
 - Handle `export * from 'foo'`
 - Handle namespace imports with computed key
 - Add some unit tests for `plan`
 - Handle export default decl
 - Handle simple coomon dependencies properly
2020-09-03 22:45:42 +09:00
강동윤
decac0c052
Improve performance of spack (#981)
swc_bundler:
 - Invoke `LocalMark` less time
 - Use better strategy for parallel computing
2020-08-23 17:27:56 +09:00
강동윤
28398280f7
Improve spack (#972)
swd_bundler:
 - Handle reexports

spack:
 - Do not transform files from node_modules
2020-08-17 15:04:08 +09:00
강동윤
826b4f868e
Fix import of common js modules (#969)
spack:
 - Analyze require correctly
 - Properly merge common js modules 
 - Detect circular reference correctly
2020-08-15 17:19:17 +09:00
강동윤
8f0713a303
Drop fxhash (#970) 2020-08-15 01:47:28 +09:00
강동윤
655fc12fcb
Make spack respect swcrc (#964) 2020-08-14 21:02:39 +09:00
강동윤
2fedf32747
swc_bundler (#943)
swc_bundler:
 - Splitted from spack

swc_ecma_parser:
 - Fix unexpected eof problem which occurs if log level is trace

swc_ecma_transforms:
 - Fix bugs of dce pass

spack:
 - Support cyclic dependencies
2020-08-12 22:18:47 +09:00
강동윤
969fe6ec32
Spack (#937)
spack:
 - Always inline `NODE_ENV` before analyzing imports
 - implements conditional requires (#884)
2020-08-06 14:55:16 +09:00
강동윤
ca43112d2a
codegen: Preserve quotes (#911) 2020-07-28 21:56:19 +09:00
강동윤
ecd7b4decc
Implement more methods for codegen (#902)
swc_ecma_codegen:
 - implement emit_private_property (Closes #903)
2020-07-27 22:58:42 +09:00
강동윤
9b8bfb2455
Use stable rustc (#886) 2020-07-24 02:18:22 +09:00
강동윤
66d42adf7e
spack: modules (#848)
spack:
 - Better es6 module detection
 - Recursive merging
 - Support for common js modules
 - Support for node js core modules
 - Inject helpers

swc_ecma_transforms:
 - Fix dce
2020-06-17 23:48:34 +09:00
강동윤
31020e46d8
spack: enhancement (#845)
- Handle modules (via swcrc)
 - swc.bundle([conf1, conf2])
 - Correct chunking
2020-06-15 23:28:15 +09:00
강동윤
fcef201695
spack: super-fast bundler (#825)
Version is alpha as it's not complete
2020-06-13 23:09:45 +09:00