How do I make parcel inline sourcemaps? - parceljs

By default parcel put source map in a separate file. How do I tell parcel to put source map in the same output file? I guess it is called inline source maps?

See this section of the documentation: https://parceljs.org/features/targets/#sourcemap.
In your package.json, add the following:
{
"targets": {
"default": {
"sourceMap": {
"inline": true
}
}
}
}
Note that you may need to change "default" to match your own target name, if you've configured other options.

Related

How to use partial match on vscode-icons

I trying to add custom icons on vscode-icons.
Unfortunately my project file names have not extension naming rule.
They just end with '*Style.tsx' like 'ButtonStyle.tsx' or 'BoxStyle.tsx'
// this not work
{
"icon": "styled-components",
"format": "png",
"filenamesGlob": ["*Style", "*style"],
"extensionsGlob": ["tsx", "ts"],
"filename": true,
}
I noticed that vscode-icons not support regex.
Is there any other way without renaming files?
Thanks

How to overwrite parameter of Data Factory in Azure DevOps Pipeline? - Empty space in ARM Template cause errors?

I'm trying to add parameter in Azure Data Factory so that I can overwrite parameter value for each Dev, Test and Prod environment. Currently I have set static string in DevOps Release as parameter value.
However I get strange errors from Azure DevOps.
I wonder why Data Factory save parameter name as "Web pipeline_properties_parameters_LogicAppURL_defaultValue", which has empty space after Web.
Have edited "ARM Template"->"Edit parameter configuration" and published parameter:
"Microsoft.DataFactory/factories/pipelines": {
"properties": {
"parameters": {
"LogicAppURL": {
"defaultValue": "="
}
}
}
ARMTemplateParametersForFactory.json in Git Repo:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"factoryName": {
"value": "my-warehouse-dev-df"
},
"Web pipeline_properties_parameters_LogicAppURL_defaultValue": {
"value": "http://www.devpipeline.fi"
}
}
}
Error when creating release:
The detected encoding for file 'D:\a\r1\a\_Azure Data
Factory DevOps-CI\drop\ARMTemplateForFactory.json' is 'utf-8'
The detected encoding for file 'D:\a\r1\a\_Azure Data
Factory DevOps-CI\drop\ARMTemplateParametersForFactory.json' is 'utf-8'
There was an error while overriding 'Web' parameter
because of 'TypeError: Cannot read property 'type' of undefined', make sure it
follows JavaScript Object Notation (JSON)
There was an error while overriding '' parameter
because of 'TypeError: Cannot read property 'type' of undefined', make sure it
follows
JavaScript Object Notation (JSON)
Starting template validation.
Deployment name is ARMTemplateForFactory-20211220-162118-0e5d
There were errors in your deployment. Error code:
InvalidDeploymentParameterKey.
##[error]One of the deployment parameters has an empty
key. Please see https://aka.ms/resource-manager-parameter-files for details.
This is a known issue. As the error says, try to edit the parameter name as below.
However, placing it between " " should have sufficed.
"Web_pipeline_properties_parameters_LogicAppURL_defaultValue"
Also, if you would want to leave the parameter value empty by default, you can set as below:
"Microsoft.DataFactory/factories/pipelines": {
"properties": {
"parameters": {
"LogicAppURL": {
"defaultValue": {}
}
}
}
And while overriding template parameter, use:
-param "value"

How can I select a part of TM_DIRECTORY variable?

I want to select a part of the TM_DIRECTORY variable on VScode snippet. I mean I want to select Tests\Setup of the d:\Projects\Hakhsin\hakhsin\tests\Setup in code-snippet file. Look at this:
// On snippet file
"PHP Class": {
"scope": "",
"prefix": ["phpClass"],
"body": [
"<?php\n\nnamespace ${TM_DIRECTORY/(?<=(?:[\w:\\]hakhsin\\)).+(?=\\)//};\n\nclass ${TM_FILENAME_BASE} {\n\t$2\n}"
],
"description": "New PHP Class"
},
And I want to get this result:
namespace Tests\Setup;
class StorageFactory {
}
But I get this result:
<?php
namespace d:\Projects\Hakhsin\hakhsin\tests\Setup;
class StorageFactory {
}
It doesn't appear you can use variables inside of other variables in a snippet transform.
You can try this code which is more "dynamic" than yours but not perfect:
"${TM_DIRECTORY/([^\\\\]*\\\\){4}(.*)/${2:/capitalize}/}",
The {4} in that is if you have 4 segments in the directory structure before the part you want, like d:\Projects\Hakhsin\hakhsin\tests\Setup The segments are d:\, Projects\, Hakhsin\ and hakhsin\. If that number of segments is known and stable than the snippet I showed works well.
I doubt the number of those segments would vary within a project but might very well between projects - you would just have to change the {x} item for each project if so.
I solved it but it is not dynamic.
namespace ${TM_DIRECTORY/(.*hakhsin\\\\)(.*)/${2:/capitalize}/};
Is there a better way? anything like this:
namespace ${TM_DIRECTORY/(.*${WORKSPACE_NAME}\\\\)(.*)/${2:/capitalize}/};
This is the result:
<?php
namespace Tests\Setup;
class StorageFactory {
}

Add tasks to tasks.json for users of a vscode extension

I am writing a vscode extention for a specification language. I would like to provide the users of the plugin with a specific task. The task could be made available using tasks.json.
Is there a way to add tasks to the tasks.json of a user that uses that extension?
The documentation didn't help me here either. When you provide tasks through the extension there is the TaskProvider API. The example doesn't go into much detail about how these tasks are created though, compared to the classical tasks.json approach.
In your package.json you need to define the types of tasks this extension contributes. This has nothing to do with the type in tasks.json. It's rather a freeform string. If you need custom problem matchers you also need to define theme here.
"contributes": {
"taskDefinitions": [
{
"type": "mytask"
}
],
"problemMatchers": [
{
"name": "mywarnings",
"base": "$gcc",
"fileLocation": [
"relative",
"/"
]
}
]
},
In extension.ts you need to provide the tasks. Say we have an array of vscode.Task in tasks you can do:
vscode.tasks.registerTaskProvider('mytask', {
provideTasks: () => {
return tasks;
},
resolveTask(_task: vscode.Task): vscode.Task | undefined {
// as far as I can see from the documentation this just needs to return undefined.
return undefined;
}
});
If you want to create a shell task you need the following:
new vscode.Task (
{type: 'shell'}, // this is the same type as in tasks.json
ws, // The workspace folder
'name', // how you name the task
'MyTask', // Shows up as MyTask: name
new vscode.ShellExecution(command),
["mywarnings"] // list of problem matchers (can use $gcc or other pre-built matchers, or the ones defined in package.json)
);
I hope this helps. The bigges issue I see is the overloading of various names (like type), and that the format in tasks.json is completely different to the way tasks are built with TaskProvider API.

What is the difference between sap.ui.core.routing.Router.navTo() and sap.m.routing.Targets.display()?

Let’s say we I have one route and one target:
"routes": [{
"pattern": "modify",
"name": "modify",
"target": [
"master",
"modify"
]
}],
"targets": {
"modify": {
"viewName": "Modify",
"viewId": "modify",
"viewLevel": 2
}
}
So I can access the route by this.getRouter().navTo("modify"), meanwhile I can access the target by this.getRouter().getTargets().display("modify"). Both API can carry parameter by the second argument. It seems to achieve the same effect.
I can access target without defining a route for it. So I did not quite understand why I need a route?
Ref: sap.m.routing.Targets and
sap.ui.core.routing.Router
display displays the target view without changing the hash value in contrast to navTo.
You can find more information in the tutorial "Display a Target Without Changing the Hash".
Both API can carry parameter by the second argument. It seems to achieve the same effect.
The data in display method is for the display event handler. When the event is fired, the handler carries the data we passed earlier.
The parameter map we can pass to navTo is mandatory if the pattern actually awaits a parameter, e.g. if we've defined the pattern like this initially: "pattern": "modify/{id}". Check out "Navigate to Routes with Mandatory Parameters".
Just complement Boghyon's answer:
Route pattern is defined in Router, and hash is set in Router. That's the main difference.BTW, UI5 uses crossroads and hasher to help implementing router.
navTo() in sap.m.routing.Router is borrowed from sap.ui.core.routing.Router
display() in sap.m.routing.Targets is borrowed from sap.ui.core.routing.Targets
in _routeMatched of Route, oRouter._oTargets._display is called. So _display is called in both Router and Targets.
The parameter they use are different.navTo use Route name, and display use Target name. Sometimes they are defined the same.
onToPage2 : function () {
// this.getOwnerComponent().getRouter().navTo("pageRoute2");
this.getOwnerComponent().getRouter().getTargets().display("pageTarget2");
},
onToPage1 : function () {
this.getOwnerComponent().getRouter().navTo("pageRoute1");
// this.getOwnerComponent().getRouter().getTargets().display("pageTarget1");
}