Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: magic/core
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0c76ccfb0da5c3e63c879e6eb4ae26d2f180489b
Choose a base ref
...
head repository: magic/core
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 084efa617f962d3da16354b91eaef0633625cd59
Choose a head ref
Loading
Showing with 8,022 additions and 1,919 deletions.
  1. +1 −0 .gitignore
  2. +136 −3 README.md
  3. +1 −1 docs/404.html
  4. +3 −0 docs/addCss.css
  5. +1 −0 docs/addScript.js
  6. +1 −0 docs/build/index.html
  7. +11 −8 docs/concepts/index.html
  8. +1 −8 docs/files/index.html
  9. +6 −5 docs/index.html
  10. +3 −3 docs/libraries/index.html
  11. BIN docs/logo.png
  12. +1 −1 docs/magic.css
  13. +1 −1 docs/magic.js
  14. +1 −1 docs/modules/example/index.html
  15. +1 −1 docs/modules/html/index.html
  16. +2 −2 docs/modules/index.html
  17. +3 −3 docs/modules/markdown/index.html
  18. +4 −4 docs/modules/preinstalled/index.html
  19. +1 −1 docs/modules/propTypes/index.html
  20. +2 −2 docs/news/2019/12/22/blogging/index.html
  21. +1 −1 docs/news/2019/12/index.html
  22. +1 −1 docs/news/2019/index.html
  23. +1 −1 docs/news/index.html
  24. +1 −1 docs/robots.txt
  25. +46 −32 docs/sitemap.xml
  26. +24 −20 docs/sri-hashes.json
  27. +1 −0 docs/test/index.html
  28. +2 −2 docs/themes/index.html
  29. +38 −3 example/app.mjs
  30. +6 −0 example/assets/data/index.json
  31. +3 −0 example/assets/static/addCss.css
  32. +1 −0 example/assets/static/addScript.js
  33. BIN example/assets/static/logo.png
  34. +114 −8 example/pages/concepts.md
  35. +0 −151 example/pages/files.md
  36. +210 −0 example/pages/files.mjs
  37. +4 −3 example/pages/index.md
  38. +1 −1 example/pages/libraries.md
  39. +4 −4 example/pages/modules/markdown.md
  40. +9 −9 example/pages/modules/preinstalled.md
  41. +61 −0 example/pages/test.mjs
  42. +10 −1 config.mjs → magic.js
  43. +5,771 −800 package-lock.json
  44. +31 −31 package.json
  45. +18 −1 src/bin.mjs
  46. +5 −6 src/cluster/build.mjs
  47. +9 −9 src/cluster/master.mjs
  48. +6 −2 src/cluster/watch.mjs
  49. +79 −10 src/config.mjs
  50. +12 −0 src/defaultApp.mjs
  51. +1 −41 src/index.mjs
  52. +12 −8 src/lib/CHECK_PROPS.mjs
  53. +0 −18 src/lib/applyWebRoot.mjs
  54. +13 −31 src/lib/babel/dead_code.mjs
  55. +4 −1 src/lib/babel/index.mjs
  56. +76 −0 src/lib/checkLinks.mjs
  57. +0 −42 src/lib/compress.mjs
  58. +0 −29 src/lib/contentTypes.mjs
  59. +0 −10 src/lib/createFileHash.mjs
  60. +22 −0 src/lib/createHash.mjs
  61. +75 −0 src/lib/findConfigFile.mjs
  62. +2 −2 src/lib/findModuleStyles.mjs
  63. +4 −4 src/lib/getBlog.mjs
  64. +0 −13 src/lib/getContentType.mjs
  65. +7 −7 src/lib/getGitConfig.mjs
  66. +6 −9 src/lib/getPages.mjs
  67. +87 −0 src/lib/handleLink.mjs
  68. +23 −0 src/lib/httpGet.mjs
  69. +9 −4 src/lib/index.mjs
  70. +13 −0 src/lib/isHashedUrl.mjs
  71. +1 −0 src/lib/isPageUrl.mjs
  72. +7 −0 src/lib/isStaticUrl.mjs
  73. +0 −39 src/lib/minifyImages.mjs
  74. +3 −1 src/lib/replacePathSepForImport.mjs
  75. +1 −0 src/lib/replaceSlashSlash.mjs
  76. +227 −0 src/lib/swc/index.mjs
  77. +1 −1 src/lib/writeFile.mjs
  78. +4 −3 src/modules/Header.mjs
  79. +11 −2 src/modules/Logo.mjs
  80. +8 −4 src/modules/Menu.mjs
  81. +7 −25 src/modules/MenuItem.mjs
  82. +0 −1 src/modules/MenuLink.mjs
  83. +16 −20 src/modules/Router.mjs
  84. +15 −5 src/modules/Seo.mjs
  85. +29 −9 src/modules/app.mjs
  86. +7 −4 src/modules/component.mjs
  87. +0 −2 src/modules/index.mjs
  88. +4 −9 src/modules/tags.mjs
  89. +41 −0 src/runCluster.mjs
  90. +2 −4 src/tasks/clean/index.mjs
  91. +3 −3 src/tasks/connect/index.mjs
  92. +6 −4 src/tasks/prepare/api.mjs
  93. +18 −18 src/tasks/prepare/blog.mjs
  94. +17 −24 src/tasks/prepare/blogPost.mjs
  95. +2 −2 src/tasks/prepare/globals/findAssetFile.mjs
  96. +2 −2 src/tasks/prepare/globals/findBuiltins.mjs
  97. +35 −10 src/tasks/prepare/globals/findLibraries.mjs
  98. +2 −2 src/tasks/prepare/globals/findLocalModules.mjs
  99. +5 −5 src/tasks/prepare/globals/findNodeModules.mjs
  100. +40 −33 src/tasks/prepare/globals/findThemes.mjs
  101. +9 −8 src/tasks/prepare/globals/index.mjs
  102. +53 −47 src/tasks/prepare/index.mjs
  103. +53 −46 src/tasks/prepare/js.mjs
  104. +14 −12 src/tasks/prepare/meta.mjs
  105. +2 −2 src/tasks/prepare/modules.mjs
  106. +18 −12 src/tasks/prepare/page.mjs
  107. +14 −11 src/tasks/prepare/pages.mjs
  108. +7 −7 src/tasks/prepare/service-worker.mjs
  109. +49 −0 src/tasks/prepare/stateLinks.mjs
  110. +14 −8 src/tasks/prepare/themes.mjs
  111. +3 −3 src/tasks/publish/index.mjs
  112. +1 −2 src/tasks/serve/apiHandler.mjs
  113. +31 −9 src/tasks/serve/handler.mjs
  114. +8 −6 src/tasks/serve/index.mjs
  115. +5 −7 src/tasks/serve/prepareApi.mjs
  116. +1 −6 src/tasks/transpile/css.mjs
  117. +24 −23 src/tasks/transpile/html.mjs
  118. +91 −14 src/tasks/transpile/index.mjs
  119. +21 −8 src/tasks/transpile/js.mjs
  120. +30 −8 src/tasks/watch/index.mjs
  121. +23 −25 src/tasks/write/index.mjs
  122. +0 −54 test/lib/applyWebRoot.mjs
  123. +0 −9 test/lib/createFileHash.mjs
  124. +9 −0 test/lib/createHash.mjs
  125. +25 −0 test/lib/replaceSlashSlash.mjs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -3,3 +3,4 @@ npm-debug.log
