Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommonJS distribution bundle #67

Merged
merged 4 commits into from
Jun 25, 2022
Merged

Conversation

thescientist13
Copy link
Member

Related Issue

In support of integrating with CJS based projects like Eleventy, using Rollup to provide a temporary "dist" version of WCC for projects that can't support ESM directly.

Summary of Changes

  1. Added Rollup and a dist command to generate a single bundle of wcc
  2. Linked to prepublish script to make sure it gets run on each publish
  3. Add documentation

@thescientist13 thescientist13 added documentation Improvements or additions to documentation feature New feature or request labels Jun 20, 2022
@thescientist13 thescientist13 added this to the 1.0 milestone Jun 20, 2022
@thescientist13 thescientist13 changed the title CJS dist version CommonJS distribution version Jun 20, 2022
@@ -4,8 +4,7 @@ import './dom-shim.js';
import * as acorn from 'acorn';
import * as walk from 'acorn-walk';
import { parse, parseFragment, serialize } from 'parse5';

import fs from 'node:fs/promises';
import fs from 'fs/promises';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped node: for better backwards support for now, of Node >= 14.x

@@ -105,10 +104,11 @@ async function getTagName(moduleURL) {
async function initializeCustomElement(elementURL, tagName, attrs = []) {
await registerDependencies(elementURL);

const { pathname } = elementURL;
Copy link
Member Author

@thescientist13 thescientist13 Jun 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoiding direct use of import(elementURL) since when converted to CJS, require will break when given a URL.

If 11ty moves to ESM, then we could remove this, but might be nice for general CJS <> ESM interop.

@thescientist13 thescientist13 merged commit 937a93d into master Jun 25, 2022
@thescientist13 thescientist13 deleted the feature/cjs-distribution branch June 25, 2022 00:25
@thescientist13 thescientist13 changed the title CommonJS distribution version CommonJS distribution bundle Jun 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature New feature or request v0.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant