Skip to content

Commit

Permalink
Implement Antora image ids resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
marieflorescontact committed Sep 7, 2022
1 parent e30084b commit d005696
Show file tree
Hide file tree
Showing 15 changed files with 1,540 additions and 255 deletions.
147 changes: 77 additions & 70 deletions extension-browser.webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,75 +5,82 @@ const CopyWebpackPlugin = require('copy-webpack-plugin')
const { DefinePlugin } = require('webpack')

module.exports = {
entry: {
extension: './src/extension.ts'
},
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
target: 'webworker', // extensions run in a webworker context
resolve: {
mainFields: ['browser', 'module', 'main'],
extensions: ['.ts', '.js'], // support ts-files and js-files
fallback: {
'fs': false, // do not include a polyfill,
'assert': false,
'unxhr': false,
'glob': false,
'http': false,
'https': false,
'url': false,
'zlib': false,
'os': false,
'child_process': false,
'crypto': false,
'stream': false,
'path': require.resolve('path-browserify'),
'util': false
}
},
module: {
rules: [{
test: /\.ts$/,
exclude: /node_modules/,
use: [{
// configure TypeScript loader:
// * enable sources maps for end-to-end source maps
loader: 'ts-loader',
options: {
compilerOptions: {
'sourceMap': true,
},
configFile: 'tsconfig.browser.json'
entry: {
extension: './src/extension.ts'
},
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
target: 'webworker', // extensions run in a webworker context
resolve: {
mainFields: ['browser', 'module', 'main'],
extensions: ['.ts', '.js'], // support ts-files and js-files
fallback: {
'fs': false, // do not include a polyfill,
'assert': false,
'unxhr': false,
'glob': false,
'http': false,
'https': false,
'url': false,
'zlib': false,
'os': false,
'child_process': false,
'crypto': false,
'stream': false,
'path': require.resolve('path-browserify'),
'util': false,
'querystring': require.resolve('querystring-es3'),
'tty': require.resolve('tty-browserify')
}
}]
}]
},
externals: {
'vscode': 'commonjs vscode', // ignored because it doesn't exist,
'applicationinsights-native-metrics': 'commonjs applicationinsights-native-metrics', // ignored because we don't ship native module
'@opentelemetry/tracing': 'commonjs @opentelemetry/tracing' // ignored because we don't ship this module
},
performance: {
hints: false
},
output: {
// all output goes into `dist`.
// packaging depends on that and this must always be like it
filename: '[name].js',
path: path.join(__dirname, 'dist', 'browser'),
libraryTarget: 'commonjs',
},
amd: false, // disable amd
// yes, really source maps
devtool: 'source-map',
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: 'src', to: '.', globOptions: { ignore: ['**/test/**', '**/*.ts'] }, noErrorOnMissing: true }
]
}),
new DefinePlugin({
'process.env': JSON.stringify({}),
'process.env.BROWSER_ENV': JSON.stringify('true')
})
]
},
module: {
rules: [{
test: /\.ts$/,
exclude: /node_modules/,
use: [{
// configure TypeScript loader:
// * enable sources maps for end-to-end source maps
loader: 'ts-loader',
options: {
compilerOptions: {
'sourceMap': true,
},
configFile: 'tsconfig.browser.json'
}
}]
}]
},
externals: {
'vscode': 'commonjs vscode', // ignored because it doesn't exist,
'applicationinsights-native-metrics': 'commonjs applicationinsights-native-metrics', // ignored because we don't ship native module
'@opentelemetry/tracing': 'commonjs @opentelemetry/tracing' // ignored because we don't ship this module
},
performance: {
hints: false
},
output: {
// all output goes into `dist`.
// packaging depends on that and this must always be like it
filename: '[name].js',
path: path.join(__dirname, 'dist', 'browser'),
libraryTarget: 'commonjs',
},
amd: false, // disable amd
// yes, really source maps
devtool: 'source-map',
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: 'src',
to: '.',
globOptions: { ignore: ['**/test/**', '**/*.ts'] },
noErrorOnMissing: true
}
]
}),
new DefinePlugin({
'process.env': JSON.stringify({}),
'process.env.BROWSER_ENV': JSON.stringify('true')
})
]
}
5 changes: 4 additions & 1 deletion i18n/fra/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"displayName": "AsciiDoc",
"description": "Facilite l'édition et la publication de documents AsciiDoc.",

"asciidoc.preview.title": "Prévisualisation",
"asciidoc.exportAsPDF.title": "Exporter le document en PDF",
"asciidoc.pasteImage.title" : "Coller l'image",
"asciidoc.preview.title": "Ouvrir la prévisualisation",
"asciidoc.showPreview.title": "Ouvrir la prévisualisation",
"asciidoc.preview.refresh.title": "Rafraîchir la prévisualisation",
"asciidoc.preview.toggleLock.title": "Verrouille/déverrouille la prévisualisation",
"asciidoc.previewSide.title": "Ouvrir la prévisualisation sur le côté",
Expand Down Expand Up @@ -71,5 +72,7 @@
"asciidoc.useWorkspaceRoot.deprecationMessage": "Ce paramètre a été remplacé par `#asciidoc.useWorkspaceRootAsBaseDirectory#` et n'a plus aucun effet.",
"asciidoc.use_kroki.desc": "**Obsolète:** Active l'extension Kroki afin de générer des diagrammes.",
"asciidoc.use_kroki.deprecationMessage": "Ce paramètre a été remplacé par `#asciidoc.extensions.enableKroki#` et n'a plus aucun effet.",

"asciidoc.antora.title": "Antora",
"asciidoc.antora.enableAntoraSupport.desc": "Active le support [Antora](https://antora.org/)."
}
5 changes: 4 additions & 1 deletion i18n/jpn/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"displayName": "AsciiDoc",
"description": "リッチで軽量なマークアップであるAsciiDocをサポートします。",

"asciidoc.preview.title": "プレビューを",
"asciidoc.exportAsPDF.title": "PDFへエキスポート",
"asciidoc.pasteImage.title" : "イメージの貼り付け",
"asciidoc.preview.title": "プレビューを開く",
"asciidoc.showPreview.title": "プレビューを開く",
"asciidoc.preview.refresh.title": "プレビューの更新",
"asciidoc.preview.toggleLock.title": "プレビューのロック切り替え",
"asciidoc.previewSide.title": "サイドにプレビューを開く",
Expand Down Expand Up @@ -71,5 +72,7 @@
"asciidoc.useWorkspaceRoot.deprecationMessage": "本設定は、`#asciidoc.useWorkspaceRootAsBaseDirectory#`に置き換えられ、動作しません。",
"asciidoc.use_kroki.desc": "**非推奨:** ダイアグラム生成Krokiを使用します。",
"asciidoc.use_kroki.deprecationMessage": "本設定は、`#asciidoc.extensions.enableKroki#`に置き換えられ、動作しません。",

"asciidoc.antora.title": "Antora",
"asciidoc.antora.enableAntoraSupport.desc": "Enable [Antora](https://antora.org/) support."
}
Loading

0 comments on commit d005696

Please sign in to comment.