投稿時間:2022-08-14 12:19:27 RSSフィード2022-08-14 12:00 分まとめ(22件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT 気になる、記になる… 「Microsoft Office」アプリ、次期アップデートでiPadの手書き文字認識「スクリブル」をサポートへ https://taisy0.com/2022/08/14/160120.html apple 2022-08-14 02:30:17
TECH Techable(テッカブル) 仕事が断然はかどる!24インチディスプレイ2つを備えるモニター「Geminos」はウェブカムも搭載 https://techable.jp/archives/184153 geminos 2022-08-14 02:00:08
python Pythonタグが付けられた新着投稿 - Qiita 簡単なICPスキャンマッチング(1スキャン分)をpythonでやってみた https://qiita.com/koki2022/items/0f047e8d696620df6dc6 anaconda 2022-08-14 11:59:50
python Pythonタグが付けられた新着投稿 - Qiita 【競技プログラミング】最長増加部分列を解いてみた【組合せ最適化】 https://qiita.com/kindamu24005/items/e2990a1df48f40502b81 競技プログラミング 2022-08-14 11:55:41
python Pythonタグが付けられた新着投稿 - Qiita 超初心者のための『勢いで学ぶPython』 https://qiita.com/tatataichi/items/ee31ff9141e6df9cd06a googlecolab 2022-08-14 11:02:27
AWS AWSタグが付けられた新着投稿 - Qiita Amazon Lightsail Wordpressでブログサイトを作る https://qiita.com/e-onm/items/9ac06fc35c6cdb3d5e00 amazonlightsailwordpress 2022-08-14 11:42:52
AWS AWSタグが付けられた新着投稿 - Qiita 【ベストプラクティス】Amazon VPC の構築方法を分かりやすく解説 https://qiita.com/c60evaporator/items/b9e645b96afa3a34f41e amazonvpc 2022-08-14 11:03:31
AWS AWSタグが付けられた新着投稿 - Qiita 【Terraform】S3のライフサイクルルールの設定 https://qiita.com/masato930/items/bd48c0d520223935f664 terraform 2022-08-14 11:03:26
海外TECH DEV Community JS MODULE LOADERS; or, a brief journey through hell https://dev.to/tythos/js-module-loaders-or-a-brief-journey-through-hell-2d2n JS MODULE LOADERS or a brief journey through hell IntroductionThere s a saying in defense circles amateurs talk strategy professionals talk logistics In other words what seems like the most mundane element of complex engineering tasks moving stuff on time from point A to point B is a surprisingly critical element of success If I had to force an analogy here I d say for the developer community that amateurs talk code professionals talk integration It turns out that writing code especially from scratch is surprisingly easy whereas putting code together especially code you didn t write yourself is surprisingly difficult So in the world of JavaScript how do we put code together Well it depends In the year of our lord two thousand and twenty two years after JavaScript was released we still don t have a consistent way to integrate units of code together We don t even have a consistent way to define what those units of code are The ProblemsYou ll note the word consistent though There are many ways you could go about it but few ways that are truly interoperable Let s break this into three specific problems How are packages managed How are modules exported How are modules specified For example the answer to could be NPM Yarn or some kind of CDN It could also be as simple as git submodules For reasons I won t dive too deeply into I prefer the latter approach in particular because it is completely decoupled from the module you are developing and even the language you are developing in The answer to could be something like AMD RequireJS modules or CommonJS Node or browser level script tags within a global scope yuck Of course Browserify or WebPack could help you here if you re really a big fan of the latter I m a big fan of AMD RequireJS but there s no arguing that being able to run and test a codebase from the command line locally or remotely is HUGELY advantageous both for development just messing around and for deployment e g automated testing from a CI job The answer to is a little more subtle in no small part because with something like CommonJS Node it s entirely implicit With AMD RequireJS you have specific require exports and module parameters to a define function These exist in CommonJS Node too but they re implied Try printing module to console log sometime and look at all the juicy details you ve been missing SFJMs and UMDBut this doesn t include the contents of your package json if any and even with AMD RequireJS there s no specific standard for attaching metadata and other module properties That s one reason I put together the SFJM standard in a previous dev to article But regardless of your approach the module loader e g export problem outlined in above is going to be sticky That s one reason the UMD standard has emerged for which there is an excellent writeup by Jim Fischer UMD specifies a header to be pasted in front of your define like closure It s used by a few major libraries including support for certain build configurations like THREE js The HeaderThe UMD header has several variations but we ll consider the following one from Jim Fischer s writeup myModuleName js function root factory if typeof define function amp amp define amd AMD Register as an anonymous module define exports b factory else if typeof exports object amp amp typeof exports nodeName string CommonJS factory exports require b else Browser globals factory root myModuleName root b typeof self undefined self this function exports b Use b in some fashion attach properties to the exports object to define the exported module properties exports action function There are effectively three use cases captured here AMD RequireJS CommonJS Node and browser globals Let s be honest though it s ugly This isn t a hack at Jim this is a general UMD problem Among other things here s what bugs me It s just plain bulky that s a lot of text to paste at the top of every moduleIt actually tries too hard I ve never found a need to support browser globals I just need my AMD RequireJS based single file JavaScript modules to be able to run test in a CommonJS Node environmentThe dependency listings are explicitly tied into the header so it s not actually reusable You have to customize it for every module Compare this to simply specifying const b require b within the closure factory itself and clearly there s a big difference I m not interested in treating usecases equally I m writing in AMD RequireJS and capturing CommonJS Node loading is the edge case The main problem here with the last point is AMD RequireJS already give us a very clean closure and explicitly module definition interface It s CommonJS Node that require the hack So can we streamline the header and focus on adapting the latter to the former Preferably in a way that is agnostic to dependencies Well since I m writing this article you can probably tell the answer is yes My ApproachLet s start with symbols What s available and what isn t Let s start with a AMD RequireJS module already defined and working If you put yourself in the mind of the CommonJS Node interpreter the first thing you ll realize is that while require exports and module are already defined implicitly the define factory is not So this is the root of our problem we need to define a define ha ha factory that guides CommonJS Node to interpret the module definition closure in a consistent way There s a good example of the conditional for this from UMD that we can borrow and adjust slightly if typeof define function define amd true Interestingly you can t just check to see if define exists You need to make sure it doesn t actually exist AS THE AMD IMPLEMENTATION because CommonJS Node may retain the define symbol outside of this context for example in the scope of another module that is require ing this one Bizarre but true So now our goal is to define define How can this be adapted to a CommonJS Node scope What we need to ensure is the existence of an identical define interface It should take a single parameter an anonymous function which we will call the factory here within whose closure the module contents are defined That function should have the following interface require a function that resolves returns any module dependencies based on path exports an Object that defines what symbols will be available to external modules and module a definition of module properties that includes module exports which points to exports Define should call that function and return the export symbols of the module In the case of a SFJM compatible definition this will also include package json like module metadata including a map of dependencies The last point is interesting because a there s already multiple references to the module exports and b even AMD RequireJS supports multiple optional routes for export symbols And this is one of the stickiest issues at the heart of cross compatibility the exports symbol can persist and be incorrectly mapped by CommonJS Node if not explicitly returned Thanks Exports You re The Real thing preventing us from reaching MVPJesus what a nightmare For this reason we are going to adjust how our factory closure works We are going to explicitly disable the exports parameter by passing an empty Object as the second parameter to the factory We are going to explicitly return the module exports from the factory implementationWe are going to explicitly map the results of the factory call to the file level module exports property The combination of these adjustments means that while AMD RequireJS supports multiple routes we are going to constrain our module implementations to explicitly returning export symbols from the factory call to route them to the correct CommonJS Node symbol If you don t do this and I lost some hair debugging this you end up with a very interesting read batshit insane in only the way CommonJS Node can be bug in which the parent module require ing a dependency module gets wires crossed and has export symbols persist between scopes It s bizarre particularly because it ONLY HAPPENS OUTSIDE THE REPL So you can run equivalent module methods from the REPL and they re fine but trying to map it within the module itself and then say calling it from the command line will break every time So what does this look like practically It means the define definition we are putting into the conditional we wrote above looks something like this define factory gt module exports factory require module It also means our module closure starts with explicitly disabling the exports symbol so poor old CommonJS Node doesn t get wires crossed define function require module let exports Sigh Some day it will all make sense But then it won t be JavaScript ExamplesWhat does this look like in the wild then Here s a GitHub project that provides a reasonably clear example A brief tour index js shows how the entry point can be wrapped in the same closure that uses the require call to transparently load the dependency index js also shows us how to add a SFJM style hook for from CommonJS Node running an entry point main should this module be called from the command line gitmodules tells us that the dependency is managed as a submodule lib contains the submodules we use lib jtx is the specific submodule reference don t forget to submodule init and submodule update in this case it points to the following utility of JavaScript type extensions whose single file JavaScript module can be seen here This module uses the same UMD light as I m calling it for now header The Problem ChildAnd now for the wild card There is in fact yet another module export approach we haven t mentioned ES style module import export usage And I ll be honest I ve spent an unhealthy portion of my weekend trying to figure out if there s any reasonable uncomplicated way to extend cross compatibility to cover ES MJS implementations My conclusion it can t be done at least not without making major compromises Consider They re incompatible with the CommonJS Node REPL so you loose the ability to inspect test from that environmentThey re incompatible with a define closure factory so there go all of those advantagesThey directly contradict many of the design principles not to mention the implementation of the web oriented AMD RequireJS standard including asynchronous loading it s in the name people They have interesting assumptions about pathing that can be very problematic across environments and since it s a language level standard you can t extend customize it by submitting MRs to say the AMD RequireJS project something I ve done a couple of times not to mention the nightmare this causes in your IDE if path contexts get mixed up The tree shaking you should be able to reverse engineer from partial imports e g symbol extraction saves you literally zero anything in a web environment where your biggest cost is just getting the JS from the server and through the interpreter If anything your best bet seems like THREE js to only use them to break a codebase into pieces if it s too big for a single file approach which I try to avoid anyway then aggregate those pieces at build time with WebPack Browserify etc into a module that uses a CommonJS Node AMD RequireJS or UMD style header to ensure cross compatibility Sorry ES import export but you may have actually made things worse 2022-08-14 02:07:18
ニュース @日本経済新聞 電子版 不動産「活況」の死角 迫るビル大量供給、変調の兆しは https://t.co/VdSSVXNBlg https://twitter.com/nikkei/statuses/1558640239924486144 活況 2022-08-14 02:22:45
ニュース @日本経済新聞 電子版 明日は我が身か、我が社か 欧米インフレ狂騒曲 https://t.co/RfoLMGk1Tt https://twitter.com/nikkei/statuses/1558640238439698432 狂騒 2022-08-14 02:22:45
ニュース @日本経済新聞 電子版 学校PTA、同調圧力の果て 「効率より平等」いつまで https://t.co/SpoX1mw2pn https://twitter.com/nikkei/statuses/1558637444135718913 同調圧力 2022-08-14 02:11:39
海外ニュース Japan Times latest articles Over 100 Japan lawmakers had links with Unification Church: survey https://www.japantimes.co.jp/news/2022/08/14/national/politics-diplomacy/unification-church-links-survey/ response 2022-08-14 11:41:30
ニュース BBC News - Home Salman Rushdie off ventilator and able to talk https://www.bbc.co.uk/news/world-us-canada-62537389?at_medium=RSS&at_campaign=KARANGA rushdie 2022-08-14 02:47:24
北海道 北海道新聞 ASソロ、比嘉もえが優勝 世界ユース選手権 https://www.hokkaido-np.co.jp/article/717584/ 世界ユース選手権 2022-08-14 11:41:00
北海道 北海道新聞 南部ヘルソン奪還作戦が失速か 兵器不足と米紙報道 https://www.hokkaido-np.co.jp/article/717520/ 奪還作戦 2022-08-14 11:24:31
北海道 北海道新聞 <市場発!>進化続く道産スイカ より甘く、より食べやすく 手間いらずのカット売り、小玉も人気 https://www.hokkaido-np.co.jp/article/717116/ 最高気温 2022-08-14 11:37:15
北海道 北海道新聞 カブス鈴木は5打数無安打 レッズ戦 https://www.hokkaido-np.co.jp/article/717583/ 打数 2022-08-14 11:34:00
北海道 北海道新聞 お盆Uターンラッシュがピークに 第7波影響も交通機関混雑 https://www.hokkaido-np.co.jp/article/717576/ 交通機関 2022-08-14 11:29:00
北海道 北海道新聞 馬場咲希が決勝進出 全米女子アマチュア選手権 https://www.hokkaido-np.co.jp/article/717575/ 決勝進出 2022-08-14 11:15:00
北海道 北海道新聞 横浜2―3聖光学院 聖光学院が競り勝つ https://www.hokkaido-np.co.jp/article/717566/ 聖光学院 2022-08-14 11:03:00
海外TECH reddit [SPOILER] Marlon Vera vs. Dominick Cruz https://www.reddit.com/r/MMA/comments/wnuqxi/spoiler_marlon_vera_vs_dominick_cruz/ SPOILER Marlon Vera vs Dominick Cruz submitted by u redjum to r MMA link comments 2022-08-14 02:04:18

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)