yarn-error.log
coverage
.DS_Store
.tmp
139 changes: 136 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -341,7 +341,7 @@ update lodash to mitigate development environment security issue.
##### 0.0.84
update deps

##### 0.0.85
##### 0.0.85
icon sizes can be customized

##### 0.0.86
@@ -369,13 +369,146 @@ update dependencies
##### 0.0.92
update dependencies

##### 0.0.93
##### 0.0.93
update dependencies

##### 0.0.94
update dependencies

##### 0.0.95 - unreleased
##### 0.0.95
* serve/prepareApi: remove console.log
* allow addition of third party scripts using ADD_SCRIPTS config variable
* update dependencies

##### 0.0.96
git tagged but not published

##### 0.0.97
* do not error if page is not a javascript module
* update dependencies
* add app.build task
* update dependencies


##### 0.0.98
* if the app.mjs import fails because one of the app dependencies is missing,
throw an error instead of silently not importing the app.
* update dependencies

##### 0.0.99
* use @swc/core for dev builds to make them 10 times faster.
* update dependencies
* only duplicate unique page.state into app.state, 20-30% bundle size reduction.
* cluster/build task recovers from build errors, no restart needed.

##### 0.0.100
* config.API_DIR now actually gets used
* api routes now 404 if they do not exist (redirected to WEB_ROOT before)
* update deps

