
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
MDN's next fr(ont)e(n)d.
.env-dist
to .env
and updatenpm install
npm run start
npm run start
NODE_ENV=production
to run rari with the preview server, you'll need to have run npm run build
firstnode --env-file=.env --run rari -- serve
npm run dev
and npm run preview
npm run dev
npm run build
npm run preview
to worknpm run preview
We need to run some JS as soon as possible at page load, to avoid layout shifts and flashes.
We place this JS in entry.inline.js
, and it's inlined on page load.
Rspack also generates the necessary CSP hash when doing a prod build with npm run build
.
See the layout README.
We have a basic sandbox for testing and styling components in isolation at http://localhost:3000/sandbox
To add a component to the sandbox, add a sandbox.js
file to the component, which exports a class named like MyComponentSandbox
which extends the SandboxComponent
exported from components/sandbox/class.js
.
components/
folder, with reserved names which cause certain behavior, explained further below:
component-name/
global.css
- (reserved): automatically added to global styleselement.js
- (reserved): custom element, automatically imported client side, always imported server sideelement.css
- (recommended): styles for custom element's shadow domserver.js
- (reserved): server component, will automatically load the adjacent server.css
file when usedserver.css
- (reserved): automatically added to page styles when its server component is used in that pageglobal.css
: components which have CSS which should be loaded on all pages should expose that through a global.css
file:
mdn-component-name { display: block; }
or similarelement.js
: custom elements should be defined in components/component-name/element.js
MDNComponentName
HTMLElement
class names, and added to ACRONYMS
in build/plugins/generate-element-map.js
to allow the correct types to be generatedmdn-component-name
import()
types/element-map.d.ts
to provide proper types in e.g. querySelector("mdn-component-name")
server.js
: server components should be defined in components/component-name/server.js
ServerComponent
from components/server/index.js
, and be named ComponentName
server.css
: server component styles should be placed in components/component-name/server.css
ServerComponent
is used
// @ts-expect-error
so we get an error when we fix the error and don't leave unnecessary // @ts-ignore
comments lying around. While we're in active development these can lack a comment, but eventually we'll require an explanatory comment on each.If our server side rendered custom elements are different to the initial state of our custom elements when rendered client side, Lit will error out during hydration, stopping the execution of our client side JS.
To avoid this, don't compute things that are server/client dependent in connectedCallback
(or run functions which do this). Instead you must run these in firstUpdated
(despite the warning lit will raise in development about the element scheduling an update after an update completed).
This issue is tracked upstream: https://github.com/lit/lit/issues/1434
FAQs
MDN's next fr(ont)e(n)d.
The npm package @mdn/fred receives a total of 3,526 weekly downloads. As such, @mdn/fred popularity was classified as popular.
We found that @mdn/fred demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.