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.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
"use strict" ;
var _ _importDefault = ( this && this . _ _importDefault ) || function ( mod ) {
return ( mod && mod . _ _esModule ) ? mod : { "default" : mod } ;
} ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
exports . uniJsonPlugin = void 0 ;
const path _1 = _ _importDefault ( require ( "path" ) ) ;
const json _1 = require ( "../../json" ) ;
const preprocess _1 = require ( "../../preprocess" ) ;
const utils _1 = require ( "../utils" ) ;
function uniJsonPlugin ( ) {
return {
name : 'uni:json' ,
enforce : 'pre' ,
transform ( code , id ) {
// 如果已经被其他插件处理过了,就不再处理,比如 commonjs 插件, ICAPRegistrar.json?commonjs-external
if ( id . startsWith ( '\0' ) ) {
return ;
}
if ( path _1 . default . extname ( ( 0 , utils _1 . parseVueRequest ) ( id ) . filename ) !== '.json' ) {
return ;
}
return {
code : JSON . stringify ( ( 0 , json _1 . parseJson ) ( ( 0 , preprocess _1 . preJson ) ( code , id ) , false , id ) , null , 2 ) ,
map : {
mappings : '' ,
} ,
} ;
} ,
} ;
}
exports . uniJsonPlugin = uniJsonPlugin ;