##### 0.0.101
* Router: on navigation scroll to top works in newer firefox, tradeoff: probably not in older.
* npm i -g magic now works and loads local node_modules as well as global

##### 0.0.102
* further fixes regarding npm i -g magic
* bump required node version to 14.15.4
* update dependencies

##### 0.0.103
update dependencies

##### 0.0.104
update dependencies

##### 0.0.105
* Header, Menu, MenuItem and Logo arguments updated

##### 0.0.106
update dependencies (marked)

##### 0.0.107
* update dependencies
* swc now handles links in pages correctly (dev)
* babel now handles links in pages correctly (production)
* prepare task now handles all urls in the state object,
no need to handle it in babel/swc or in modules.

##### 0.0.108
debump hyperapp-render from 4.0.0 to 3.5.0

##### 0.0.109
* fix error in modules/Logo
* tasks/prepare/stateLinks now handles #hash and -expand links without parents
* check for broken links on build and dev
* better link handling, should now include all images and links in pages too

##### 0.0.110
* update dependencies
* restructure most of the app tasks and remove global.config.
this will allow us to seamlessly use @magic/core in the @magic/test library
* libs can now be static function instead of imports
* export renderToString

##### 0.0.111
* magic.init can now be an actual array of code, instead of string only
* update dependencies
* more robust checkLinks testing

##### 0.0.112
* libraries can be actual code or a string pointing to a file
* update hyperapp and use 2.0.12
* update hyperapp-render to 4.0.0
* update dependencies
* href link checkers handle mailto: links
* import hyperapp memo instead of Lazy
* starting to remove usages of config without explicit destructuring
* replaceSlashSlash all urls in robots.txt and sitemap.xml
* add ADD_TAGS to append arbitrary html after the #magic root
* the watch task can now watch files
* the watch task watches the config file

##### 0.0.113
* FIX: tasks/prepare/page: change variable name to avoid "access before init" error when pages do not build successfully.
* update dependencies

##### 0.0.114
* to keep dev builds fast, external links only get checked on build.
* deprecate config.mjs in favor of magic.(m)js
* magic.js config import will now error and exit if config does not exist
* if no config file is found, output an example config
* show a warning if config.mjs is still being used
* only checkLinks external links in production env

##### 0.0.115
* swc handles OptionalChainingExpression and Computed
* nicer error messages
* add Permissions-Policy interest-cohort=() to maybe avoid FLOC tracking in chrome.

##### 0.0.116
* add @magic/hyperapp bundle that exports hyperapp and hyperapp-render


##### 0.0.117
correctly export renderToString from index (for @magic/test)

##### 0.0.118
add silent option to silence log output and apply to config.

##### 0.0.119
* update dependencies
* conf.ADD_STATIC can be used to import static files from multiple directories
* component handles prerendered hyperapp objects correctly again.
* html pages have their href and src elements prefixed with WEB_ROOT

##### 0.0.120
* runConfig: bail early if config file is not found
* lib/findConfigFile: only process.exit if args.silent is false

##### 0.0.121
update dependencies

##### 0.0.122 - unreleased
...

