mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
Plugin Repo: Add support for source maps
This commit is contained in:
parent
780f2ea12b
commit
bc9dac2feb
@ -41,6 +41,8 @@ async function getPluginInfos(pluginRepoDir: string): Promise<PluginInfo[]> {
|
|||||||
|
|
||||||
for (const pluginDir of pluginDirs) {
|
for (const pluginDir of pluginDirs) {
|
||||||
const basePath = `${pluginRepoDir}/plugins/${pluginDir}`;
|
const basePath = `${pluginRepoDir}/plugins/${pluginDir}`;
|
||||||
|
if (!(await stat(basePath)).isDirectory()) continue;
|
||||||
|
|
||||||
const manifest = JSON.parse(await readFile(`${basePath}/manifest.json`, 'utf8'));
|
const manifest = JSON.parse(await readFile(`${basePath}/manifest.json`, 'utf8'));
|
||||||
output.push({
|
output.push({
|
||||||
id: manifest.id,
|
id: manifest.id,
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
require('source-map-support').install();
|
||||||
|
|
||||||
import * as fs from 'fs-extra';
|
import * as fs from 'fs-extra';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as process from 'process';
|
import * as process from 'process';
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
"fs-extra": "^9.0.1",
|
"fs-extra": "^9.0.1",
|
||||||
"gh-release-assets": "^2.0.0",
|
"gh-release-assets": "^2.0.0",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
|
"source-map-support": "^0.5.21",
|
||||||
"yargs": "^16.0.3"
|
"yargs": "^16.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -30,6 +31,7 @@
|
|||||||
"@types/jest": "^26.0.15",
|
"@types/jest": "^26.0.15",
|
||||||
"@types/node": "^14.14.6",
|
"@types/node": "^14.14.6",
|
||||||
"jest": "^26.6.3",
|
"jest": "^26.6.3",
|
||||||
|
"source-map-loader": "^3.0.0",
|
||||||
"typescript": "4.1.3",
|
"typescript": "4.1.3",
|
||||||
"webpack": "^5.65.0",
|
"webpack": "^5.65.0",
|
||||||
"webpack-cli": "^4.9.1"
|
"webpack-cli": "^4.9.1"
|
||||||
|
@ -3,10 +3,19 @@ const webpack = require('webpack');
|
|||||||
|
|
||||||
const distDir = path.resolve(__dirname, 'dist');
|
const distDir = path.resolve(__dirname, 'dist');
|
||||||
|
|
||||||
|
// To get source maps working:
|
||||||
|
//
|
||||||
|
// - Need to add `require('source-map-support').install()` on top of index.ts
|
||||||
|
// - Set `devtool: 'source-map'`
|
||||||
|
// - It only works in development mode
|
||||||
|
// - Need to add the "source-map-loader" rule so that it uses the maps generated
|
||||||
|
// by TypeScript
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: './index.js',
|
entry: './index.js',
|
||||||
mode: 'production',
|
mode: 'development',
|
||||||
target: 'node',
|
target: 'node',
|
||||||
|
devtool: 'source-map',
|
||||||
output: {
|
output: {
|
||||||
filename: 'index.js',
|
filename: 'index.js',
|
||||||
path: distDir,
|
path: distDir,
|
||||||
@ -17,4 +26,13 @@ module.exports = {
|
|||||||
raw: true,
|
raw: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.js$/,
|
||||||
|
enforce: 'pre',
|
||||||
|
use: ['source-map-loader'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
24
yarn.lock
24
yarn.lock
@ -3194,6 +3194,8 @@ __metadata:
|
|||||||
gh-release-assets: ^2.0.0
|
gh-release-assets: ^2.0.0
|
||||||
jest: ^26.6.3
|
jest: ^26.6.3
|
||||||
node-fetch: ^2.6.1
|
node-fetch: ^2.6.1
|
||||||
|
source-map-loader: ^3.0.0
|
||||||
|
source-map-support: ^0.5.21
|
||||||
typescript: 4.1.3
|
typescript: 4.1.3
|
||||||
webpack: ^5.65.0
|
webpack: ^5.65.0
|
||||||
webpack-cli: ^4.9.1
|
webpack-cli: ^4.9.1
|
||||||
@ -27023,6 +27025,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"source-map-js@npm:^0.6.2":
|
||||||
|
version: 0.6.2
|
||||||
|
resolution: "source-map-js@npm:0.6.2"
|
||||||
|
checksum: 9c8151a29e00fd8d3ba87709fdf9a9ce48313d653f4a29a39b4ae53d346ac79e005de624796ff42eff55cbaf26d2e87f4466001ca87831d400d818c5cf146a0e
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"source-map-js@npm:^1.0.1":
|
"source-map-js@npm:^1.0.1":
|
||||||
version: 1.0.1
|
version: 1.0.1
|
||||||
resolution: "source-map-js@npm:1.0.1"
|
resolution: "source-map-js@npm:1.0.1"
|
||||||
@ -27030,6 +27039,19 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"source-map-loader@npm:^3.0.0":
|
||||||
|
version: 3.0.0
|
||||||
|
resolution: "source-map-loader@npm:3.0.0"
|
||||||
|
dependencies:
|
||||||
|
abab: ^2.0.5
|
||||||
|
iconv-lite: ^0.6.2
|
||||||
|
source-map-js: ^0.6.2
|
||||||
|
peerDependencies:
|
||||||
|
webpack: ^5.0.0
|
||||||
|
checksum: c4459cef5a43917ca1c7ad53b106ba715d545daae1ace259c867c36b2b2443c3b9eebe8630cac8f193760db39965c22d1b44d8f69e9910b88c8aca1c836757b5
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"source-map-resolve@npm:^0.5.0, source-map-resolve@npm:^0.5.2":
|
"source-map-resolve@npm:^0.5.0, source-map-resolve@npm:^0.5.2":
|
||||||
version: 0.5.3
|
version: 0.5.3
|
||||||
resolution: "source-map-resolve@npm:0.5.3"
|
resolution: "source-map-resolve@npm:0.5.3"
|
||||||
@ -27062,7 +27084,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"source-map-support@npm:^0.5.13, source-map-support@npm:^0.5.16, source-map-support@npm:^0.5.19, source-map-support@npm:^0.5.6, source-map-support@npm:~0.5.20":
|
"source-map-support@npm:^0.5.13, source-map-support@npm:^0.5.16, source-map-support@npm:^0.5.19, source-map-support@npm:^0.5.21, source-map-support@npm:^0.5.6, source-map-support@npm:~0.5.20":
|
||||||
version: 0.5.21
|
version: 0.5.21
|
||||||
resolution: "source-map-support@npm:0.5.21"
|
resolution: "source-map-support@npm:0.5.21"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
Loading…
Reference in New Issue
Block a user