techhub.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A hub primarily for passionate technologists, but everyone is welcome

Administered by:

Server stats:

4.6K
active users

#ClosureCompiler

0 posts0 participants0 posts today
Aral Balkan<p>While working on porting the Small Technology Foundation web site¹ to Kitten², I took the opportunity to pull out base Model and Collection classes that I’ll likely end up including in Kitten proper:</p><p>• Model: <a href="https://codeberg.org/small-tech/site/src/branch/kitten/app_modules/database/Model.js" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">codeberg.org/small-tech/site/s</span><span class="invisible">rc/branch/kitten/app_modules/database/Model.js</span></a><br>• Collection: <a href="https://codeberg.org/small-tech/site/src/branch/kitten/app_modules/database/Collection.js" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">codeberg.org/small-tech/site/s</span><span class="invisible">rc/branch/kitten/app_modules/database/Collection.js</span></a></p><p>To see them in use, here’s the base Posts class (with RSS generation) that extends Collection:<br><a href="https://codeberg.org/small-tech/site/src/branch/kitten/app_modules/database/Posts.js" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">codeberg.org/small-tech/site/s</span><span class="invisible">rc/branch/kitten/app_modules/database/Posts.js</span></a> </p><p>And here’s the concrete EventPosts collection class that extends Posts:<br><a href="https://codeberg.org/small-tech/site/src/branch/kitten/app_modules/database/EventPosts.js" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">codeberg.org/small-tech/site/s</span><span class="invisible">rc/branch/kitten/app_modules/database/EventPosts.js</span></a></p><p>And the EventPost (showing an implementation of a calculated property):<br><a href="https://codeberg.org/small-tech/site/src/branch/kitten/app_modules/database/EventPost.js" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">codeberg.org/small-tech/site/s</span><span class="invisible">rc/branch/kitten/app_modules/database/EventPost.js</span></a></p><p>So all this is possible (persisting and reading back typed model collections, etc.) thanks to JSDB¹ (JavaScript database), a zero-dependency, transparent, in-memory, streaming write-on-update JavaScript database I wrote for the Small Web that persists to a JavaScript transaction log and is included as as first-class citizen in Kitten.</p><p><a href="https://codeberg.org/small-tech/jsdb" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">codeberg.org/small-tech/jsdb</span><span class="invisible"></span></a></p><p>And if you want to know how the magic mapping of classes happens, see the Database App Module:</p><p><a href="https://codeberg.org/small-tech/site/src/branch/kitten/app_modules/database/database.js#L34" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">codeberg.org/small-tech/site/s</span><span class="invisible">rc/branch/kitten/app_modules/database/database.js#L34</span></a></p><p>PS. For a much gentler introduction to persistence in Kitten, see the Kitten Persistence tutorial:<br><a href="https://kitten.small-web.org/tutorials/persistence/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">kitten.small-web.org/tutorials</span><span class="invisible">/persistence/</span></a></p><p>Enjoy! :kitten:💕</p><p>¹ <a href="https://small-tech.org" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">small-tech.org</span><span class="invisible"></span></a><br>² <a href="https://kitten.small-web.org" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">kitten.small-web.org</span><span class="invisible"></span></a></p><p><a href="https://mastodon.ar.al/tags/Kitten" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Kitten</span></a> <a href="https://mastodon.ar.al/tags/SmallWeb" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SmallWeb</span></a> <a href="https://mastodon.ar.al/tags/SmallTech" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SmallTech</span></a> <a href="https://mastodon.ar.al/tags/JavaScript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>JavaScript</span></a> <a href="https://mastodon.ar.al/tags/database" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>database</span></a> <a href="https://mastodon.ar.al/tags/JSDB" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>JSDB</span></a> <a href="https://mastodon.ar.al/tags/typeSafety" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>typeSafety</span></a> <a href="https://mastodon.ar.al/tags/JSDoc" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>JSDoc</span></a> <a href="https://mastodon.ar.al/tags/closureCompiler" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>closureCompiler</span></a> <a href="https://mastodon.ar.al/tags/TypeScript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>TypeScript</span></a> <a href="https://mastodon.ar.al/tags/workInProgress" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>workInProgress</span></a></p>
Doug Parker 🕸️<p>Great post on <a href="https://techhub.social/tags/ClosureCompiler" class="mention hashtag" rel="tag">#<span>ClosureCompiler</span></a>, it&#39;s history at <a href="https://techhub.social/tags/Google" class="mention hashtag" rel="tag">#<span>Google</span></a> and how it evolved compared to <a href="https://techhub.social/tags/TypeScript" class="mention hashtag" rel="tag">#<span>TypeScript</span></a>.</p><p><a href="https://effectivetypescript.com/2023/09/27/closure-compiler/" target="_blank" rel="nofollow noopener" translate="no"><span class="invisible">https://</span><span class="ellipsis">effectivetypescript.com/2023/0</span><span class="invisible">9/27/closure-compiler/</span></a></p><p>I can help with one of the last points:</p><p>&gt; True to form, this tool [tsickle] is open source but pretty inscrutable to an outsider. It may be used by Angular but I couldn&#39;t tell.</p><p>I can confirm that Angular does *not* run `tsickle` or Closure in user projects with `ng build`. There was an experiment some years ago where we tried this to see if we could improve bundle sizes, but found that asking users to write Closure-optimizable code was too difficult and hard to justify outside Google. As a result, we never ran this in prod.</p><p>I believe we do technically run `tsickle` in Angular GitHub repositories, as we have a unique build system setup with <a href="https://techhub.social/tags/Bazel" class="mention hashtag" rel="tag">#<span>Bazel</span></a> and <a href="https://techhub.social/tags/rules_nodejs" class="mention hashtag" rel="tag">#<span>rules_nodejs</span></a>. If you&#39;ve ever contributed to Angular, you probably ran `tsickle`. We&#39;ve been trying to remove this dependency, but I don&#39;t think it&#39;s happened yet.</p>