Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
calro
Search
Yosuke Kurami
November 19, 2018
4
580
calro
roppongi.js #7向け
Yosuke Kurami
November 19, 2018
Tweet
Share
More Decks by Yosuke Kurami
See All by Yosuke Kurami
App Router 悲喜交々
quramy
7
430
上手に付き合うコンポーネントテスト
quramy
4
1.6k
Patched fetch did not work
quramy
6
540
GraphQL あるいは React における自律的なデータ取得について
quramy
16
4.2k
Next.js App Router
quramy
15
3k
Fragment Composition of GraphQL
quramy
16
3k
reg-viz VRT tools
quramy
4
1.2k
NoInfer
quramy
0
210
Precondition with schema directives
quramy
0
1.4k
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
KATA
mclloyd
29
14k
Scaling GitHub
holman
458
140k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
How STYLIGHT went responsive
nonsquared
95
5.2k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Designing for humans not robots
tammielis
250
25k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Transcript
Carloͷ Roppongi.js #7
About me
Carloͱ • https://github.com/GoogleChromeLabs/ carlo • Googleᐌ͘ ʮheadful Node app frameworkʯ
None
Node.js + Chromium • CarloChromiumΛը໘ඳըΤϯδϯͱͯ͠ ಈ࡞͢ΔNode.js ΞϓϦέʔγϣϯϑϨʔϜ ϫʔΫ • Node.jsɺChromiumͱʹV8͕ಈ࡞͢Δͨ
ΊɺJavaScriptͷΈͰσεΫτοϓΞϓϦ͕࡞ ΕΔ
͍ํ
Demo https://github.com/Quramy/carlo-git-graph
ElectronNW.jsͱͷҧ͍
ϥϯλΠϜϑΝΠϧαΠζ • Electron / NW.jsChromiumͷϨϯμϥϓϩ ηε͔ΒNode.jsΞΫηεͰ͖ΔΑ͏ʹ͠ ͨɺಠࣗͷϥϯλΠϜΛඞཁͱ͢Δ • ͍͕ͭ͜૬ॏ͍ͨ
(ࢀߟ) ElectronͷϑΝΠϧαΠζ https://github.com/electron/electron/releases/tag/v3.0.8
ElectronNw.jsͷ • Electron / NW.jsͰ࡞ͨ͠ΞϓϦέʔγϣϯ Λ͢Δ߹ɺಠࣗϥϯλΠϜࣗମ bundleͯ͢͠Δͷ͕Ұൠతɻ (Ϣʔβʔී௨ɺElectron NW.jsΛࣄલʹ Πϯετʔϧͯ͠ͳ͍)
• ඞવతʹͷαΠζ͕ڊେԽ͢Δ
CarloͰ࡞ͬͨΞϓϦͷ • CarloϢʔβʔ͕Πϯετʔϧ͍ͯ͠Δ ChromeΛͦͷ··ར༻͢Δ • Node.jsΛطʹΠϯετʔϧ͍ͯ͠ΔϢʔβʔ ͢ΔͷͰ͋ΕɺNPMͰे
CarloͰ࡞ͬͨΞϓϦͷ • Node.js͚ͩΛόϯυϧͯ͢͠Δ߹ɺ https://github.com/zeit/pkg Λར༻͢ΔͱΑ ͍Β͍͠
nodeIntegration • ElectronͰσϑΥϧτͰ nodeIntegrationͱ ͍͏ػೳ͕onʹ͞Ε͍ͯΔ • ͜ΕɺϨϯμϥϓϩηε(ཁ͢Δʹը໘)͔ ΒɺNode.jsͷAPIΛ৮ΕΔɺͱ͍͏ػೳ
nodeIntegration • ը໘͔ΒNode.jsʹ৮ΕΔͱ͍͏͜ͱ ͱ͔͕ී௨ʹಈ͍ͯ͠·͏ • ΞϓϦέʔγϣϯʹXSSͷ੬ऑੑΛຒΊࠐΜͩ ͱ͖ͷඃ͕௨ৗͷWebΞϓϦͷൺ͡Όͳ͍ require('child_process').execSync('ls')
nodeIntegration • CarloͰɺࣗͰબͨ͠Node.jsͷؔͷ Έ͕ɺ໌ࣔతʹChromiumଆެ։͞ΕΔํࣜ • XSS͕͋ͬͨͱ͜ΖͰɺElectron΄Ͳͷඃʹ ͳΒͳ͍ͣ
CarloͱPuppeteer
CarloͱPuppeteer • CarloPuppeteerͰChromiumΛNode.js͔Βૢ࡞ͯ͠ ͍Δ • Puppeteerͱ • ͜ΕGoogleͷϥΠϒϥϦ • ChromiumΛࣗಈԽ͢ΔతͰ࡞ΒΕ͍ͯΔ
• Chrome Devtool ProtocolͷΫϥΠΞϯτ
CarloͱPuppeteer • NPMͷpuppeteerύοέʔδɺChromiumͷϥ ϯλΠϜΛpost installͰϩʔΧϧʹΠϯετʔϧ ͯ͘͠Δ • ૢ࡞෦ͷΈΛΓग़ͨ͠puppeteer-coreͱ͍ ͏ύοέʔδ͋Δɻ͍ͭ͜ϩʔΧϧΠϯετʔ ϧΛߦΘͳ͍ɻ
Carlo͕͍ͬͯΔͷͬͪ͜
CarloͱPuppeteer • ࣮ࡍͷͱ͜Ζɺݱঢ়ͷCalroPuppeteerͷബ ͍ϥούʔͰ͔͠ͳ͍ • CarloͷAPIʹఆٛ͞Ε͍ͯΔ exposeFunction ͳͲPuppeteerͷಉ໊ؔʹҕৡ͍ͯ͠Δͩ ͚
Node.js <=> Chromimum /PEFKTͷؔΛ $ISPNJVNଆ͔Βݺͼग़͠Մೳʹ͢Δ
·ͱΊ • CarloPuppeteerΛར༻ͨ͠σεΫτοϓΞϓϦΤ ϯδϯ • PuppeteerͷAPIͬͯΕͲ͏ͱͰͳΔ • Electron / NW.jsΑΓࣗ༝͍͕ϑΝΠϧαΠ
ζͳͲͷ໘Ͱ༗ར • CLIʹͪΐͬͱͨ͠ը໘Λ͍ͨͤͨͱ͖ʹศར͔
Thank you!