-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support detect and replace swc
's runtime-helpers
#50
Comments
swc
's runtime-helpers
(@swc/helpers
; _sliced_to_array, etc) like babel
's in unminify
's transformations
The above code (from the previous issue) imported from
|
The seemingly full list of And more about the
|
Looking at
Looking at the imports of the unminified source, we see: const { _: _$1 } = require(39324);
const { _: _$0 } = require(22830);
const { _ } = require(4337);
const { jsxs, jsx } = require(35250);
const { Z: Z$0 } = require(19841);
const l = require(70079);
const { useState, useCallback, useEffect } = l;
const u = require(34303);
const d = require(38317); Searching our webpacked code (Ref), we find these modules defined in the following locations:
Which we can unpack into their individual module files as follows: ⇒ cd ./unpacked/_next/static/chunks ⇒ npx @wakaru/unpacker main.js -o ./main-unpacked/
Generated 98 modules from main.js to main-unpacked (2,949.1ms)
⇒ npx @wakaru/unminify ./main-unpacked/* -o ./main-unminified
# ..snip.. ⇒ npx @wakaru/unpacker pages/_app.js -o ./pages/_app-unpacked/
Generated 213 modules from pages/_app.js to pages/_app-unpacked (24,049ms)
⇒ npx @wakaru/unminify ./pages/_app-unpacked/* -o ./pages/_app-unminified
# ..snip.. ⇒ npx @wakaru/unpacker framework.js -o ./framework-unpacked/
Generated 9 modules from framework.js to framework-unpacked (3,800.3ms)
⇒ npx @wakaru/unminify ./framework-unpacked/* -o ./framework-unminified
# ..snip..
|
main.js
|
The full list of Full list
Searching my webpacked code (Ref) for functions that have a similar format to the helpers: ⇒ find . -type f -exec grep -E '_[[:alnum:]_]+\s*:\s*function' {} +
# ..snip..
# These don't seem to be @swc/helpers related?
./653.js: __assign: function () {
./653.js: __asyncDelegator: function () {
./653.js: __asyncGenerator: function () {
./653.js: __asyncValues: function () {
./653.js: __await: function () {
./653.js: __awaiter: function () {
./653.js: __classPrivateFieldGet: function () {
./653.js: __classPrivateFieldIn: function () {
./653.js: __classPrivateFieldSet: function () {
./653.js: __createBinding: function () {
./653.js: __decorate: function () {
./653.js: __exportStar: function () {
./653.js: __extends: function () {
./653.js: __generator: function () {
./653.js: __importDefault: function () {
./653.js: __importStar: function () {
./653.js: __makeTemplateObject: function () {
./653.js: __metadata: function () {
./653.js: __param: function () {
./653.js: __read: function () {
./653.js: __rest: function () {
./653.js: __spread: function () {
./653.js: __spreadArray: function () {
./653.js: __spreadArrays: function () {
./653.js: __values: function () {
# ..snip..
# These don't seem to be @swc/helpers related?
./1f110208.js: __parse: function (e, t) {
./1f110208.js: __renderToHTMLTree: function (e, t) {
./1f110208.js: __setFontMetrics: function (e, t) {
./1f110208.js: __defineMacro: function (e, t) {
# ..snip..
# These do seem to be @swc/helpers related
./main.js: _async_to_generator: function () {
./main.js: _class_call_check: function () {
./main.js: _construct: function () {
./main.js: _create_class: function () {
./main.js: _create_super: function () {
./main.js: _inherits: function () {
./main.js: _interop_require_default: function () {
./main.js: _interop_require_wildcard: function () {
./main.js: _object_spread: function () {
./main.js: _object_spread_props: function () {
./main.js: _object_without_properties: function () {
./main.js: _sliced_to_array: function () {
./main.js: _to_consumable_array: function () {
./main.js: _ts_generator: function () {
./main.js: _type_of: function () {
./main.js: _wrap_native_super: function () {
# ..snip..
# These don't seem to be @swc/helpers related?
./pages/payments/success.js: __assign: function () {
./pages/payments/success.js: __asyncDelegator: function () {
./pages/payments/success.js: __asyncGenerator: function () {
./pages/payments/success.js: __asyncValues: function () {
./pages/payments/success.js: __await: function () {
./pages/payments/success.js: __awaiter: function () {
./pages/payments/success.js: __classPrivateFieldGet: function () {
./pages/payments/success.js: __classPrivateFieldIn: function () {
./pages/payments/success.js: __classPrivateFieldSet: function () {
./pages/payments/success.js: __createBinding: function () {
./pages/payments/success.js: __decorate: function () {
./pages/payments/success.js: __exportStar: function () {
./pages/payments/success.js: __extends: function () {
./pages/payments/success.js: __generator: function () {
./pages/payments/success.js: __importDefault: function () {
./pages/payments/success.js: __importStar: function () {
./pages/payments/success.js: __makeTemplateObject: function () {
./pages/payments/success.js: __metadata: function () {
./pages/payments/success.js: __param: function () {
./pages/payments/success.js: __read: function () {
./pages/payments/success.js: __rest: function () {
./pages/payments/success.js: __spread: function () {
./pages/payments/success.js: __spreadArray: function () {
./pages/payments/success.js: __spreadArrays: function () {
./pages/payments/success.js: __values: function () {
# ..snip.. For the And it looks like they are probably related to
|
The following relates to
|
swc
's runtime-helpers
(@swc/helpers
; _sliced_to_array, etc) like babel
's in unminify
's transformationsswc
's runtime-helpers
——
|
Spinning this out into a new issue so it doesn't get lost among the old one, but follow through to the original comment for more of the deep dive/evidence that lead to this being figured out:
See Also
microsoft/tslib
'sruntime-helpers
#55The text was updated successfully, but these errors were encountered: