chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
const yaml = require("js-yaml");
|
||||
|
||||
// Webpack loader that compiles a YAML file into a default-exported JS object,
|
||||
// so docs data can be authored in YAML (block scalars, no quote/newline
|
||||
// escaping) but imported exactly like the JSON it replaces.
|
||||
module.exports = function (source) {
|
||||
const data = yaml.load(source);
|
||||
return `export default ${JSON.stringify(data)};`;
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
module.exports = function (context, options) {
|
||||
return {
|
||||
name: 'labelmap',
|
||||
configureWebpack(config, isServer, utils) {
|
||||
return {
|
||||
module: {
|
||||
rules: [{ test: /\.txt$/, use: 'raw-loader' }],
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
const path = require("node:path");
|
||||
|
||||
// Enables importing YAML data files from docs/data as plain JS objects.
|
||||
// Scoped to the data directory so it never intercepts other .yaml files
|
||||
// (e.g. the OpenAPI spec under static/).
|
||||
module.exports = function (context, options) {
|
||||
return {
|
||||
name: "yaml-data-loader",
|
||||
configureWebpack(config, isServer, utils) {
|
||||
return {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.ya?ml$/,
|
||||
include: path.resolve(__dirname, "..", "data"),
|
||||
use: path.resolve(__dirname, "js-yaml-loader.js"),
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user