npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

project-polyfill

v0.0.3

Published

project polyfill for mblock of PC, App, Web

Downloads

9

Readme

更新说明

2018-9-27 [email protected] publish

仓库说明

本仓库尝试解决 mblock 作品在 pc, app, web 三端需求迭代不一致所产生的兼容问题。

比如 web 可能优先实现了 A 功能,并产生相应的数据保存到作品 a.mblock 文件中, 因为迭代周期不一致原因,此时 app 未实现 A 功能,若 app 导入了 a.mblock 作品文件,除了能正常使用外,不应破坏 a.mblock 文件中不被支持的功能数据。

不被支持的功能的数据,是被缓存起来的,最后保存作品时,会取用缓存还原。

Usage

a.js 中引入模块

import ProjectPolyfill from 'project-polyfill';

export default new ProjectPolyfill();

main.js 中使用该 polyfill 功能

import ProjectPolyfill from './a.js';
import vm from './vm';

// xxx.mblock 文件中解析出 mscratchJson
// mscratchJson = unzipMblock(xxx.mblock);

// 外部
let config = {
    getExtensionsData: () => {}
};

// 初始化,依赖 vm
ProjectPolyfill.init(vm, config);

// 将解析所得 mscratchJson 传入
ProjectPolyfill.input(mscratchJson);

API 简述

初始化

初始化依赖 vm,配置 config 是可选的。

ProjectPolyfill.init(vm, config);

config 用于配置输出作品时的钩子方法。 若在 config 中添加配置钩子方法,则取到编辑时的实时数据;反之若不添加配置钩子方法,则会取到一开始输入时的缓存。

const config = {
    getExtensionsData: () => object,
    getCodeTypes: () => [string],
    getMode: () => string,
    getOnline() => string
}

输入

导入作品时,将作品数据 mscratchJson 输入到 ProjectPolyfill 模块

ProjectPolyfill.input(mscratchJson);

输出

导出作品时,将作品数据从 ProjectPolyfill 模块中导出

ProjectPolyfill.output();