"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBuilderVersion = exports.getPublicPathFromCompiler = exports.generateScriptTag = exports.COMPILATION_PROCESS_STAGE = void 0;
const path_1 = __importDefault(require("path"));
const utils_1 = require("@modern-js/utils");
/** The intersection of webpack and Rspack */
exports.COMPILATION_PROCESS_STAGE = {
    PROCESS_ASSETS_STAGE_ADDITIONAL: -2000,
    PROCESS_ASSETS_STAGE_PRE_PROCESS: -1000,
    PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE: 700,
    PROCESS_ASSETS_STAGE_SUMMARIZE: 1000,
    PROCESS_ASSETS_STAGE_REPORT: 5000,
};
const generateScriptTag = () => ({
    tagName: 'script',
    attributes: {
        type: 'text/javascript',
    },
    voidTag: false,
    meta: {},
});
exports.generateScriptTag = generateScriptTag;
const getPublicPathFromCompiler = (compiler) => typeof compiler.options.output.publicPath === 'string'
    ? compiler.options.output.publicPath
    : // publicPath function is not supported yet
        '/';
exports.getPublicPathFromCompiler = getPublicPathFromCompiler;
const getBuilderVersion = async () => {
    const pkgJson = await utils_1.fs.readJSON(path_1.default.join(__dirname, '../../package.json'));
    return pkgJson.version.replace(/\./g, '_');
};
exports.getBuilderVersion = getBuilderVersion;
