並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 40 件 / 131件

新着順 人気順

CommonJSの検索結果1 - 40 件 / 131件

  • 旧石器時代のJavaScriptを書いてる各位に告ぐ、現代的なJavaScript超入門 Section2 ~CommonJSモジュールと仲良くなろう~ - Qiita

    はじめに この記事は「旧石器時代のJavaScriptを書いてる各位に告ぐ、現代的なJavaScript超入門」の2つ目の記事です。 シリーズの最初から読みたい方は 旧石器時代のJavaScriptを書いてる各位に告ぐ、現代的なJavaScript超入門 Section1 ~すぐにでも現代っぽく出来るワンポイントまとめ~ へどうぞ。 また、このシリーズではECMAScript5を概ね対応するブラウザを対象としています。 もっと平たくいうと、IE8以下は切り捨てます。ご了承ください。 そしてプロによるマサカリ 対策として一つ重要な注意書きをします。 この記事中で出てくる「CommonJSモジュール」という表現は全て「CommonJSのModules 1.0仕様をベースとして、Node.jsが独自に拡張したCommonJS派生のモジュール仕様及びインターフェース(require/exports

      旧石器時代のJavaScriptを書いてる各位に告ぐ、現代的なJavaScript超入門 Section2 ~CommonJSモジュールと仲良くなろう~ - Qiita
    • JavaScriptのモジュール管理(CommonJSとかAMDとかBrowserifyとかwebpack) | tsuchikazu blog

      昨年のAdvent Calendarを眺めたり、JS周りの記事を見ていると、RequireJSとか、CommonJSとか、AMD、Browserify、webpackあたりが、同じような文脈で登場するんですが、それぞれ何を指しているのかよくわからなかったため、今更ながらまとめてみます。 前提 小規模にしかJavaScriptを使っていないWebサイトでは、jQueryを使ってDomイベントで色んな処理をして、Domに反映させる。というような処理が、ごちゃっとまとめて書くことが多いかと思います。ごちゃっととは、特にDomにしか情報を保持していない状態を指していて、イメージとしてはこのようなコードです。 $(function() { # イベントハンドラ $("#btn").on("click", function(){ $.ajax({ url: "api/resources", dataT

        JavaScriptのモジュール管理(CommonJSとかAMDとかBrowserifyとかwebpack) | tsuchikazu blog
      • CommonJS Spec Wiki

        Welcome to CommonJS, a group with a goal of building up the JavaScript ecosystem for web servers, desktop and command line apps and in the browser. This wiki is a starting point for collecting up ideas, any draft API suggestions for the CommonJS group. Discussions occur on that mailing list and on IRC (#commonjs on freenode). Meta Introduction FAQ Process Target Platforms Coding Standards Current

        • Node.js Dual Packages (CommonJS/ES Modules) に対応した npm パッケージの開発 - Cybozu Inside Out | サイボウズエンジニアのブログ

          こんにちは。フロントエンドエキスパートの平野(@shisama_)です。 フロントエンドエキスパートチームでは業務時間の 30 % の時間で技術探究を行っています。 今回は探究した技術の中から Node.js の ES Modules(以下 ESM)についてと Dual Package (CommonJS/ES Modules) に対応した npm パッケージの開発について紹介します。 ES Modules の特徴 ESM はブラウザ互換 ESM は Strict モード ESM は非同期 ESM は静的解析可能 Node.js の ESM 対応について Dual Package(CJS/ESM)に対応した npm パッケージの開発 Conditional Exports によるファイルの指定 .mjs と .cjs require など CJS 特有の機能を使う ESMから CJS ファ

            Node.js Dual Packages (CommonJS/ES Modules) に対応した npm パッケージの開発 - Cybozu Inside Out | サイボウズエンジニアのブログ
          • Node.jsとCommonJSについて - 自分の感受性くらい

            日経ソフトウェア8月号にJavaScriptの特集がありまして、そこでNode.jsが紹介されていました。 それを読んで、僕は以下のようなツイートしました。 日経ソフトウェア8月号のJavaScript特集のNode.jsの記事みたけど、これはちょっとひどいな。非公式のWindowsバイナリを使ってるせいでnpmの使い方おかしいし、「Node.jsのAPIはCommonJSに従った形で実装」とか嘘書いてあるし。 #nodejs_jp 2011-06-26 13:43:59 via web *1だと言わざるをえません。Node.jsはCommonJSの仕様のうち「Module 1.0」と「Unit Testing 1.0」には一応準拠していることになっています(http://wiki.commonjs.org/wiki/CommonJS#Implementations)。が、Node.jsの

            • CommonJSの話

              コンテナを止めるな! PacemakerによるコンテナHAクラスタリングとKubernetesとの違いとはksk_ha

                CommonJSの話
              • CommonJSからES Modulesへの移行する方法。トップダウンかボトムアップか


                Secretlint v7CommonJS ES Modules Secretlint v7.0.0Pure ESM CommonJS(CJS)ES Modules(ESM) CJSESM調 CJSESM   ESM Secretlintmonorepo40 
                  CommonJSからES Modulesへの移行する方法。トップダウンかボトムアップか
                • Server-side JavaScript と CommonJS - hagino3000's blog


                  Python Hack-a-thon #3LTslide shareupGoogle App EngineServer-side JSCommonJS Google App Engine ServerSide JavaScriptView more presentations from hagino 3000. nitro使GAEjs Rhino CommonJS Narwhal jack nitro  Rhino JavaScriptJavaServletRhinoJavaScript
                    Server-side JavaScript と CommonJS - hagino3000's blog
                  • CommonJS is not going away | Bun Blog

                    We're hiring C/C++ and Zig engineers to build the future of JavaScript! Join our team → Some may be surprised to see the recent release notes for Bun mention CommonJS support. After all, CommonJS is a legacy module system, and the future of JavaScript is ES Modules (ESM), right? As a "forward-thinking" "next-gen" runtime, why would Bun put so much effort into improving CommonJS support? The latest

                    • 複数のモジュール形式(CommonJS, ES Modules, UMD)をサポートしたnpmパッケージの作り方 in TypeScript - dackdive's blog


                       npm  Node.js CommonJS  (module.exports / require() ) webpackRollup CommonJS  ES Modules  (export / import ) 使<script> UMD   TypeScript 
                        複数のモジュール形式(CommonJS, ES Modules, UMD)をサポートしたnpmパッケージの作り方 in TypeScript - dackdive's blog
                      • # CommonJS と ES6の import/export で迷うなら - Qiita

                        はじめに いつもはes6のモジュール管理方式であるimport/export(ES modules)を使って、npmで手に入れたライブラリや自分で作成したモジュールをロードしているが、たまに思った挙動にならないことがある。また、export defaultしたモジュールをテストしようとしてkarmaでrequire()するとエラーになったりした。そういう場合は、とりあえずmodule.exportsを使ってみるとうまくいったりすることが多いのだが、なぜなのかはあまり考えていなかった。 ということで、実際にはどうなっているのか、またモジュールシステムとは何なのかという点で基本的なことから理解を深めて、es6のimport/exportとの違いを知り、より正しく実装できるようになれば良いと思っている。 結論としては 方針としては基本的にはES6形式で記述するが、CommonJS形式の読み書きが

                          # CommonJS と ES6の import/export で迷うなら - Qiita
                        • CommonJS is hurting JavaScript

                          JavaScript, the undisputed king of web development, is being sabotaged — not by a rival language or a revolutionary new technology, but by its own baggage from the past. This insidious saboteur is none other than CommonJS, the antique module system that we’ve tolerated for far too long. The rise of CommonJSAbout 15 years after its invention, JavaScript started expanding beyond the browser to the s

                            CommonJS is hurting JavaScript
                          • [混沌すぎ] Middlemanはこれから sprocket を辞めて CommonJS するようです [グロた] - Qiita


                             monpy   Facebook   JavaScriptJavaScript Section4 Gulp  Gulp    Gulp  Gulp 調 first commit  4 Jul 2013 25 2 gulp ()  mi
                              [混沌すぎ] Middlemanはこれから sprocket を辞めて CommonJS するようです [グロた] - Qiita
                            • Writing Modular JavaScript With AMD, CommonJS & ES Harmony

                              Writing Modular JavaScript With AMD, CommonJS & ES Harmony When we say an application is modular, we generally mean it's composed of a set of highly decoupled, distinct pieces of functionality stored in modules. As you probably know, loose coupling facilitates easier maintainability of apps by removing dependencies where possible. When this is implemented efficiently, its quite easy to see how cha

                              • ECMAScript modulesとCommonJS modulesの使い分け - Qiita

                                個人の感想です。 規約 相対パスは ECMAScript modules で import/export それ以外は Common JS で require/module.exports 意味 内界 - プロジェクト内のコードはECMAScript modulesでやり取り 外界 - npmパッケージを require や、package.jsonの "main" へのexportはCommonJSでやり取り 例 const fs = require("fs"); const path = require("path"); const mkdirp = require("mkdirp"); const Promise = require("bluebird"); const debug = require("debug")("textlint:cli"); import options f

                                  ECMAScript modulesとCommonJS modulesの使い分け - Qiita
                                • GitHub - sverweij/dependency-cruiser: Validate and visualize dependencies. Your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.

                                  You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                                    GitHub - sverweij/dependency-cruiser: Validate and visualize dependencies. Your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.
                                  • GitHub - bytespider/jsOAuth: JavaScript implimentation of the OAuth protocol. Currently supports version 1.0 (RFC5849) of the specification. Node.js & CommonJS compatible.

                                    [Abandoned] This library is old and unmaintained. There are far better and more modern alternatives. jsOAuth - JavaScript OAuth library jsOAuth is a javascript library implementing the OAuth protocol. jsOAuth aims to form the basis of custom clients such as Twitter and Yahoo. Written in JavaScript, jsOAuth aims to be a fully featured open source OAuth library for use in Adobe AIR, Appcelerator Tit

                                      GitHub - bytespider/jsOAuth: JavaScript implimentation of the OAuth protocol. Currently supports version 1.0 (RFC5849) of the specification. Node.js & CommonJS compatible.
                                    • CommonJS Modules in Titanium - JP::HSJ::Junknews::HatenaSide

                                      この記事はAppcelerator公式Wikiのドキュメント(Dec 20, 2011更新版)に基づき、和訳±αしたものです。 https://wiki.appcelerator.org/display/guides/CommonJS+Modules+in+Titanium (補足:Titanium Mobile SDK 1.7.x以前とは状況が異なる部分もありますので、1.8.x前提ということでご覧ください) 概要 Titnianium Mobileは利用者がJavaScriptのコードを組み立てる方法としてCommonJSモジュール仕様を採用しようとしつつあります。 しかし、CommonJSモジュールは"標準的な"仕様である一方、複数のテクノロジ間で実装の違いがあります。 そのため、Titanium Mobile 1.8(やそれ以降の)の実装において何がサポートされ、何がサポートされて

                                        CommonJS Modules in Titanium - JP::HSJ::Junknews::HatenaSide
                                      • シングルコンテキストかつCommonJSなTiサンプルを読む(draft) - JP::HSJ::Junknews::HatenaSide

                                        ひとまず草稿/推敲不足版です。 ツッコミがあればこそこそ直して行きます(^^; Titanium Mobile 2.0からAPIデモアプリであるKitchenSinkがついにというか、ようやくCommonJSアプリになり、公的なサンプルとしてTitanium 0.9からの伝統のマルチコンテキストモデルがなくなるという事態となりました。 拙著をものした時期というのがCommonJS化が加速する直前のTitanium Mobile 1.6.xのころで、今となっては目も当てられない状態になってしまっているのですが、それはさておき。 シングルコンテキストかつCommonJS時代を迎えたTiの初期ソースはどうなるのかを見てきたいと思います。 https://github.com/appcelerator-developer-relations/Template.SingleWindow ファイル構成

                                          シングルコンテキストかつCommonJSなTiサンプルを読む(draft) - JP::HSJ::Junknews::HatenaSide
                                        • app/assets/javascripts以下のJSを全てcommonjsのrequireに書き換える - Qiita


                                          gulp使jsJSbrowserify_railsbrowserify-incremental(transform)gulp browserify_rails commonjs browserify_rails hokaccha便 JavaScript on Rails -  browserify
                                            app/assets/javascripts以下のJSを全てcommonjsのrequireに書き換える - Qiita
                                          • webpack/webpack: A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows to load parts for the application on demand. Through "loaders," modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffee

                                            You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                                              webpack/webpack: A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows to load parts for the application on demand. Through "loaders," modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffee
                                            • ブラウザにCommonJSを簡単に提供するスニペット - Islands in the byte stream (legacy)


                                              CommonJS (+node.js )browserbuild1browserbuild  https://github.com/gfx/require-simple.js // require-simple.js function require(name) { "use strict"; if(!require.modules) { require.modules = {}; } if(require.modules[name]) { if(requi
                                                ブラウザにCommonJSを簡単に提供するスニペット - Islands in the byte stream (legacy)
                                              • CommonJSとES Modulesについてまとめる

                                                モチベーション 普段フロントエンドを領分にしているのになかなかこのあたりの基礎が足りていないと感じることが多いので、なんとかしたい。 ES Modules方式でしか対応されていないライブラリを使おうとしてコケたので色々調べたのも含め、まとめていく。 ちなみにその辺りについてはこの神記事見ると良い。 個人的に気になっているモジュールシステムについて掘り下げていく。 CommonJS CommonJSとは、サーバーサイドなどのウェブブラウザ環境外におけるJavaScriptの各種仕様を定めることを目標としたプロジェクトである。 from Wikipedia 例えばNode.jsで使われている。 Node.jsはデフォルトで全てのモジュールをCommonJSで扱うが、Node.jsは最近のバージョンでES Modulesに対応するなどしていて、潮流はES Modulesに流れつつある。 後述する

                                                  CommonJSとES Modulesについてまとめる
                                                • Hybrid npm packages (ESM and CommonJS)

                                                  Warning: This blog post is outdated. It may contain incorrect information. Update 2019-11-22: ESM support in Node.js is not experimental, anymore. This post was updated to reflect that. Conditional exports are now explained. In this blog post, we look at npm packages that contain both ES modules and CommonJS modules. Required knowledge: How ES modules are supported natively on Node.js. You can rea

                                                  • 名古屋Reject会議でCommonJSの話をしてきました - terurouメモ

                                                    名古屋Reject会議という怖いところで20分ぐらい話してきました。 Common jsの話View more presentations from terurou.

                                                      名古屋Reject会議でCommonJSの話をしてきました - terurouメモ
                                                    • 非CommonJSモジュールなJavaScriptコードを本体変更無しにCommonJS対応にする - Qiita

                                                      背景 最近TypeScriptコンパイラ触る時とかPEG.jsで生成したパーサを使う時とかに、トップレベルにTypeScriptとかPEGとかいう変数がポコンと作られるだけのコードがあります。 こう…俺はこういうコードを追加してほしいんだよ…!!みたいな気持ちになります。 (function (global) { var lib = ...; // なんか適当にライブラリの定義 if (typeof define === 'function' && define.amd) { define(function() { return lib; }); } else if (typeof exports === 'object') { module.exports = lib; } else { global.lib = lib; } })(this); ライブラリ本体にpull request

                                                        非CommonJSモジュールなJavaScriptコードを本体変更無しにCommonJS対応にする - Qiita
                                                      • AMD vs. CommonJS. Which is better?

                                                        • CommonJS AMDとDeferred - monjudoh’s diary

                                                          Writing Modular JavaScript With AMD, CommonJS & ES HarmonyのModules With Deferred Dependenciesが便利なので活用してる。 初期化処理が非同期処理でrequireしてきても即使えるとは限らない場合に使う。 モジュール側ではモジュールそのものではなくてpromiseを返しておいて、モジュールの実体が完成したらresolveで渡す。 使う側はrequireしてきたpromiseのthenメソッドのcallbackでモジュールの実体を受け取って使う。 // 何らかの非同期処理を経て初期化されるモジュール define('someModule',['jquery'],function($){ var dfd = $.Deferred(); setTimeout(function(){ // モジュールとして実際

                                                            CommonJS AMDとDeferred - monjudoh’s diary
                                                          • [Titanium勉強日記 6] CommonJSモジュールとrequireについて調べた – taichino.com

                                                            学校が始まったのと、触っていくにつれてTitaniumが銀の弾丸ではない事が分かってきて、ペースダウンしてしまっているのですが、一応継続してTitaniumの習得を試みています。 表題の件なのですが、Titaniumの1.8以降ではシングルコンテキストなコーディング作法というのが推奨されています。その作法ではrequire関数でモジュールをロードします。まぁrequireを使っている分にはあまり疑問も無かったのですが、先日試してみた軽量ORMのjoliに含まれていた以下のコードを見て疑問が湧いてきました。 /** * In case joli.js is loaded as a CommonJS module * var joli = require('joli').connect('your_database_name'); * var joli = require('joli').co

                                                            • GitHub - avocode/combokeys: Web browser keyboard shortcuts. CommonJS, NPM.

                                                              You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                                                                GitHub - avocode/combokeys: Web browser keyboard shortcuts. CommonJS, NPM.
                                                              • AMDとCommonJSを考える

                                                                ひとりアドベントカレンダー17日目の記事。 今回はJSのモジュール定義について紹介します。 実は、今世間一般で使われてるJavaScriptには、まともなモジュール読み込みの構文が存在しない(!)。 そういうわけなので、外部モジュールに分割されたライブラリを読み込みたいんだ!っていう時は、ユーザーランドで色々ハックして頑張らないといけないのが現状。そんなJSモジュール定義の世界では現在、AMD, CommonJSという2大シンタックスが君臨しており、それぞれが全く異なる特徴を持っている。 色々なモジュール定義 CommonJS CommonJS。普段Nodeを書いている人は結構馴染みがあると思う。 // some-cjs-module.js module.exports = "hello world"; // test-cjs-module.js var someModule = req

                                                                  AMDとCommonJSを考える
                                                                • require1k — CommonJS require for the browser in 1k

                                                                  <script>R=function(e,n,v1){function t(e,o,u,a){if(e.g)return o(e.e,e);var c=e.g=e.l,f=new XMLHttpRequest;f.onload=function(i,l){function s(){l--||o(n,e)}200==f.status||e.t?(i=[],(e.t=e.t||f.response).replace(/(?:^|[^\w\$_.])require\s*\(\s*["']([^"']*)["']\s*\)/g,function(e,n){i.push(n)}),l=i.length,i.map(function(o){t(r(e.l,o),s,"."!=o[0]?c+"/../":n,o)}),s()):u?t(e.n=r(u+="../",a),o,u,a):(e.e=f,o(

                                                                  • webpack 4: import() and CommonJs

                                                                    Actually there are a lot of cases to consider when using import(). But let’s start with few naming hints: Source: the module containing the import() expression Target: the module referenced by the request in the import() expression non-ESM: a CommonJs or AMD module not setting __esModule: true transpiled-ESM: a CommonJS module setting __esModule: true because it was transpiled from ESM ESM: a norm

                                                                      webpack 4: import() and CommonJs
                                                                    • Babel and CommonJS modules

                                                                      This blog post examines how Babel ensures that code it transpiles interoperates properly with normal CommonJS modules. Consult chapter “Modules” in “Exploring ES6” for more information on ES6 modules. Starting point for this series of posts on Babel: “Configuring Babel 6” ES6 modules vs. CommonJS modules  # ECMAScript 6 modules  # Default export (single export): // lib.js export default function (

                                                                      • 7.14.0 Released: New class features enabled by default, TypeScript 4.3, and better CommonJS interop · Babel

                                                                        Babel 7.14.0 is out! This release enables class fields and private methods by default (they were promoted to Stage 4 during the recent April TC39 meeting!) and adds brand checks for private fields and static class blocks to @babel/preset-env's shippedProposals option. We added support for Stage 1 async do expressions (using @babel/plugin-proposal-async-do-expressions), which extends the Stage 1 do

                                                                          7.14.0 Released: New class features enabled by default, TypeScript 4.3, and better CommonJS interop · Babel
                                                                        • Promises/A - CommonJS Spec Wiki

                                                                          Proposal A promise represents the eventual value returned from the single completion of an operation. A promise may be in one of the three states, unfulfilled, fulfilled, and failed. The promise may only move from unfulfilled to fulfilled, or unfulfilled to failed. Once a promise is fulfilled or failed, the promise's value MUST not be changed, just as a values in JavaScript, primitives and object

                                                                          • GitHub - sstephenson/stitch: Stitch your CommonJS modules together for the browser

                                                                            You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                                                                              GitHub - sstephenson/stitch: Stitch your CommonJS modules together for the browser
                                                                            • CommonJS Modules in Titanium - Documentation & Guides - 2.0 - Appcelerator Wiki

                                                                              SynopsisTitanium Mobile is moving toward the adoption of the CommonJS module specification as the way in which end users of the platform structure their JavaScript code. While CommonJS Modules are a "standard" specification, there are differences in implementation across multiple technology stacks. Since Titanium SDK 7.1.0, you can also use ES6+ classes to export your modules instead, e.g. by usin

                                                                              • Modules/AsynchronousDefinition - CommonJS Spec Wiki

                                                                                STATUS: PROPOSAL Implementations [[Implementations/RequireJS|]], [[Implementations/Nodules|]], [[Implementations/Yabble (partial)|]], [[Implementations/Dojo|]], [[Implementations/Transporter|]], [[Implementations/Teleport|]], [[Implementations/PINF (partial)|]], [[Implementations/curl.js|]] NOTE: This document is retained for historical purposes, but the evolution of this API is now tracked on the

                                                                                • Erbix:CommonJS準拠のサーバサイドJavaScriptホスティングプラットフォーム

                                                                                  Rustが再評価される:エコシステムの現状と落とし穴 In this article, we share findings and insights about the Rust community and ecosystem and elaborate on the peculiarities and pitfalls of starting new projects with Rust or migrating to Rust from othe...

                                                                                    Erbix:CommonJS準拠のサーバサイドJavaScriptホスティングプラットフォーム