@oazmi/superbuild-plugins - v0.1.0
    Preparing search index...

    Interface ImportmetaPluginSetupConfig

    setup configuration options for the importmetaPluginSetup.

    interface ImportmetaPluginSetupConfig {
        pattern?: RegExp;
        extractImportPath?: (import_statement: string) => string | undefined;
        insertImportPath?: (output_path: string) => string;
        transformFilters?: Require<OnTransformOptions, "loader">[];
    }
    Index

    Properties

    pattern?: RegExp

    specify the regex pattern used for searching for import.meta.resolve("...") statements in you javascript/typescript source files. the regex matches found here will be passed on to your extractImportPath function.

    /import\s*\.\s*meta\s*\.\s*resolve\s*\(\s*(?<quote>["'])(?.?)\k\s)/g`

    extractImportPath?: (import_statement: string) => string | undefined

    the function you provide here complements your regex pattern, by extracting the path from it. you may also use this opportunity for interpreting the path associated with your resource that is to be imported. if your function returns undefined, it will hint the import-meta plugin to skip that particular match from being bundled.

    a function that extracts the import path inside the import.meta.resolve("...") statement selected by the default pattern.

    insertImportPath?: (output_path: string) => string

    the function you provide here is used for generating a string to re-insert back into your emitted js-file's import.meta.resolve statement (which was originally selected from the pattern). your function should accept the output path of the linked bundled resource, and then enclose it with necessary stuff to turn it into a proper statement/expression.

    (output_path: string) => { return `import.meta.resolve("${output_path}")` } (i.e. the function puts back an import.meta.resolve statement with the bundled output path. however, you are free to do other things, such as placing a string literal of the output path)

    transformFilters?: Require<OnTransformOptions, "loader">[]

    specify which loaded files/resoruces will need to be intercepted by the import-meta plugin.

    { filter: new RegExp(".*"), loader: "js" | "jsx" | "ts" | "tsx", namespace: undefined }