Son CV dans un terminal web en Javascript! https://terminal-cv.gregandev.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
2.4 KiB

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _assert() {
const data = _interopRequireDefault(require("assert"));
_assert = function () {
return data;
};
return data;
}
function _jsonSourceMap() {
const data = _interopRequireDefault(require("json-source-map"));
_jsonSourceMap = function () {
return data;
};
return data;
}
function _diagnostic() {
const data = require("@parcel/diagnostic");
_diagnostic = function () {
return data;
};
return data;
}
function _plugin() {
const data = require("@parcel/plugin");
_plugin = function () {
return data;
};
return data;
}
function _utils() {
const data = require("@parcel/utils");
_utils = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// https://developer.mozilla.org/en-US/docs/Web/Manifest
const RESOURCES_SCHEMA = {
type: 'array',
items: {
type: 'object',
properties: {
src: {
type: 'string',
__validate: s => {
if (s.length === 0) {
return 'Must not be empty';
}
}
}
},
required: ['src']
}
};
const MANIFEST_SCHEMA = {
type: 'object',
properties: {
icons: RESOURCES_SCHEMA,
screenshots: RESOURCES_SCHEMA
}
};
var _default = new (_plugin().Transformer)({
async transform({
asset
}) {
const source = await asset.getCode();
const {
data,
pointers
} = _jsonSourceMap().default.parse(source);
_utils().validateSchema.diagnostic(MANIFEST_SCHEMA, {
source,
map: {
data,
pointers
},
filePath: asset.filePath
}, '@parcel/transformer-webmanifest', 'Invalid webmanifest');
for (const key of ['icons', 'screenshots']) {
const list = data[key];
if (list) {
(0, _assert().default)(Array.isArray(list));
for (let i = 0; i < list.length; i++) {
const res = list[i];
res.src = asset.addURLDependency(res.src, {
loc: {
filePath: asset.filePath,
...(0, _diagnostic().getJSONSourceLocation)(pointers[`/${key}/${i}/src`], 'value')
}
});
}
}
}
asset.type = 'webmanifest';
asset.setCode(JSON.stringify(data));
return [asset];
}
});
exports.default = _default;