Brand new static package manager.

Related tags

Package Managers spm
Overview

spm

NPM version Build Status NPM downloads

Brand new static package manager for browser.


spm 从 3.9 开始将不再管理组件的生命周期, 即不再有 spmjs.io. 所以相应的逻辑全部去除. 请使用 npm 来管理组件.

Install

$ npm install spm -g

Usage

Packaging Server

Report a issue

License

SPM is available under the terms of the MIT License.

Memo

Comments
  • spm3 发布日志

    spm3 发布日志

    spm3 发布通告

    很高兴通知各位,更好用的 [email protected] 及其源服务 spmjs.io 发布了。

    缘起

    spm 从第一个版本到现在三年了,从 0.x 到 1.x 再到 2.x,定位上从 Sea.js 配套的打包工具到包管理器,已发生了多次大的改变。

    spm 的第一行代码提交是2011年7月9日。那时 npm 刚刚兴起,而 bower、component、browserify 等等还未出现。

    相比于 Sea.js 的简洁通用,spm 的包管理和打包机制一直被社区所诟病(我相信有一万个issue吐槽过它),甚至或多或少阻碍了整个社区的发展,这也和我们做生态圈的想法相悖。(可以参考:spm 的困境

    这些年接触 nodejs 时,npm 社区的活跃和便利性给我们很大启发。我们(都)希望在自己的工作中能使用优秀的业界模块(而不是自己开发,或用公司的破框架重构一个),所以我们有了 Sea.js,有了 spm,有了 Arale,这些前端模块化的方案和工具都致力于解决一个问题:我们如何可以像 npm 一样方便的组织和调用模块,我们如何最小成本地来使用和贡献业界优秀的模块,我们如何能给开发者提供通用的前端模块化解决方案

    [email protected] 在去年发布之后,对上面的问题做了很多解答。实际上,spm2 解决了大多数问题,它在支付宝和很多第三方企业和个人的项目中良好的运转,实践了很多工程问题(比如样式和模板的集成、内网源)。但是它也有很多问题,比如太多约定,比如暴露给开发者的复杂度,比如不通用……

    所以我们需要一个更好的 [email protected]。( •̀_•́)ง

    定位

    新的 [email protected] 从其他包管理方案(browserify、bower、jamjs、component)中汲取了不少优点,在 spm2 的良好基础上,致力于提供一个开放、通用、完善、集成化的基于浏览器模块生命周期的包管理工具,包括初始化、编码、本地化调试、文档生成、发布、依赖管理、单元测试、构建、源服务等等功能。

    进化

    一起来看看 [email protected] 都发生了哪些变化:

    1. 精心设计的 package 规范。

      • 去除 family 字段。打通模块间依赖的壁垒,避免每个 family 下都发布要 jquery 的问题。

      • spm.alias 属性被语义更加明确的 spm.dependencies 属性代替。

      • 添加了 spm.main 属性,实现了单入口,从而使依赖书写更加清爽。

        原来你需要这么写:

        "alias": {
          "moment": "gallery/moment/2.6.0/moment"
        }
        

        现在清晰多了:

        "dependencies": {
          "moment": "2.6.0"
        }
        
      • 去掉了默认的 src 目录等约定规则,这样模块目录结构可以像 npm 模块一样简单随意。

      • 新增 buildArgs 字段,用于模块构建。

    2. 编码书写规范从 CMD 规范全面转向 CommonJS,更加通用和开放,不再需要书写烦人的 define(function(require, module, exports) {})了,并且可以和 Component 社区进行一定程度的打通。CMD 格式作为调试和上线后的运行时规范继续存在,但基本上对开发者透明了,我们正在和 CMD 规范告别

    3. 新的命令行工具 [email protected],我们将原先的功能、常用插件、和在 apm 中实践出来的通用功能都集成到一起,用于管理一个完整的模块生命周期,包括初始化,完全的本地化调试,测试,发布,构建,文档生成和部署等等功能,All in one。比起其他浏览器包管理工具,功能更加完善贴心,更浏览器,更快(网速:-D)。

    4. 基于 gulp 的构建工具。(spm build)

      • 明显快于 grunt 方式的构建速度。
      • 包管理和构建过程完全分离,源上不存放构建后的代码,发布到源上之前不再需要运行 spm build,构建只作为上线前的必要步骤。
      • 简单通用的配置让你告别繁琐的 gruntfile,也不再被各种支付宝潜规则困扰。
      • 支持 standalone 的打包方式,无须 Sea.js 环境也可部署使用
      • 依旧支持 css、tpl、handlebars 等特殊模块的内嵌。
    5. 基于 nodejs 重写的源服务 spmjs.io,用于代替原来用 python 写的 yuan,完美适配 [email protected],简化的账户体系支持 github 登陆和匿名两种方式,可以很方便部署(适合作为企业级开发的内网源),同时方便了我们的后续维护。我们已部署了一个 spmjs.io 作为通用的全网服务。

    6. 高端大气的界面以及……英文文档!我们要更加国际化。

      图

    7. 大量细节变化不一一絮述。

    使用

    好吧,正式的用起来吧!

    安装

    $ npm install spm -g
    

    会覆盖 spm2,需要共存的请参考spm 2, 3 共存方案

    确保你安装的是 3.x 版本:

    $ spm -v
    3.x.x
    

    开始试用

    直接看官网的上手文档吧:spmjs.io/documentation

    不要担心英文,这些文档都是中国人写的:-D

    参与

    我们衷心的希望您能一起参与到新版 spm 的开发和使用中来,你可以从以下几个方面入手:

    1. 迁移旧的模块。

      如果您在使用老的源服务 https://spmjs.org,建议进行迁移,可以参考迁移文档 和使用迁移工具。推荐参考已迁移的 Arale 模块如 Base 的结构。

    2. 推广 spm 社区。

      由于新的模块规范通用性和开放性的改变,使我们向国外社区的推广有了可能。我们已经用 pull request 的方式开始向国外的开源项目推广 spm,目前推广效果还算不错,欢迎加入我们的工作。(向开源项目推广 spm 的汇总

    3. 发布你的模块。

      如果你有牛逼好用的前端项目,欢迎引入 spm3,把模块发布到 spmjs.io 上;也可以帮助我们发布一些业界优秀的模块(目前主要是我们团队的几个人在努力的发啊发)。因为去掉了 family,所以 spmjs.io 和 npm 一样,采用占坑的方式管理模块,好名字先到先得欢迎抢注(不要滥用哦)。

    4. 应用。

      在您的个人博客和公司项目中使用 spm3 新方案,能用的东西才会是好东西。遇到任何问题或有什么好想法,及时给我们提建议

    备注

    1. 旧版的 spm2 的源服务 https://spmjs.org 将和新版的源共存一段时间(预计至少半年),强烈建议老用户进行迁移。
    2. 由于 spm2 和 spm3 差异巨大,如果贵公司的文档里有安装 spm2 的文档,请及时修改为npm install [email protected] -g

    相关链接:

    documentation milestone 
    opened by afc163 91
  • SPM 发布 0.9.0 试用版

    SPM 发布 0.9.0 试用版

    目前 SPM 经过重新设计和开发,已经发布了最新稳定版:

    https://npmjs.org/package/spm

    当前版本主要功能还是为了满足支付宝的应用场景,但是设计的时候也考虑到了一定通用性。

    对外部用户的使用场景可能支持得还不是很好,欢迎大家提供自己的使用场景,并提出宝贵的意见。

    SPM 1.0.0 会根据收集上来的使用场景和需求进行完善。感谢大家。

    milestone 
    opened by leoner 86
  • spm transport 的一些优化

    spm transport 的一些优化

    现在感觉 transport 的方式比较乱,而且有些使用不太容易理解。

    transport 的核心功能是下载外部的组件,并封装成 CMD 模块,也有一个生命周期(transport -> build -> upload -> deploy),现在应该也是这样做的。

    但是外部的组件各种各样,现在能想到的

    • 代码存放在不统一,比较常见的 github 和 google code,还有些提供 zip 下载,或者没有在线可下载地址。
    • 代码版本化不统一,github 可以切 tag,有些可以读取 package.json 的版本信息,有些干脆没版本。

    transport

    transport 最关键就是找需要的文件和版本信息。

    需要的文件可以用 @src 标识,@src 可以有多个支持合并

    transport.js

    /**
     * @src http://code.jquery.com/jquery-latest.js
     */
    define(function(){
       /*{{code}}*/
       return $.noConflict(true);
    });
    

    版本获取是最麻烦的,我建议每次 transport 手动指定版本。一般 transport 文件都需要人为判断,自动化了容易出错。比如

    • 获取 github 的最后版本,有些经常会有 1.8.1b1 1.8.1rc 这样的版本,这些应该被忽略的。
    • package.json 中写的可能是正在使用的版本,并不稳定

    这个版本指定和开发组件是相同的,在 package.json 中指定版本,看下面的配置文件

    build

    我建议可以使用 build 的代码。新建一个 package.json 文件,描述当前文件的信息

    {
        "name":"jquery",
        "version": "1.7.2",
        "description":"A new kind of JavaScript Library.",
        "author":"John Resig",
        "homepage":"http://jquery.com/"
    }
    

    upload deploy

    和原来保持一直,只是支持 transport 的目录结构。

    discuss 
    opened by popomore 44
  • 使用spm时的疑惑,麻烦帮忙解答

    使用spm时的疑惑,麻烦帮忙解答

    @kangpangpang 有几个疑惑麻烦帮我解答下哈,我现在用的是0.4.1的版本,在我的项目里有循环引用的情况,想问一下这个问题在哪个版本解决了吗?还有 我用spm build出来的文件的里require都变成e等单字符了,请问哪个参数是让其保持require字符原样的?是在compiler_options里吗?没找到具体介绍compiler_options参数的wiki呢

    opened by yangligogogo 36
  • package, sources and spm

    package, sources and spm

    package, sources and spm

    package.json

    package.json 提供模块的信息以及 spm 的打包策略。

    目录结构

    package.json
    README.md
    src/
        name.js
    dist/
        name-debug.js
        name.js
    tests/
    examples/
    

    模块信息

    {
        "name": "yourname",
        "version": "1.0.0",
        "root": "#",
        "description": "something",
        "homepage": "http://example.com/project",
        "author": "name <[email protected]>",
        "repository": {
            "type": "git",
            "url": "https://github.com/name/repo.git"
        },
        "bugs": {
            "url": "https://github.com/name/repo/issues"
        },
        "license": "WTFPL",
        "dependencies": {
            "underscore": "1.1.2"
        },
        "devDependencies": {
            "underscore": "1.1.3"
        },
        "sources": [
            "http://modules.seajs.org",
            "http://arale.taobao.org",
            "http://arale.alipay.org"
        ],
        "tests": [],
        "output": {
            "name.js": ["a.js", "b.js"]
        }
    }
    

    必填项:

    • name: 模块名只能包含小写字母数字和中划线
    • version: 版本号由 3 组数字组成 major.minor.bugfix 开发时版本号应该加上后缀 -dev,例如 1.1.3-dev

    推荐项:

    • license: 请务必注明,以方便他人确认是否可用
    • dependencies: 你依赖的模块有哪些
    • description: 描述你的模块
    • author: 作者信息
    • repository: 项目地址
    • bugs: 如果有 bug,别人应该去哪里向你提 bug
    • tests: 测试用例
    repository

    如果你的 repo 里有多个模块你应该指定一个 path

    "repository": {
        "type": "git",
        "url": "http:github.com/name.repo.git",
        "path": "path/to/your/module"
    }
    
    bugs

    如果你还想用 email 的话:

    "bugs": {
        "email": "[email protected]",
        "url": "https://github.com/name/repo/issues"
    }
    

    选填项

    • root: 如果不填,默认为 "#",第三方开发者不填 root
    • output: 如果不填,默认无合并,将 src 里的文件 build 到 dist
    • sources: 源,你的依赖模块从哪里查找,第三方开发者不要填写

    模块源是一个中央仓库,里面存放 zip 格式的模块。用户可使用自己的模块源。

    源的目录结构:

    modules.json             <--- 所有模块的信息
    moment/
        moment.tgz
        info.json            <--- 该模块最近更新的时间,总共有哪些版本
        1.1.2/
            moment.tgz
            dist/
            src/
            package.json
    jquery/
        jquery.tgz
        info.json
        1.7.2/
            jquery.tgz
            dist/
            package.json
    

    源提供模块给 spm install 使用。如:

    $ spm install moment
    GET http://modules.seajs.org/moment/moment.zip
    
    $ spm install moment --version=1.1.1
    GET http://modules.seajs.org/moment/1.1.1/moment.zip
    

    源提供 package.json 信息给 spm 分析依赖关系。

    例如模块 A 的 moduleDenpendencies 有 overlay 1.1.3 版本, spm 解析:

    GET http://modules.seajs.org/overlay/1.1.3/package.json
    >>> READING package.json
    >>> overlay requires jquery 1.7.2
    GET http://modules.seajs.org/jquery/1.7.2/package.json
    >>> READING package.json
    >>> jquery requires nothing
    >>> finished
    

    SPM

    spm (aka seajs package manager) 是一个用来安装、打包 seajs 模块的工具。

    配置文件

    配置文件使用 json 格式: ~/.spm/config.json

    {
        "sources": [
            "http://modules.seajs.org",
            "http://arale.taobao.org",
            "http://arale.alipay.org"
        ]
    }
    

    子命令

    • spm init
    • spm install
    • spm transport
    • spm build
    • spm upload
    • spm deploy
    • spm help
    opened by lepture 31
  • spm 的定位思考与未来发展

    spm 的定位思考与未来发展

    在 spm 1.x 里,我们对 spm 的定位是: spm 是简单、放心的包管理工具 。spm 这三个字母代表的是 Static Package Manager.

    但在实际开发过程中,从目前 spm 1.6 的功能来看,spm 涵盖了很多功能点:

    1. 源服务spm server 用来搭建源服务,以存放模块及其信息。
    2. 包管理spm install / upload 等功能,跟源服务配合起来,完成模块的依赖获取、下载安装、上传、部署等功能。包管理工具操作的单元是包。
    3. 构建工具spm build ,主要功能是将模块源码转换成符合 Modules/Transport 规范的 dist 代码,中间还会进行预编译、压缩等操作。
    4. 配置管理:对各种配置文件的管理,比如 package.json、spm/config.json、info.json 等等。目前这一块比较杂糅在一起。
    5. 辅助功能:包括 spm init 等功能,nico 也可以成是 spm 体系下的文档和调试工具。

    上周讨论,我们很纠结的两点:

    1. Grunt 作为构建工具,目前社区非常活跃,功能也比较成熟。如果我们直接用 grunt 作为构建工具的话,Gruntfile 的理念是 程序即配置,带来的好处是非常灵活。对于个人开发者来说,使用 grunt 基本上没有实现不了的需求。
    2. 但是,对于企业级开发来说,Grunt 的配置文件缺乏合理的管理方式。 目前 spm 在配置文件管理方面,比 grunt 更合适支付宝。 比如目前 spm 的配置文件,可以有继承关系,可以放在源上统一管理。这对 spm 的统一部署、升级等日常维护来说,非常方便。

    或许我们可以把 spm 定位成一个静态资源管理的整体解决方案,这个方案里包括五部分:

    • 源服务
    • 包管理
    • 构建
    • 配置管理
    • 辅助功能
    1. 源服务 目前没有合适成熟的开源类库,因此这一块我们还是得自己做。南伯正在开发的 yuan 可以继续往前推进。
    2. 包管理 目前 yeoman、ender 等有做,但和我们的理念上存在较大差异,很难复用起来。
    3. 构建工具 目前是最百花齐放的,grunt 是其中的姣姣者。这一块我们或许真的可以不用重复造轮子,或许应该反过来给 grunt 提交我们社区的 tasks.
    4. 配置管理 是 spm 目前的一个特色,借鉴了很多 maven 的优秀思想。这一块目前的难点是是否可以独立出来?比如可以统一管理 package.json、Gruntfile 等配置管理,让这些配置文件也都可以继承、统一部署更新等。如果能做到,就能解决我们目前在支付宝遇到的问题。
    5. 辅助功能 也不叫辅助功能,这一块想得不是很清楚,更多的应该是一种扩展机制,涵盖文档生成、调试辅助、测试驱动等等,可想象的空间很大。以后再逐一来集成。

    如果大家同意上面的功能拆分,那么接下来我们要做的事情是:

    1. spm 1.x 的拆分。着重拆分出 构建工具配置管理 两部分。配置管理可以独立做,构建工具具体怎么做,是否换成 grunt,我的建议是年前让大家都用用 grunt,真实去用才能有真感受。等年后来决定构建工具的进一步发展。
    2. spm2 的进一步开发。这部分工作,着重在 包管理 上。build_core 部分,尽可能多的 focus 在 SDK 层面。这样,无论以后单独做,还是成为 grunt 的一个 task,都能省不少工作量。
    3. 源的发展。南伯继续。这周先把规范、接口等晒出来。综合起来考虑,尽量能做成开放式架构。
    4. 辅助功能。先按兵不动。有时间时,可以试着去用用 Yeoman 等套件,Yeoman 还是挺不错的,啥都做呀。

    可继续讨论。春节前达成一致。

    discuss 
    opened by lifesinger 30
  • spm@1.x 旧版文档备份

    [email protected] 旧版文档备份

    原来的 wiki 迁移到这里后全部删除,避免误导

    注意:以下是 [email protected] 版本的文档,已不再维护更新。

    • [email protected] 文档请查看 http://docs.spmjs.org ,源服务为 https://spmjs.org ,命令行工具的源码为:https://github.com/spmjs/spm/tree/2.x
    • [email protected] 文档请查看 http://spmjs.io/documentation ,源服务为 http://spmjs.io ,命令行工具的源码为:https://github.com/spmjs/spm/tree/master
    documentation 
    opened by afc163 29
  • Package 规范

    Package 规范

    Basic example:

    {
      "name": "arale-calendar",
      "version": "1.0.0",
      "description": "Calendar widget.",
      "author": "Hsiaoming Yang <[email protected]>",
      "maintainers": [
        "冒顿 <[email protected]>",
        "乔花 <[email protected]>"
      ],
      "homepage": "http://aralejs.org/calendar/",
      "repository": {
        "type": "git",
        "url": "https://github.com/aralejs/calendar.git"
      },
      "bugs": {
        "url": "https://github.com/aralejs/calendar/issues"
      },
      "keywords": ["widget", "month", "datepicker"],
      "license": "MIT",
      "spm": {
        "main": "src/calendar.js",
        "dependencies": {
          "jquery": "1.7.2",
          "moment": "2.0.0",
          "arale-base": "1.0.0",
          "arale-position": "1.0.0",
          "arale-iframe-shim": "1.0.2",
          "handlebars": "1.0.2",
          "arale-widget": "1.1.1"
        },
        "devDenpendencies": {
          "expect": "0.2.0"
        },
        "engines": {
          "seajs": "2.1.1",
          "seajs-text": "1.0.3",
          "seajs-style": "1.0.2"
        },
        "buildArgs": "--exclude $",
        "tests": "tests/*-spec.js"
      }
    }
    

    除了在 spm 里面的字段,其他基本和 npm 的 package.json 规范保持一致。

    | Field | Description | | --- | --- | | name* | name of your package, all lowercase, use a "-" as a separator between words | | version* | Semantic Versioning like 1.0.0 | | description | a brief description of your package | | keywords | a array contains keywords | | homepage | url of your package's website | | author | author of this package: Hsiaoming Yang <[email protected]> or { "name": "Hsiaoming Yang", "email": "[email protected]" } | | maintainers | a array of maintainers, just like author | | repository | Specify the place where your code lives. { "type": "git", "url": "http://github.com/isaacs/npm.git" } | | bugs | The url to your project's issue tracker and / or the email address to which issues should be reported. | | license | license | | spm | | | spm.main | the only entry point of package, default index.js, could be a json or css file | | spm.dependencies | specify dependencies relation of the package | | spm.devDependencies | specify dependencies relation of the package in developing stuation | | spm.engines | specify the loader envirement of executing the package, it would be used for local demo debugging. | | spm.tests | specify all test files, support glob patterns: tests/*-spec.js | | spm.buildArgs | specify the cli arguments for spm build |

    feature 
    opened by popomore 29
  • spm doc bug

    spm doc bug

    http://spmjs.io/docs/rc-calendar/examples/picker.html

    线上出错 spm 3.3.2: spm doc 是好的

    但是 3.3.2 不能处理 md 里的

    var zhCn = require('gregorian-calendar/lib/locale/zh-cn'); // spm error
    

    请求路径没加版本号

    opened by yiminghe 28
  • spm build 详解

    spm build 详解

    spm build

    spm build 的主要责任:将 src 文件生成为完整信息的 dist 文件。

    模块分为两种:

    1. 生态圈模块
    2. 私有源模块

    下面只讨论生态圈模块

    输入与输出

    假设有一个模块:

    ninja/
        package.json
        src/
            a.js
            b.js
            c.js
            d.js
    

    package.json 信息:

    {
        "name": "ninja",
        "version": "1.0.0",
        "author": "lepture <http://lepture.com>",
        "moduleDependencies": {
            "overlay": "1.2.1",
            "jquery": "1.7.2"
        },
        "output": {
            "a.js": ".", // 相当于把 a 的所有相对依赖打包成一个文件
            "a-aio.js": "*",  // 相当于把所有依赖模块打包成一个文件
            "d.js": ["d.js"]
        },
        "sources": [
            "private-repo.alipay.com",
            "arale-repo.alipay.com"
        ]
    }
    

    注: aio (all in one)

    spm build 后的结果为:

    ninja/
        package.json
        src/
            a.js
            b.js
            c.js
            d.js
        dist/
            a.js
            a-debug.js
            a-aio.js
            a-aio-debug.js
            d.js
            d-debug.js
    

    其中 src 的内容为:

    // a.js
    define(function(require, exports, module) {
        var b = require('./b')
        var c = require('./c')
        ...
    })
    // b.js
    define(function(require, exports, module) {
        var overlay = require('overlay')
        // overlay 1.2.1 依赖 jquery 1.7.1
        ...
    })
    // c.js
    define(function(require, exports, module) {
        var $ = require('jquery')
        ...
    })
    // d.js
    define(function(require, exports, module) {
        ...
    })
    

    打包好的 dist 内容应该为:

    a-debug.js:

    define('#ninja/1.0.0/a', ['./b', './c', '#jquery/1.7.2/jquery', '#jquery/1.7.1/jquery', '#overlay/1.2.1/overlay'],
        function(require, exports, module) {
            var b = require('./b')
            var c = require('./c')
            ...
        }
    )
    define('#ninja/1.0.0/b', ['#jquery/1.7.1/jquery', '#overlay/1.2.1/overlay'],
        function(require, exports, module) {
            var overlay = require('#overlay/1.2.1/overlay')
        }
    )
    define('#ninja/1.0.0/c', ['#jquery/1.7.2/jquery'], function(require, exports, module) {
        var $ = require('#jquery/1.7.2/jquery')
    })
    

    a-aio-debug.js:

    define('#ninja/1.0.0/a' …
    define('#ninja/1.0.0/b' …
    define('#ninja/1.0.0/c' …
    define('#jquery/1.7.2/jquery' …
    define('#jquery/1.7.1/jquery' …
    define('#overlay/1.2.1/overlay' …
    

    d-debug.js:

    define('#ninja/1.0.0/d' …
    

    id 的提取

    $ spm build -v
    >>> READING   package.json
    >>> PROCESS OUTPUT   "a.js": "."
    >>> GENERATE ID   #ninja/1.0.0/a
    

    id = #name/version/filename

    其中 name 与 version 从 package.json 中读取。

    依赖提取

    >>> FIND DEPENDENCIES "a.js": ["./b", "./c"]
    >>>
    >>> PROCESS FILE ./b
    >>> FOUND DEPENDENCIES ["overlay"]
    >>> PARSE ALIAS "overlay" -> "#overlay/1.2.1/overlay"
    >>> GET http://private-repo.alipay.com/overlay/1.2.1/overlay.tar.gz
    >>> HTTP 404
    >>> GET http://arale-repo.alipay.com/overlay/1.2.1/overlay.tar.gz
    >>> HTTP 200
    >>> READING overlay/1.2.1/dist/overlay-debug.js
    >>> DEPENDENCIES ["#overlay/1.2.1/overlay", "#jquery/1.7.1/jquery"]
    >>>
    >>> PROCESS FILE ./c
    >>> FOUND DEPENDENCIES ["jquery"]
    >>> PARSE ALIAS "jquery" -> "#jquery/1.7.2/jquery"
    >>> GET http://private-repo.alipay.com/jquery/1.7.2/jquery.tar.gz
    >>> HTTP 404
    >>> GET http://arale-repo.alipay.com/jquery/1.7.2/jquery.tar.gz
    >>> HTTP 200
    >>> READING jquery/1.7.2/dist/jquery-debug.js
    >>> DEPENDENCIES ["#jquery/1.7.2/jquery"]
    >>>
    >>> DEPENDENCIES RESULT a.js: ["./b", "./c", "#overlay/1.2.1/overlay", "#jquery/1.7.1/jquery", "jquery/1.7.2/jquery"]
    

    下载文件位于

    ninja/
        ...
        src/
        _build/
            download/
                overlay/
                    1.2.1/
                        dist/
                        src/
                        package.json
    

    关于从 cache 读取依赖,另外再讨论。

    require 替换

    >>> MODIFY a.js
    >>> REPLACE ./b -> ./b
    >>> REPLACE ./c -> ./c
    >>> MODIFY b.js
    >>> REPLACE overlay -> #overlay/1.2.1/overlay
    >>> MODIFY c.js
    >>> REPLACE jquery -> #jquery/1.7.2/jquery
    

    文件合并

    >>> BUILD a.js
    >>> CONCAT a.js b.js c.js -> dist/a-debug.js
    >>> COMPRESS a-debug.js -> a.js
    >>>
    >>>
    >>> PROCESS OUTPUT "a-aio.js": "*"
    ...
    ...
    >>> FINISHED in 5s
    

    打包

    opened by lepture 27
  • 用了skip问题

    用了skip问题

    比如说我一个文件: index.js

    var $ = require('jquery');
    var base = require('base');
    console.log($);
    console.log(base);
    

    package.json

    {
      spm:{
        "dependencies": {},
        "buildArgs": "--ignore jquery,base --skip jquery,base"
      }
    }
    

    构建完成:

    define("/jslib/index", [], function(require, exports, module) {
      var $ = require("jquery");
      var base = require("base");
      console.log($);
      console.log(base);
    });
    

    这样可以构建,但是因为用到了skip,造成依赖关系没有放进去,这样代码就不会运行了。 如果不用--skip,但是会提示error: jquery not found but required

    目的:将jquery与base视为基类,无需打包,直接用alias引到正确文件,其他非共用部分,打包进入口文件。

    bug 
    opened by kxbrand 26
Releases(3.3.4)
  • 3.3.4(Jan 8, 2015)

  • 3.3.2(Dec 26, 2014)

  • 3.3.1(Dec 25, 2014)

    • #1100 修复 link 后可能 build 出错
    • #1099 调整 doc 的二维码样式
    • #1102 修复新安装的 spm 执行 login 出错
    • #1108 修复 doc 生成的 test runner 无法在 totoro 里运行
    • #1109 修复 doc watch 不能访问到依赖库里的图片等非 css, js 资源
    • #1113 新增 doc 支持 jsx 模板
    • #1111 新增 doc 支持 commonjs 写法
    • spmjs/spm-client#26 修复 ignore 时 .gitignore 和 .spmignore 冲突
    • spmjs/spm-client#29 使用 ali.gnode 代替 regenerator
    • spmjs/spm-client#28 #1107 修复 spm install 并行读写 cache 时报错
    • spmjs/spm-server#13 修复 less 和 css 的检测优先级, less > css
    • [email protected] 修复 handlebars-runtime 打包后 js 语法报错
    Source code(tar.gz)
    Source code(zip)
  • 3.3.0(Dec 19, 2014)

  • 3.2.3(Oct 10, 2014)

  • 3.2.2(Sep 19, 2014)

    • #1025 修复 completion 导致 ubuntu 下系统不能登录的问题
    • #1023 修复 spm config registry 不生效的问题
    • #999 修复 spm-init 在 win 下报错的问题
    • [email protected] 修复依赖 pkg 下 .handlebars, .tpl 404 的问题
    • spmjs/serve-spm#5 [email protected], 修复 css @import 依赖 pkg 时的路径问题
    • spmjs/spm-client#22 [email protected], 改进 spm-install 出错时的报错信息
    Source code(tar.gz)
    Source code(zip)
  • 3.2.1(Sep 12, 2014)

    • #1006 修复 doc watch 时模块加载两遍的问题
    • #1008 修复 paths 路径设置导致 jQuery 加载不到的问题
    • #996 uglifyjs 压缩添加 ascii_only: true 配置
    • #935 用例支持 node 0.11
    • #1007 [email protected], 修复 tpl 在调试模式下缺少引号 wrap 的问题
    • #1004 [email protected], 修复 Error loading resource 导致覆盖率信息输出失败的 bug
    Source code(tar.gz)
    Source code(zip)
  • 3.2.0(Sep 5, 2014)

    详见:https://github.com/spmjs/spm/issues/896

    特性

    • #938 提醒命令行的整体性能
    • #967 支持依赖模块内其他文件的功能 require('module/file')
    • #919 提取 spm-client,方便自定义的构建工具基于此进行封装
    • #978 standalone 打包模式支持 umd,并且去 seajs-mini
    • [email protected],提升调试性能
    • #942 重构 spm-init
    • #888 source 换成 registry
    • #940 sea-modules 改名为 spm_modules
    • #961 添加 spm 命令行自动提示
    • #902 移除插件机制
    Source code(tar.gz)
    Source code(zip)
  • 3.1.1(Aug 1, 2014)

  • 3.1.0(Jul 25, 2014)

    详见:#827

    特性

    • #793 依赖模板和样式时,自动添加 handlebars 和 import-styles 依赖模块
    • #820 模块全依赖信息的简化
    • #847 doc watch 改进
    • #856 build 支持 skip 参数,跳过某些不需要解析依赖的模块
    • #848 output 支持 glob
    • #844 构建时如果包含一个模块的多个版本,应给予提醒
    • #874 doc theme 支持自定义
    • #871 命令行参数整理
    • #883 支持构建依赖的模块

    Bugfix

    • #849 publish 时,package.json 不能被忽略
    • #873 pkg 里包含 .DS_Store 文件时,spm doc watch
    • #876 同时存在 a.js 和 a 文件夹时,spm doc watch 报错
    • #839 spm test 在 windows 下报错
    • #830 windows 下,如果文件名包含多个 . 时,debug 的 require id 不正确
    • #829 standalone 模式下 require css 文件,没有对 seajs.importStyle 进行处理
    Source code(tar.gz)
    Source code(zip)
  • 3.0.1(Jun 10, 2014)

Owner
Static Package Manager
Static Package Manager
📦🚀 Fast, disk space efficient package manager

中文 | Español Fast, disk space efficient package manager: Fast. Up to 2x faster than the alternatives (see benchmark). Efficient. Files inside node_mod

pnpm 21.2k Jan 3, 2023
frontend package manager and build tool for modular web applications

THIS PROJECT IS DEPRECATED Component is not maintained anymore. See here #639 for more information. You can still use the component registry on compon

Component 4.6k Dec 30, 2022
A next-generation package manager for the front-end

Duo is a next-generation package manager that blends the best ideas from Component, Browserify and Go to make organizing and writing front-end code qu

Duo 3.4k Dec 28, 2022
JavaScript package manager - using a browser-focused and RequireJS compatible repository

****NOTE: this project is no longer active and not recommended for use. It is left here for reference. **** Jam was created at a time before Bower and

Caolan McMahon 1.5k Dec 10, 2022
interplanetary package manager

interplanetary package manager

Nathan Ginnever 10 Oct 9, 2021
The brand new @shopify/flash-list high performance list component can be used on TV as well as on phones!

FlashListTV The brand new @shopify/flash-list high performance list component can be used on TV as well as on phones! Quick start: Clone this repo Cha

Douglas Lowder 4 Oct 27, 2022
A brand new bleeding edge non bloated Discord library (based on Discordeno!)

biscuit A brand new bleeding edge non bloated Discord library Install (for node18) npm install @oasisjs/biscuit pnpm add @oasisjs/biscuit yarn add @oa

null 44 Nov 15, 2022
We are a group of videogame URJC students making a brand new Phaser3.0 browser multiplayer game. Come and support us!

COOKIE MAYHEM - JUEGOS EN RED Este proyecto está sujeto a cambios. Somos un grupo de estudiantes de Diseño y Desesarrollo de Videojuegos en la Univers

null 6 Dec 19, 2022
A devtool improve your pakage manager use experience no more care about what package manager is this repo use; one line, try all.

pi A devtool improve your pakage manager use experience no more care about what package manager is this repo use; one line, try all. Stargazers over t

tick 11 Nov 1, 2022
Adjust the appearance and content of the booking pages to your brand and services.

Timerise open source booking page We are pleased to provide our booking page in open-source. We hope it will be useful in your use case. It can be emb

Timerise 14 Dec 12, 2022
Gofiber with NextJS Static HTML is a small Go program to showcase for bundling a static HTML export of a Next.js app

Gofiber and NextJS Static HTML Gofiber with NextJS Static HTML is a small Go program to showcase for bundling a static HTML export of a Next.js app. R

Mai 1 Jan 22, 2022
Package fetcher is a bot messenger which gather npm packages by uploading either a json file (package.json) or a picture representing package.json. To continue...

package-fetcher Ce projet contient un boilerplate pour un bot messenger et l'executable Windows ngrok qui va permettre de créer un tunnel https pour c

AILI Fida Aliotti Christino 2 Mar 29, 2022
Meogic-tab-manager is an extensible, headless JavaScript tab manager framework.

MeogicTabManager English document MeogicTabManager是一个有可拓展性的、headless的JavaScript标签页管理框架。 MeogicTabManager旨在提供可自由组装页面框架、自定义页面组件、甚至覆盖框架自带事件响应的开发体验。 Meogi

meogic-tech 5 Oct 8, 2022
A package manager for the web

Bower - A package manager for the web ..psst! While Bower is maintained, we recommend yarn and webpack or parcel for new front-end projects! Bower off

Bower 15.1k Jan 1, 2023
📦🚀 Fast, disk space efficient package manager

中文 | Español Fast, disk space efficient package manager: Fast. Up to 2x faster than the alternatives (see benchmark). Efficient. Files inside node_mod

pnpm 21.2k Jan 3, 2023
frontend package manager and build tool for modular web applications

THIS PROJECT IS DEPRECATED Component is not maintained anymore. See here #639 for more information. You can still use the component registry on compon

Component 4.6k Dec 30, 2022
A next-generation package manager for the front-end

Duo is a next-generation package manager that blends the best ideas from Component, Browserify and Go to make organizing and writing front-end code qu

Duo 3.4k Dec 28, 2022
JavaScript package manager - using a browser-focused and RequireJS compatible repository

****NOTE: this project is no longer active and not recommended for use. It is left here for reference. **** Jam was created at a time before Bower and

Caolan McMahon 1.5k Dec 10, 2022
Package manager faster than NPM

Pine Script holder that runs faster than NPM and yarn Pine is a npm and yarn run like module, that allows you to organize your scripts and run them FA

Darkling 4 Jul 10, 2021