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.

109 lines
2.0 KiB

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _plugin() {
const data = require("@parcel/plugin");
_plugin = function () {
return data;
};
return data;
}
function _nullthrows() {
const data = _interopRequireDefault(require("nullthrows"));
_nullthrows = function () {
return data;
};
return data;
}
function _semver() {
const data = _interopRequireDefault(require("semver"));
_semver = function () {
return data;
};
return data;
}
function _posthtmlParser() {
const data = require("posthtml-parser");
_posthtmlParser = function () {
return data;
};
return data;
}
function _posthtmlRender() {
const data = require("posthtml-render");
_posthtmlRender = function () {
return data;
};
return data;
}
var _dependencies = _interopRequireDefault(require("./dependencies"));
var _inline = _interopRequireDefault(require("./inline"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = new (_plugin().Transformer)({
canReuseAST({
ast
}) {
return ast.type === 'posthtml' && _semver().default.satisfies(ast.version, '^0.4.0');
},
async parse({
asset
}) {
return {
type: 'posthtml',
version: '0.4.1',
program: (0, _posthtmlParser().parser)(await asset.getCode(), {
directives: [{
name: /^\?/,
start: '<',
end: '>'
}],
sourceLocations: true,
xmlMode: true
})
};
},
async transform({
asset
}) {
asset.bundleBehavior = 'isolated';
const ast = (0, _nullthrows().default)(await asset.getAST());
2 years ago
(0, _dependencies.default)(asset, ast);
const inlineAssets = (0, _inline.default)(asset, ast);
return [asset, ...inlineAssets];
},
generate({
ast
}) {
return {
content: (0, _posthtmlRender().render)(ast.program)
};
}
});
exports.default = _default;