[npm-image]: https://img.shields.io/npm/v/@magic/core.svg
2 changes: 1 addition & 1 deletion docs/404.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link rel="icon" href="/core/favicon.ico"/><title>404 - not found</title><meta name="twitter:image" property="og:image" content="https://magic.github.io/core/core/logo.png"/><meta name="twitter:card" content="summary_large_image"/><meta name="description" content="404 - not found."/><meta name="author" content="Jascha Ehrenreich"/><script type="application/ld+json">{"@context":"http://schema.org","@type":"website","name":"@magic/core documentation","url":"https://magic.github.io/core","about":"@magic framework core.","image":"https://magic.github.io/core/core/logo.png","author":{"@type":"person","name":"Jascha Ehrenreich","jobTitle":"Technomancer","image":"https:/jaeh.at/img/jascha.ehrenreich.jpg","url":"https://jaeh.at"}}</script><link rel="stylesheet" href="/core/magic.css?6hSY9fCnm0" integrity="sha384-6hSY9fCnm0dWh5/sYk7zXohWUa8A/UWz5El7GhZ16oW4JdHMgawUadnbHyvjixxX" crossorigin="anonymous"/></head><body><a class="SkipLink" href="/core/#page">Skip to Content</a><main id="Magic"><div class="Wrapper"><header class="Header"><div><a class="Logo" href="/core/"><svg viewBox="0 0 512 444"><path d="M512 444L256 0 0 444z" fill="#663695"></path><circle cx="256" cy="294" r="130" fill="#fff"></circle><circle cx="256" cy="281" r="40" fill="#663695"></circle><path d="M256 350v44m24-44l1 13c1 27 29 27 29-7m-160-72s46-47 106-47c59 0 106 47 106 47s-47 43-106 43c-60 0-106-43-106-43zm65-75a134 134 0 0189 2" class="stroke"></path><path d="M256 81v53m184 270l-43-29M72 404l43-29" class="stroke white"></path></svg></a><p>@magic</p><nav class="Menu"><ul><li><a href="/core/concepts/">concepts</a></li><li><a href="/core/files/">files &amp; directories</a></li><li><a href="/core/modules/">modules</a></li><li><a href="/core/themes/">themes</a></li><li><a href="/core/libraries/">libraries</a></li><li><a href="/core/news/">news</a></li></ul></nav></div></header><div class="Page" id="page"><div>404 - not found.</div></div><footer class="Footer"><div class="Container"><div class="Credits">made with a few bits of <a target="_blank" rel="noopener" href="https://magic.github.io/">magic</a></div></div></footer></div></main><script src="/core/magic.js?duSrd3YALh" integrity="sha384-duSrd3YALhTnnC+ua7bmimEV7S4cKTi4pM6fszkPxytGf4y1Gi/GvkY8tkwXZPHL" crossorigin="anonymous"></script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta http-equiv="Permissions-Policy" content="interest-cohort=()"/><link rel="icon" href="/core/favicon.ico"/><title>@magic/core documentation</title><meta name="twitter:image" property="og:image" content="https:/magic.github.io/core/logo.png"/><meta name="twitter:card" content="summary_large_image"/><meta name="description" content="404 - not found."/><meta name="author" content="Jascha Ehrenreich"/><script type="application/ld+json">{"@context":"http://schema.org","@type":"website","name":"@magic/core documentation","url":"https://magic.github.io/core/","about":"@magic framework core.","image":"https:/magic.github.io/core/logo.png","author":{"@type":"person","name":"Jascha Ehrenreich","jobTitle":"Technomancer","image":"https:/jaeh.at/img/jascha.ehrenreich.jpg","url":"https://jaeh.at"}}</script><link rel="stylesheet" href="/core/magic.css?JsePX/EMkI" integrity="sha384-JsePX/EMkIQmcYS+C30e+T3aTVb0vwHITFHrAdAd7erYPWxxtlwSOEsrQzQN3AmG" crossorigin="anonymous"/><link href="/core/addCss.css" rel="stylesheet"/></head><body><a class="SkipLink" href="/core/#page">Skip to Content</a><main id="Magic"><div class="Wrapper"><header class="Header"><a class="Logo" href="/core/"><svg viewBox="0 0 512 444"><path d="M512 444L256 0 0 444z" fill="#663695"></path><circle cx="256" cy="294" r="130" fill="#fff"></circle><circle cx="256" cy="281" r="40" fill="#663695"></circle><path d="M256 350v44m24-44l1 13c1 27 29 27 29-7m-160-72s46-47 106-47c59 0 106 47 106 47s-47 43-106 43c-60 0-106-43-106-43zm65-75a134 134 0 0189 2" class="stroke"></path><path d="M256 81v53m184 270l-43-29M72 404l43-29" class="stroke white"></path></svg></a><p>@magic</p><nav class="Menu"><ul><li><a href="/core/concepts/">concepts</a></li><li><a href="/core/files/">files &amp; directories</a></li><li><a href="/core/modules/">modules</a></li><li><a href="/core/themes/">themes</a></li><li><a href="/core/libraries/">libraries</a></li><li><a href="/core/news/">news</a></li><li><a href="/core/test/">test</a></li></ul></nav></header><div class="Page" id="page"><div>404 - not found.</div></div><footer class="Footer"><div class="Container"><div class="Credits">made with a few bits of <a target="_blank" rel="noopener" href="https://magic.github.io/">magic</a></div></div></footer></div></main><div id="AddTag"></div><script src="/core/magic.js?DN5DA4yXmZ" integrity="sha384-DN5DA4yXmZAT69zIAb1UDMnUO71VqLB0i2p+lcjy3SRn8R31i7fDp1Fju63Sr86I" crossorigin="anonymous"></script><script src="/core/addScript.js"></script></body></html>
3 changes: 3 additions & 0 deletions docs/addCss.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#AddCss {
color: green;
}
1 change: 1 addition & 0 deletions docs/addScript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('config ADD_SCRIPTS worked.')
1 change: 1 addition & 0 deletions docs/build/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta http-equiv="Permissions-Policy" content="interest-cohort=()"/><link rel="icon" href="/core/favicon.ico"/><title>@magic/core documentation</title><meta name="twitter:image" property="og:image" content="https:/magic.github.io/core/logo.png"/><meta name="twitter:card" content="summary_large_image"/><meta name="description" content="This is some static data, loaded via example/app.mjs#build and from example/assets/data/index.json."/><meta name="author" content="Jascha Ehrenreich"/><script type="application/ld+json">{"@context":"http://schema.org","@type":"website","name":"@magic/core documentation","url":"https://magic.github.io/core/","about":"@magic framework core.","image":"https:/magic.github.io/core/logo.png","author":{"@type":"person","name":"Jascha Ehrenreich","jobTitle":"Technomancer","image":"https:/jaeh.at/img/jascha.ehrenreich.jpg","url":"https://jaeh.at"}}</script><link rel="stylesheet" href="/core/magic.css?JsePX/EMkI" integrity="sha384-JsePX/EMkIQmcYS+C30e+T3aTVb0vwHITFHrAdAd7erYPWxxtlwSOEsrQzQN3AmG" crossorigin="anonymous"/><link href="/core/addCss.css" rel="stylesheet"/></head><body><a class="SkipLink" href="/core/#page">Skip to Content</a><main id="Magic"><div class="Wrapper"><header class="Header"><a class="Logo" href="/core/"><svg viewBox="0 0 512 444"><path d="M512 444L256 0 0 444z" fill="#663695"></path><circle cx="256" cy="294" r="130" fill="#fff"></circle><circle cx="256" cy="281" r="40" fill="#663695"></circle><path d="M256 350v44m24-44l1 13c1 27 29 27 29-7m-160-72s46-47 106-47c59 0 106 47 106 47s-47 43-106 43c-60 0-106-43-106-43zm65-75a134 134 0 0189 2" class="stroke"></path><path d="M256 81v53m184 270l-43-29M72 404l43-29" class="stroke white"></path></svg></a><p>@magic</p><nav class="Menu"><ul><li><a href="/core/concepts/">concepts</a></li><li><a href="/core/files/">files &amp; directories</a></li><li><a href="/core/modules/">modules</a></li><li><a href="/core/themes/">themes</a></li><li><a href="/core/libraries/">libraries</a></li><li><a href="/core/news/">news</a></li><li><a href="/core/test/">test</a></li></ul></nav></header><div class="Page" id="page"><div><h3>external data</h3><p>This is some static data, loaded via example/app.mjs#build and from example/assets/data/index.json.</p><p><h4>state.data</h4><div class="Pre lines"><div class="menu"><button>copy</button></div><pre><code class="line">{</code><code class="line"> <span class="string">&quot;data&quot;</span>: {</code><code class="line"> <span class="string">&quot;title&quot;</span>: <span class="string">&quot;external data&quot;</span>,</code><code class="line"> <span class="string">&quot;description&quot;</span>: <span class="string">&quot;This is some static data, loaded via example/app.mjs#build and from example/assets/data/index.json.&quot;</span></code><code class="line"> }</code><code class="line">}</code></pre></div></p></div></div><footer class="Footer"><div class="Container"><div class="Credits">made with a few bits of <a target="_blank" rel="noopener" href="https://magic.github.io/">magic</a></div></div></footer></div></main><div id="AddTag"></div><script src="/core/magic.js?DN5DA4yXmZ" integrity="sha384-DN5DA4yXmZAT69zIAb1UDMnUO71VqLB0i2p+lcjy3SRn8R31i7fDp1Fju63Sr86I" crossorigin="anonymous"></script><script src="/core/addScript.js"></script></body></html>
Loading