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
[Bug]: RangeError: Invalid string length #16077
Comments
Hey @Lookout-ent! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite. |
sorry the input is : |
This is surprising because With |
Ush, we add way too much indentation 😬 These are the first few lines of the generated file: "undefined" === typeof Aura && (Aura = {}); Aura.bootstrap || (Aura.bootstrap = {}); Aura.frameworkJsReady || (Aura.ApplicationDefs = { cmpExporter: {}, libExporter: {} }, $A = { componentService: { addComponent: function (a, b) { Aura.ApplicationDefs.cmpExporter[a] = b; }, addLibraryExporter: function (a, b) { Aura.ApplicationDefs.libExporter[a] = b; }, initEventDefs: function (a) { Aura.ApplicationDefs.eventDefs = a; }, initLibraryDefs: function (a) { Aura.ApplicationDefs.libraryDefs = a; }, initControllerDefs: function (a) { Aura.ApplicationDefs.controllerDefs = a; }, initModuleDefs: function (a) { Aura.ApplicationDefs.moduleDefs = a; } } }); $A.componentService.addLibraryExporter("js://one.centerStageLibrary.Context", function () {/*$A.componentService.addLibraryInclude("js://one.centerStageLibrary.Context",[],function(){return{isSalesforceNativeDesktop:function(a){return a.get("m.isSalesforceNativeDesktop")},isNativeContainer:function(){return"sfNativeBridge"in window},isMasterDetailPanelSupported:function(a){return a.get("m.isMasterDetailEnabled")}}});*/}); $A.componentService.addLibraryExporter("js://one.centerStageLibrary.DefType", function () {/*$A.componentService.addLibraryInclude("js://one.centerStageLibrary.DefType",[],function(){return{getDefType:function(a){return!a?null:0===a.indexOf("e.")?"event":0===a.indexOf("/")?"route":"component"},isEventDef:function(a){return"event"===this.getDefType(a)},isRouteDef:function(a){return"route"===this.getDefType(a)}}});*/}); $A.componentService.addLibraryExporter("js://one.centerStageLibrary.URL", function () {/*$A.componentService.addLibraryInclude("js://one.centerStageLibrary.URL",[],function(){return{getSiteUrlPrefix:function(a){return a.get("m.siteUrlPrefix")},_getPathNameWithoutPrefix:function(a){var b=window.location.pathname;return $A.util.isUndefinedOrNull(b)?"":$A.util.isUndefinedOrNull(a)?b:0===b.indexOf(a)?b.substring(a.length):b},_getUrlWithSitePrefix:function(a,b){return $A.util.isUndefinedOrNull(a)||$A.util.isUndefinedOrNull(b)||0!==a.indexOf("/")||0===a.indexOf(b)?a:b+a},getFullSiteURLWithQuery:function(a){a=
a.get("m.fullSiteURLAction").executionComponent.attributes.url;return-1!=a.indexOf("?")?a:null},getFullSiteURL:function(a){a=a.get("m.fullSiteURLAction").executionComponent.attributes.url;var b=a.indexOf("?");return a.slice(0,b)}}});*/}); $A.componentService.addLibraryExporter("js://one.centerStageLibrary.RouteToComponentMapping", function () {/*$A.componentService.addLibraryInclude("js://one.centerStageLibrary.RouteToComponentMapping",[],function(){function g(a){return $A.util.isUndefinedOrNull(a)?[]:a.split("?")}function h(a,c){return a.replace(/{([^{}]{0,})}/g,function(a,e){var b=c[e];return"string"===typeof b||"number"===typeof b?b:a})}var f=function(a,c,d){this.routeDef=a;this.componentDef=c;this.componentAttributes=!$A.util.isEmpty(d)?d:{};this.routeParamsSortedList=this.getParameterNamesFromRouteDefinition(a);this.routeRegExp=this.getRegexpFromRouteDefinition(a);
this.optionalAttributes=this.getOptionalParameterMapFromRouteDefinition(a)},k=/\{([a-zA-Z][a-zA-Z0-9-]{0,})\}|\([^\(\)]+\)/g;f.prototype.getParameterNamesFromRouteDefinition=function(a){a=g(a);for(var c,d=[];$A.util.isArray(c=k.exec(a[0]));)$A.util.isString(c[1])?d.push(c[1]):d.push(""+d.length);return d};f.prototype.getRegexpFromRouteDefinition=function(a){-1<a.indexOf("?")&&(a=g(a)[0]);"/"===a[a.length-1]&&(a=a.substr(0,a.length-1));a=a.replace(/\{[a-zA-Z][a-zA-Z0-9-]{0,}\}/g,"([._a-zA-Z0-9-]+)");
return RegExp("^"+a+"(?:/?$)")};f.prototype.getOptionalParameterMapFromRouteDefinition=function(a){a=g(a);if(2>a.length)return{};var c={},d;a[1].split("\x26").forEach(function(a){d=a.split("\x3d");a=d[0];var b;b=d[1];b=$A.util.isUndefinedOrNull(b)?"":b.replace(/\{|\}/g,"");c[a]=b});return c};f.prototype.match=function(a){a=a.split("?")[0];return this.routeRegExp.test(a)};f.prototype.parseRoute=function(a){a=a.split("?");var c=a[1]||"";a=a[0];if(this.match(a)){a=this.routeRegExp.exec(a);var d;if(c.length){d=
{};for(var c=c.split("\x26"),e,b,f=0;f<c.length;f++)b=c[f],e=b.indexOf("\x3d"),-1===e?d[b]=void 0:d[b.substring(0,e)]=decodeURIComponent(b.substring(e+1))}else d={};e={};c=this.optionalAttributes;for(b=1;b<a.length;b++)e[this.routeParamsSortedList[b-1]]=a[b];a=JSON.parse(h(this.componentAttributes,e));for(var g in c)e=c[g],b=g,c.hasOwnProperty(b)&&(d.hasOwnProperty(e)&&!$A.util.isEmpty(d[e]))&&(a[b]=d[e]);return{componentDef:this.componentDef,attributes:a,t:d.t||0}}};return{RouteToComponentMapping:f}});*/}); $A.componentService.addLibraryExporter("js://one.centerStageLibrary.Router", function () {/*$A.componentService.addLibraryInclude("js://one.centerStageLibrary.Router",["js://one.centerStageLibrary.RouteToComponentMapping"],function(h){function b(a,c,k,b,e){var g=$A.util.isObject(a),d=g?a:{};g||(d.path=a,d.routeDef=c,d.componentDef=k,d.componentAttributes=b,d.childRoutes=e);this.config=d;this.path=d.path;this.childRoutes=[]}var l=h.RouteToComponentMapping;b.prototype.initRoutes=function(){if(this.isInitialized)return this;var a=this.config,c=a.childRoutes||[];if(this.hasCmpMapping=!($A.util.isEmpty(a.routeDef)||
$A.util.isEmpty(a.componentDef)||$A.util.isUndefinedOrNull(a.componentAttributes)))this.routeToComponentMapping=new l(a.routeDef,a.componentDef,a.componentAttributes);$A.util.forEach(c,function(a){this.childRoutes.push(new b(a))},this);this.isInitialized=!0;return this};b.prototype.appendRoute=function(a){this.childRoutes.push(a);return this};b.prototype.prependRoute=function(a){this.childRoutes.unshift(a);return this};b.prototype.match=function(a){this.isInitialized||this.initRoutes();if(this.hasCmpMapping&&
this.routeToComponentMapping.match(a))return[this];if(!a||!(0<a.length&&0===a.indexOf(this.path)))return!1;if(a.length===this.path.length)return[this];a=this.isPassthrough?a:a.substring(this.path.length);0===a.indexOf("/")&&(a=a.substring(1));a=this.matchChildren(a);$A.util.isArray(a)&&a.unshift(this);return a};b.prototype.matchChildren=function(a){this.isInitialized||this.initRoutes();for(var c,b=0;b<this.childRoutes.length;b++)if((c=this.childRoutes[b].match(a))&&0<c.length)return c;return[]};b.prototype.parseRoute= |
when can we expect the release for this ? |
I can release later today |
waiting for the release |
Sorry I forgot, doing it right now — it will take ~15 minutes. |
no issue ... thanks for the update |
💻
How are you using Babel?
@babel/eslint-parser
Input code
Configuration file name
No response
Configuration
No response
Current and expected behavior
RangeError: Invalid string length
at Buffer._append (cc.proxy.js:29347:20)
at Buffer.append (cc.proxy.js:29291:10)
at Generator._append (cc.proxy.js:33671:15)
at Generator._printComment (cc.proxy.js:34026:10)
at Generator._printComments (cc.proxy.js:34073:16)
at Generator.printInnerComments (cc.proxy.js:33936:10)
at Generator._maybePrintInnerComments (cc.proxy.js:33924:38)
at Generator.tokenChar (cc.proxy.js:33593:10)
at Generator.rightBrace (cc.proxy.js:33550:10)
at Generator.BlockStatement (cc.proxy.js:29563:8)
Environment
System:
OS: Windows 10 10.0.19045
Binaries:
Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
npm: 8.1.0 - C:\Program Files\nodejs\npm.CMD
npmPackages:
@babel/generator: ^7.22.10 => 7.23.0
@babel/parser: ^7.22.13 => 7.23.0
webpack: ^5.88.2 => 5.88.2
Possible solution
No response
Additional context
I am parsing the input and then simply generating the code.
I observed that when i don't have
concise:true,
option in generator then i'm not seeing the errorThe text was updated successfully, but these errors were encountered: