denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97.83k stars 5.39k forks source link

npm:colors compatibility #25923

Closed xuybin closed 1 month ago

xuybin commented 1 month ago

Version: Deno 1.46.3 ---- 2.0.0-rc.6

test.mjs

import colors from "colors";
console.log(`colors.bold`, Object.keys(colors.bold));
console.log(`colors.bold.blue`, colors.bold.blue);

import_map.json

{
    "imports": {
        "colors": "npm:colors@1.4.0"
    }
}

node test.mjs

colors.bold [ '_styles' ]
colors.bold.blue [Function: builder] { _styles: [ 'bold', 'blue' ] }

deno run -A --import-map=import_map.json test.mjs

colors.bold [ "_styles", "__proto__" ]
colors.bold.blue undefined
sigmaSd commented 1 month ago

You need to run deno with --unstable-unsafe-proto

xuybin commented 1 month ago

thanks.