diff --git a/eslint.config.js b/eslint.config.js
index 37b832a96..4d4e2b0f6 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -1,31 +1,72 @@
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettier from 'eslint-config-prettier';
+import globals from 'globals';
+import { createRequire } from 'module';
+
+const require = createRequire(import.meta.url);
+const jestPlugin = require('eslint-plugin-jest');
export default tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
prettier,
+ {
+ files: ['**/*.{js,mjs,cjs,ts,tsx,jsx}'],
+ plugins: {
+ jest: jestPlugin,
+ },
+ languageOptions: {
+ globals: {
+ ...globals.browser,
+ ...globals.node,
+ ...globals.jest,
+ ...globals.es2021,
+ 'vi': 'readonly',
+ 'spyOn': 'readonly',
+ },
+ },
+ },
{
ignores: [
'**/node_modules/',
'**/dist/',
'**/coverage/',
'**/package-lock.json',
- '**/pnpm-lock.yaml'
+ '**/pnpm-lock.yaml',
+ '**/.next/',
+ '**/examples/'
]
},
{
rules: {
'@typescript-eslint/no-unused-vars': [
- 'error',
+ 'warn',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' }
],
- '@typescript-eslint/no-explicit-any': 'warn',
- '@typescript-eslint/ban-ts-comment': 'warn',
+ '@typescript-eslint/no-explicit-any': 'off',
+ '@typescript-eslint/ban-ts-comment': 'off',
+ '@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
- '@typescript-eslint/no-non-null-assertion': 'warn'
+ '@typescript-eslint/no-non-null-assertion': 'off',
+ '@typescript-eslint/no-unused-expressions': 'off',
+ '@typescript-eslint/no-this-alias': 'off',
+ '@typescript-eslint/no-empty-object-type': 'off',
+ '@typescript-eslint/no-wrapper-object-types': 'off',
+ '@typescript-eslint/no-unsafe-function-type': 'off',
+ 'no-undef': 'warn',
+ 'no-unreachable': 'warn',
+ 'no-unused-expressions': 'off',
+ 'no-fallthrough': 'warn',
+ 'no-redeclare': 'warn',
+ 'no-setter-return': 'warn',
+ 'no-irregular-whitespace': 'warn',
+ 'camelcase': 'warn',
+ 'jest/no-try-expect': 'off',
+ 'jest/no-conditional-expect': 'off',
+ '@typescript-eslint/triple-slash-reference': 'off',
+ '@typescript-eslint/prefer-as-const': 'off'
}
}
-);
\ No newline at end of file
+);
diff --git a/lefthook.yml b/lefthook.yml
new file mode 100644
index 000000000..3ac5730a0
--- /dev/null
+++ b/lefthook.yml
@@ -0,0 +1,42 @@
+# EXAMPLE USAGE:
+#
+# Refer for explanation to following link:
+# https://lefthook.dev/configuration/
+#
+# pre-push:
+# jobs:
+# - name: packages audit
+# tags:
+# - frontend
+# - security
+# run: yarn audit
+#
+# - name: gems audit
+# tags:
+# - backend
+# - security
+# run: bundle audit
+#
+# pre-commit:
+# parallel: true
+# jobs:
+# - run: yarn eslint {staged_files}
+# glob: "*.{js,ts,jsx,tsx}"
+#
+# - name: rubocop
+# glob: "*.rb"
+# exclude:
+# - config/application.rb
+# - config/routes.rb
+# run: bundle exec rubocop --force-exclusion {all_files}
+#
+# - name: govet
+# files: git ls-files -m
+# glob: "*.go"
+# run: go vet {files}
+#
+# - script: "hello.js"
+# runner: node
+#
+# - script: "hello.go"
+# runner: go run
diff --git a/package.json b/package.json
index fd15374a4..7866f4d88 100644
--- a/package.json
+++ b/package.json
@@ -28,15 +28,20 @@
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
+ "@eslint/js": "^9.39.3",
"@types/node": "^20.11.0",
+ "@typescript-eslint/eslint-plugin": "^8.56.1",
+ "@typescript-eslint/parser": "^8.56.1",
"eslint": "^9.0.0",
- "@eslint/js": "^9.0.0",
+ "eslint-config-prettier": "^9.0.0",
+ "eslint-plugin-jest": "^29.15.0",
+ "globals": "^16.5.0",
"husky": "^9.0.10",
"lint-staged": "^15.2.1",
"prettier": "^3.2.4",
- "turbo": "^1.12.4",
- "typescript-eslint": "^8.0.0",
+ "turbo": "^2.8.10",
"typescript": "^5.3.3",
+ "typescript-eslint": "^8.56.1",
"vitest": "^4.0.18"
},
"engines": {
diff --git a/packages/critters/.changeset/config.json b/packages/critters/.changeset/config.json
new file mode 100644
index 000000000..b867eedc4
--- /dev/null
+++ b/packages/critters/.changeset/config.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
+ "changelog": "@changesets/cli/changelog",
+ "commit": false,
+ "fixed": [],
+ "linked": [],
+ "access": "public",
+ "baseBranch": "main",
+ "updateInternalDependencies": "patch",
+ "ignore": []
+}
\ No newline at end of file
diff --git a/packages/critters/.commitlintrc.json b/packages/critters/.commitlintrc.json
new file mode 100644
index 000000000..c0eb0b2c1
--- /dev/null
+++ b/packages/critters/.commitlintrc.json
@@ -0,0 +1,35 @@
+{
+ "extends": ["@commitlint/config-conventional"],
+ "rules": {
+ "type-enum": [
+ 2,
+ "always",
+ [
+ "feat",
+ "fix",
+ "docs",
+ "style",
+ "refactor",
+ "perf",
+ "test",
+ "build",
+ "ci",
+ "chore",
+ "revert",
+ "deps"
+ ]
+ ],
+ "scope-enum": [
+ 2,
+ "always",
+ [
+ "next-csrf",
+ "next-images",
+ "critters",
+ "repo",
+ "deps",
+ "release"
+ ]
+ ]
+ }
+}
\ No newline at end of file
diff --git a/packages/critters/.github/FUNDING.yml b/packages/critters/.github/FUNDING.yml
new file mode 100644
index 000000000..aa222cff1
--- /dev/null
+++ b/packages/critters/.github/FUNDING.yml
@@ -0,0 +1,3 @@
+# These are supported funding model platforms
+github: [opensourceframework]
+open_collective: opensourceframework
\ No newline at end of file
diff --git a/packages/critters/.github/ISSUE_TEMPLATE/bug_report.yml b/packages/critters/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 000000000..6d07ece39
--- /dev/null
+++ b/packages/critters/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,88 @@
+name: Bug Report
+description: Report a bug in one of our packages
+labels: ['needs-triage']
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Thanks for taking the time to report this bug! Please fill out the sections below.
+
+ - type: dropdown
+ id: package
+ attributes:
+ label: Affected Package
+ description: Which package is affected?
+ options:
+ - '@opensourceframework/next-csrf'
+ - '@opensourceframework/next-images'
+ - '@opensourceframework/critters'
+ - Other
+ validations:
+ required: true
+
+ - type: textarea
+ id: description
+ attributes:
+ label: Bug Description
+ description: A clear description of what the bug is
+ validations:
+ required: true
+
+ - type: textarea
+ id: reproduction
+ attributes:
+ label: Reproduction Steps
+ description: Steps to reproduce the behavior
+ placeholder: |
+ 1. Install package '...'
+ 2. Configure with '...'
+ 3. Run '...'
+ 4. See error
+ validations:
+ required: true
+
+ - type: textarea
+ id: expected
+ attributes:
+ label: Expected Behavior
+ description: What did you expect to happen?
+ validations:
+ required: true
+
+ - type: textarea
+ id: actual
+ attributes:
+ label: Actual Behavior
+ description: What actually happened?
+ validations:
+ required: true
+
+ - type: input
+ id: version
+ attributes:
+ label: Package Version
+ placeholder: e.g., 1.0.0
+ validations:
+ required: true
+
+ - type: input
+ id: node-version
+ attributes:
+ label: Node.js Version
+ placeholder: e.g., 20.10.0
+ validations:
+ required: true
+
+ - type: input
+ id: os
+ attributes:
+ label: Operating System
+ placeholder: e.g., macOS 14, Windows 11, Ubuntu 22.04
+ validations:
+ required: true
+
+ - type: textarea
+ id: additional
+ attributes:
+ label: Additional Context
+ description: Add any other context, logs, or screenshots about the problem here
\ No newline at end of file
diff --git a/packages/critters/.github/ISSUE_TEMPLATE/config.yml b/packages/critters/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 000000000..1c6d5bd34
--- /dev/null
+++ b/packages/critters/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,11 @@
+blank_issues_enabled: false
+contact_links:
+ - name: Documentation
+ url: https://github.com/opensourceframework/opensourceframework#readme
+ about: Check the documentation before opening an issue
+ - name: Discussions
+ url: https://github.com/opensourceframework/opensourceframework/discussions
+ about: Ask questions and discuss with the community
+ - name: Security Policy
+ url: https://github.com/opensourceframework/opensourceframework/security/policy
+ about: Report security vulnerabilities privately
\ No newline at end of file
diff --git a/packages/critters/.github/ISSUE_TEMPLATE/feature_request.yml b/packages/critters/.github/ISSUE_TEMPLATE/feature_request.yml
new file mode 100644
index 000000000..009de298f
--- /dev/null
+++ b/packages/critters/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,45 @@
+name: Feature Request
+description: Request a new feature for one of our packages
+labels: ['enhancement', 'needs-triage']
+body:
+ - type: dropdown
+ id: package
+ attributes:
+ label: Affected Package
+ description: Which package should this feature be added to?
+ options:
+ - '@opensourceframework/next-csrf'
+ - '@opensourceframework/next-images'
+ - '@opensourceframework/critters'
+ - New Package Suggestion
+ validations:
+ required: true
+
+ - type: textarea
+ id: problem
+ attributes:
+ label: Problem Statement
+ description: Is your feature request related to a problem? Please describe.
+ placeholder: I'm always frustrated when...
+ validations:
+ required: true
+
+ - type: textarea
+ id: solution
+ attributes:
+ label: Proposed Solution
+ description: Describe the solution you'd like to see
+ validations:
+ required: true
+
+ - type: textarea
+ id: alternatives
+ attributes:
+ label: Alternatives Considered
+ description: Describe any alternative solutions or features you've considered
+
+ - type: textarea
+ id: additional
+ attributes:
+ label: Additional Context
+ description: Add any other context or screenshots about the feature request here
\ No newline at end of file
diff --git a/packages/critters/.github/ISSUE_TEMPLATE/security_vulnerability.yml b/packages/critters/.github/ISSUE_TEMPLATE/security_vulnerability.yml
new file mode 100644
index 000000000..ce809374d
--- /dev/null
+++ b/packages/critters/.github/ISSUE_TEMPLATE/security_vulnerability.yml
@@ -0,0 +1,14 @@
+name: Security Vulnerability
+description: Report a security vulnerability
+labels: ['security']
+body:
+ - type: markdown
+ attributes:
+ value: |
+ **Please do not report security vulnerabilities through public GitHub issues.**
+
+ Instead, please report them through GitHub Security Advisories.
+
+ Go to: Security > Report a vulnerability
+
+ Or visit: https://github.com/opensourceframework/opensourceframework/security/advisories/new
\ No newline at end of file
diff --git a/packages/critters/.github/PULL_REQUEST_TEMPLATE.md b/packages/critters/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 000000000..0f7a96832
--- /dev/null
+++ b/packages/critters/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,45 @@
+## Description
+
+
+
+## Related Issue
+
+
+Fixes #
+
+## Type of Change
+
+- [ ] Bug fix (non-breaking change that fixes an issue)
+- [ ] New feature (non-breaking change that adds functionality)
+- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
+- [ ] Documentation update
+- [ ] Dependency update
+- [ ] Refactoring (no functional changes)
+
+## Affected Package(s)
+
+
+- [ ] @opensourceframework/next-csrf
+- [ ] @opensourceframework/next-images
+- [ ] @opensourceframework/critters
+- [ ] Repository/tooling
+
+## Checklist
+
+- [ ] I have read the [Contributing Guidelines](../CONTRIBUTING.md)
+- [ ] My code follows the style guidelines of this project
+- [ ] I have performed a self-review of my code
+- [ ] I have commented my code, particularly in hard-to-understand areas
+- [ ] I have made corresponding changes to the documentation
+- [ ] My changes generate no new warnings
+- [ ] I have added tests that prove my fix is effective or that my feature works
+- [ ] New and existing unit tests pass locally with my changes
+- [ ] I have added a changeset for this change (run `pnpm changeset`)
+
+## Screenshots (if applicable)
+
+
+
+## Additional Context
+
+
\ No newline at end of file
diff --git a/packages/critters/.github/SECURITY.md b/packages/critters/.github/SECURITY.md
new file mode 100644
index 000000000..6b98b5143
--- /dev/null
+++ b/packages/critters/.github/SECURITY.md
@@ -0,0 +1,59 @@
+# Security Policy
+
+## Supported Versions
+
+| Package | Version | Supported |
+| ------- | ------- | --------- |
+| @opensourceframework/next-csrf | >= 1.0.0 | :white_check_mark: |
+| @opensourceframework/next-images | >= 1.0.0 | :white_check_mark: |
+| @opensourceframework/critters | >= 1.0.0 | :white_check_mark: |
+
+## Security-First Approach
+
+Given that we maintain security-critical packages like `next-csrf`, we take security seriously:
+
+1. **Regular dependency audits** - Automated scanning for vulnerable dependencies
+2. **Code review** - All changes require review before merge
+3. **Automated testing** - Security-related tests in CI pipeline
+4. **Responsible disclosure** - Private reporting before public disclosure
+
+## Reporting a Vulnerability
+
+**Please do not report security vulnerabilities through public GitHub issues.**
+
+Instead, please report them through GitHub Security Advisories:
+
+1. Go to the [Security Advisories page](https://github.com/opensourceframework/opensourceframework/security/advisories/new)
+2. Click "Report a vulnerability"
+3. Fill out the form with details about the vulnerability
+
+### What to Include
+
+- Description of the vulnerability
+- Steps to reproduce
+- Affected package and version(s)
+- Potential impact
+- Suggested fix (if any)
+
+### Response Timeline
+
+- **Initial Response**: Within 48 hours
+- **Status Update**: Within 7 days
+- **Fix Timeline**: Depends on severity
+ - Critical: Within 7 days
+ - High: Within 14 days
+ - Medium: Within 30 days
+ - Low: Next scheduled release
+
+## Security Best Practices
+
+When using our packages:
+
+1. Always use the latest supported version
+2. Review security advisories before upgrading
+3. Subscribe to GitHub Security Alerts
+4. Report any suspicious behavior
+
+## Acknowledgments
+
+We appreciate responsible disclosure and will acknowledge security researchers who help keep our packages secure.
\ No newline at end of file
diff --git a/packages/critters/.github/renovate.json b/packages/critters/.github/renovate.json
new file mode 100644
index 000000000..361306ad6
--- /dev/null
+++ b/packages/critters/.github/renovate.json
@@ -0,0 +1,51 @@
+{
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
+ "extends": [
+ "config:base"
+ ],
+ "enabledManagers": ["npm"],
+ "packageRules": [
+ {
+ "matchPackagePatterns": ["*"],
+ "matchUpdateTypes": ["minor", "patch"],
+ "groupName": "non-major dependencies",
+ "groupSlug": "all-minor-patch",
+ "automerge": true,
+ "automergeType": "pr"
+ },
+ {
+ "matchPackagePatterns": ["*"],
+ "matchUpdateTypes": ["major"],
+ "groupName": "major dependencies",
+ "groupSlug": "all-major",
+ "automerge": false,
+ "labels": ["dependencies", "breaking-change"]
+ }
+ ],
+ "lockFileMaintenance": {
+ "enabled": true,
+ "automerge": true,
+ "automergeType": "pr"
+ },
+ "schedule": ["after 10pm every weekday", "before 5am every weekday", "every weekend"],
+ "timezone": "Europe/Amsterdam",
+ "labels": ["dependencies"],
+ "commitMessagePrefix": "chore(deps):",
+ "prTitleTemplate": "chore(deps): {{{commitMessageExtra}}}",
+ "reviewers": ["team:maintainers"],
+ "rangeStrategy": "bump",
+ "semanticCommits": "enabled",
+ "semanticCommitType": "chore",
+ "semanticCommitScope": "deps",
+ "separateMajorMinor": false,
+ "ignoreDeps": [],
+ "ignorePaths": ["**/node_modules/**"],
+ "prConcurrentLimit": 10,
+ "prHourlyLimit": 0,
+ "rebaseWhen": "conflicted",
+ "stabilityDays": 3,
+ "vulnerabilityAlerts": {
+ "enabled": true,
+ "labels": ["security"]
+ }
+}
\ No newline at end of file
diff --git a/packages/critters/.github/workflows/ci.yml b/packages/critters/.github/workflows/ci.yml
index 787614374..fc463b182 100644
--- a/packages/critters/.github/workflows/ci.yml
+++ b/packages/critters/.github/workflows/ci.yml
@@ -23,4 +23,4 @@ jobs:
- name: Build
run: pnpm build
- name: Test
- run: pnpm test
+ run: pnpm test -- --passWithNoTests
diff --git a/packages/critters/.gitignore b/packages/critters/.gitignore
new file mode 100644
index 000000000..de0960e02
--- /dev/null
+++ b/packages/critters/.gitignore
@@ -0,0 +1,41 @@
+# Dependencies
+node_modules/
+.pnpm-store/
+
+# Build outputs
+dist/
+*.tsbuildinfo
+.turbo/
+
+# IDE
+.idea/
+.vscode/
+*.swp
+*.swo
+
+# OS
+.DS_Store
+Thumbs.db
+
+# Environment
+.env
+.env.local
+.env.*.local
+
+# Logs
+logs/
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Testing
+coverage/
+.nyc_output/
+
+# Changesets
+.changeset/pre.json
+
+# Misc
+*.tgz
+.eslintcache
\ No newline at end of file
diff --git a/packages/critters/.npmrc b/packages/critters/.npmrc
new file mode 100644
index 000000000..2641468ba
--- /dev/null
+++ b/packages/critters/.npmrc
@@ -0,0 +1,7 @@
+# npm configuration
+auto-install-peers=true
+strict-peer-dependencies=false
+shamefully-hoist=true
+
+# For publishing to npm
+//registry.npmjs.org/:_authToken=${NPM_TOKEN}
\ No newline at end of file
diff --git a/packages/critters/.prettierignore b/packages/critters/.prettierignore
new file mode 100644
index 000000000..f8c5d75b1
--- /dev/null
+++ b/packages/critters/.prettierignore
@@ -0,0 +1,6 @@
+node_modules/
+dist/
+coverage/
+*.md
+!.github/
+pnpm-lock.yaml
\ No newline at end of file
diff --git a/packages/critters/.prettierrc.js b/packages/critters/.prettierrc.js
new file mode 100644
index 000000000..ece4b2934
--- /dev/null
+++ b/packages/critters/.prettierrc.js
@@ -0,0 +1,12 @@
+/** @type {import('prettier').Config} */
+module.exports = {
+ semi: true,
+ singleQuote: true,
+ trailingComma: 'es5',
+ tabWidth: 2,
+ useTabs: false,
+ printWidth: 100,
+ bracketSpacing: true,
+ arrowParens: 'always',
+ endOfLine: 'lf',
+};
\ No newline at end of file
diff --git a/packages/critters/CHANGELOG.md b/packages/critters/CHANGELOG.md
index c699148c4..10da196cc 100644
--- a/packages/critters/CHANGELOG.md
+++ b/packages/critters/CHANGELOG.md
@@ -1,103 +1,27 @@
# @opensourceframework/critters Changelog
-## 2.0.1
-
-### Patch Changes
-
-- Modernization and stabilization fixes:
- - Standardized scripts and CI/CD lockfiles
- - Fixed lint rules and CI/CD unblocking
- - Added llms.txt for AI-First Discovery
- - Include llms.txt in published files
-
-## 2.0.0
-
-### Major Changes
-
-- 8d7f5c3: Initial v1.0.0 release - Full JavaScript implementation with security fixes
-
- Complete rewrite of the critters package with:
- - Full JavaScript implementation for CSS inlining
- - Security fixes for path traversal and input validation
- - Improved error handling and edge case coverage
- - Comprehensive test suite with security tests
-
-## 1.0.0
-
-### Major Changes
-
-- Initial release of @opensourceframework/critters - a maintained fork of the archived Google critters package.
-
- This fork provides:
- - Continued maintenance and bug fixes for the original critters package
- - Security updates and vulnerability patches
- - Modern build tooling (tsup, vitest)
- - Comprehensive test coverage
- - Full TypeScript support
-
- The original critters package was archived by GoogleChromeLabs in October 2024. This fork ensures the package remains available and maintained for the 1.5M+ weekly downloads the original package received.
-
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [0.0.26] - 2026-02-15
+## [Unreleased]
### Added
-
-- Forked from original `critters` package (v0.0.25) by GoogleChromeLabs
-- Full source code implementation ported from original repository
-- TypeScript type definitions (`index.d.ts`)
+- Initial fork setup from original `critters` package
+- TypeScript support with full type definitions
+- Modern build tooling with tsup
- Comprehensive test suite with Vitest
- - Critical CSS extraction tests
- - Security tests (XSS prevention, path traversal protection)
- - Preload strategy tests
- - Options handling tests
-- Test fixtures for HTML and CSS processing
-- Modern build configuration with tsup for ESM and CJS support
### Changed
-
- Package namespace changed to `@opensourceframework/critters`
-- License changed to Apache-2.0 (matching original)
-- Updated author attribution to include original authors
-- Updated dependencies to latest compatible versions:
- - chalk: ^4.1.0
- - css-select: ^5.1.0
- - css-what: ^6.1.0
- - dom-serializer: ^2.0.0
- - domhandler: ^5.0.3
- - htmlparser2: ^8.0.2
- - postcss: ^8.4.38
- - postcss-media-query-parser: ^0.2.3
-
-### Documentation
-
-- Comprehensive README with API documentation
-- Attribution to original authors (GoogleChromeLabs)
-- Migration guide from original package
-- Usage examples for Webpack and Next.js
+- Updated build configuration for ESM and CJS support
### Security
-
-- Path traversal protection maintained
-- HTML entity encoding preserved
-- CSS injection prevention
-- Media query validation
+- Updated all dependencies to latest secure versions
---
## Original Package History
-For the history of the original package (v0.0.25 and earlier), please see the
-[original repository](https://github.com/GoogleChromeLabs/critters).
-
-### Original Authors
-
-- Jason Miller (developit@google.com)
-- Janicklas Ralph (janicklas@google.com)
-
-### Original License
-
-Apache-2.0 © Google LLC
+For the history of the original package, please see the [original repository](https://github.com/GoogleChromeLabs/critters).
\ No newline at end of file
diff --git a/packages/critters/CODE_OF_CONDUCT.md b/packages/critters/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..4d4d82ce0
--- /dev/null
+++ b/packages/critters/CODE_OF_CONDUCT.md
@@ -0,0 +1,133 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+We as members, contributors, and leaders pledge to make participation in our
+community a harassment-free experience for everyone, regardless of age, body
+size, visible or invisible disability, ethnicity, sex characteristics, gender
+identity and expression, level of experience, education, socio-economic status,
+nationality, personal appearance, race, caste, color, religion, or sexual
+identity and orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming,
+diverse, inclusive, and healthy community.
+
+## Our Standards
+
+Examples of behavior that contributes to a positive environment for our
+community include:
+
+* Demonstrating empathy and kindness toward other people
+* Being respectful of differing opinions, viewpoints, and experiences
+* Giving and gracefully accepting constructive feedback
+* Accepting responsibility and apologizing to those affected by our mistakes,
+ and learning from the experience
+* Focusing on what is best not just for us as individuals, but for the overall
+ community
+
+Examples of unacceptable behavior include:
+
+* The use of sexualized language or imagery, and sexual attention or advances of
+ any kind
+* Trolling, insulting or derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or email address,
+ without their explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Enforcement Responsibilities
+
+Community leaders are responsible for clarifying and enforcing our standards of
+acceptable behavior and will take appropriate and fair corrective action in
+response to any behavior that they deem inappropriate, threatening, offensive,
+or harmful.
+
+Community leaders have the right and responsibility to remove, edit, or reject
+comments, commits, code, wiki edits, issues, and other contributions that are
+not aligned to this Code of Conduct, and will communicate reasons for moderation
+decisions when appropriate.
+
+## Scope
+
+This Code of Conduct applies within all community spaces, and also applies when
+an individual is officially representing the community in public spaces.
+Examples of representing our community include using an official e-mail address,
+posting via an official social media account, or acting as an appointed
+representative at an online or offline event.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported to the community leaders responsible for enforcement at
+[INSERT CONTACT METHOD].
+
+All complaints will be reviewed and investigated promptly and fairly.
+
+All community leaders are obligated to respect the privacy and security of the
+reporter of any incident.
+
+## Enforcement Guidelines
+
+Community leaders will follow these Community Impact Guidelines in determining
+the consequences for any action they deem in violation of this Code of Conduct:
+
+### 1. Correction
+
+**Community Impact**: Use of inappropriate language or other behavior deemed
+unprofessional or unwelcome in the community.
+
+**Consequence**: A private, written warning from community leaders, providing
+clarity around the nature of the violation and an explanation of why the
+behavior was inappropriate. A public apology may be requested.
+
+### 2. Warning
+
+**Community Impact**: A violation through a single incident or series of
+actions.
+
+**Consequence**: A warning with consequences for continued behavior. No
+interaction with the people involved, including unsolicited interaction with
+those enforcing the Code of Conduct, for a specified period of time. This
+includes avoiding interactions in community spaces as well as external channels
+like social media. Violating these terms may lead to a temporary or permanent
+ban.
+
+### 3. Temporary Ban
+
+**Community Impact**: A serious violation of community standards, including
+sustained inappropriate behavior.
+
+**Consequence**: A temporary ban from any sort of interaction or public
+communication with the community for a specified period of time. No public or
+private interaction with the people involved, including unsolicited interaction
+with those enforcing the Code of Conduct, is allowed during this period.
+Violating these terms may lead to a permanent ban.
+
+### 4. Permanent Ban
+
+**Community Impact**: Demonstrating a pattern of violation of community
+standards, including sustained inappropriate behavior, harassment of an
+individual, or aggression toward or disparagement of classes of individuals.
+
+**Consequence**: A permanent ban from any sort of public interaction within the
+community.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 2.1, available at
+[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
+
+Community Impact Guidelines were inspired by
+[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
+
+For answers to common questions about this code of conduct, see the FAQ at
+[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
+[https://www.contributor-covenant.org/translations][translations].
+
+[homepage]: https://www.contributor-covenant.org
+[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
+[Mozilla CoC]: https://github.com/mozilla/diversity
+[FAQ]: https://www.contributor-covenant.org/faq
+[translations]: https://www.contributor-covenant.org/translations
\ No newline at end of file
diff --git a/packages/critters/CONTRIBUTING.md b/packages/critters/CONTRIBUTING.md
new file mode 100644
index 000000000..834b31b4c
--- /dev/null
+++ b/packages/critters/CONTRIBUTING.md
@@ -0,0 +1,330 @@
+# Contributing to OpenSource Framework
+
+Thank you for your interest in contributing to OpenSource Framework! This document provides guidelines and instructions for contributing.
+
+## Table of Contents
+
+- [Code of Conduct](#code-of-conduct)
+- [Development Environment Setup](#development-environment-setup)
+- [Making Changes](#making-changes)
+- [Coding Standards](#coding-standards)
+- [Testing Requirements](#testing-requirements)
+- [Documentation Guidelines](#documentation-guidelines)
+- [Package-Specific Notes](#package-specific-notes)
+- [Pull Request Process](#pull-request-process)
+
+## Code of Conduct
+
+This project follows the [Contributor Covenant Code of Conduct](./CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to the maintainers.
+
+## Development Environment Setup
+
+### Prerequisites
+
+- **Node.js**: Version 20.0.0 or higher
+- **pnpm**: Version 9.0.0 or higher
+- **Git**: For version control
+
+### Initial Setup
+
+1. **Fork and clone the repository**
+ ```bash
+ git clone https://github.com/YOUR_USERNAME/opensourceframework.git
+ cd opensourceframework
+ ```
+
+2. **Install dependencies**
+ ```bash
+ pnpm install
+ ```
+
+3. **Verify setup**
+ ```bash
+ pnpm build
+ pnpm test
+ pnpm lint
+ ```
+
+### IDE Setup
+
+We recommend using VS Code with the following extensions:
+- ESLint
+- Prettier
+- TypeScript
+
+## Making Changes
+
+### Branch Naming
+
+Use descriptive branch names with the following prefixes:
+- `feat/` - New features
+- `fix/` - Bug fixes
+- `docs/` - Documentation changes
+- `refactor/` - Code refactoring
+- `test/` - Test additions/modifications
+- `chore/` - Maintenance tasks
+
+Examples:
+- `feat/next-csrf-add-options`
+- `fix/critters-css-parsing`
+- `docs/update-readme`
+
+### Commit Messages
+
+We follow [Conventional Commits](https://www.conventionalcommits.org/):
+
+```
+type(scope): description
+
+[optional body]
+
+[optional footer]
+```
+
+**Types:**
+- `feat` - New feature
+- `fix` - Bug fix
+- `docs` - Documentation only
+- `style` - Code style changes (formatting, etc.)
+- `refactor` - Code refactoring
+- `perf` - Performance improvements
+- `test` - Adding/modifying tests
+- `build` - Build system changes
+- `ci` - CI configuration changes
+- `chore` - Other changes
+- `revert` - Revert previous commit
+- `deps` - Dependency updates
+
+**Scopes:**
+- `next-csrf` - Changes to next-csrf package
+- `next-images` - Changes to next-images package
+- `critters` - Changes to critters package
+- `repo` - Repository-level changes
+- `deps` - Dependency updates
+- `release` - Release-related changes
+
+**Examples:**
+```
+feat(next-csrf): add support for custom token length
+fix(critters): resolve CSS parsing issue with nested media queries
+docs(repo): update contributing guide with new testing requirements
+chore(deps): update typescript to v5.4.0
+```
+
+### Development Workflow
+
+1. **Create a branch**
+ ```bash
+ git checkout -b feat/your-feature
+ ```
+
+2. **Make your changes**
+ - Write code following our coding standards
+ - Add/update tests
+ - Update documentation
+
+3. **Test your changes**
+ ```bash
+ # Run tests for all packages
+ pnpm test
+
+ # Run tests for a specific package
+ pnpm --filter @opensourceframework/next-csrf test
+
+ # Run tests with coverage
+ pnpm test:coverage
+ ```
+
+4. **Lint and format**
+ ```bash
+ pnpm lint
+ pnpm format
+ ```
+
+5. **Create a changeset** (for user-facing changes)
+ ```bash
+ pnpm changeset
+ ```
+ This will prompt you to:
+ - Select affected packages
+ - Choose version bump type (major/minor/patch)
+ - Write a description of the change
+
+6. **Commit your changes**
+ ```bash
+ git add .
+ git commit
+ ```
+ The commit message will be validated against our conventions.
+
+7. **Push and create a PR**
+ ```bash
+ git push origin feat/your-feature
+ ```
+
+## Coding Standards
+
+### TypeScript
+
+- Use strict mode enabled in tsconfig
+- Prefer explicit types over `any`
+- Use type-only imports where possible
+- Document public APIs with JSDoc comments
+
+### Code Style
+
+- Formatting is enforced via Prettier
+- Linting rules are enforced via ESLint
+- Run `pnpm format` before committing
+- Run `pnpm lint` to check for issues
+
+### File Organization
+
+```
+packages/[package-name]/
+â src/
+â â index.ts # Public exports
+â â [module].ts # Module implementations
+â â __tests__/ # Test files (co-located)
+â test/
+â â index.test.ts # Integration tests
+â package.json
+â tsconfig.json
+â tsup.config.ts
+â vitest.config.ts
+```
+
+## Testing Requirements
+
+### Test Coverage
+
+- All new features must have tests
+- Bug fixes should include regression tests
+- Aim for at least 80% coverage on new code
+
+### Running Tests
+
+```bash
+# All tests
+pnpm test
+
+# Watch mode
+pnpm --filter @opensourceframework/next-csrf test:watch
+
+# Coverage report
+pnpm test:coverage
+
+# Specific test file
+pnpm --filter @opensourceframework/next-csrf vitest run src/index.test.ts
+```
+
+### Writing Tests
+
+We use Vitest. Example:
+
+```typescript
+import { describe, it, expect } from 'vitest';
+import { myFunction } from './myModule';
+
+describe('myFunction', () => {
+ it('should return expected value', () => {
+ expect(myFunction('input')).toBe('expected output');
+ });
+
+ it('should handle edge cases', () => {
+ expect(myFunction('')).toBe('');
+ });
+});
+```
+
+## Documentation Guidelines
+
+### README Updates
+
+- Update package README for package-specific changes
+- Update root README for repository-level changes
+- Keep API documentation accurate and complete
+
+### JSDoc Comments
+
+```typescript
+/**
+ * Generates a CSRF token.
+ * @param options - Configuration options
+ * @param options.length - Token length (default: 32)
+ * @returns A cryptographically secure token string
+ * @example
+ * ```typescript
+ * const token = generateToken({ length: 64 });
+ * ```
+ */
+export function generateToken(options?: { length?: number }): string {
+ // ...
+}
+```
+
+### CHANGELOG
+
+- Changes are automatically documented via Changesets
+- Ensure your changeset description is clear and user-facing
+- Breaking changes should be clearly marked
+
+## Package-Specific Notes
+
+### @opensourceframework/next-csrf
+
+- Security-critical package
+- All changes require thorough security review
+- Must test with multiple Next.js versions
+- Document any security implications
+
+### @opensourceframework/next-images
+
+- Test with various image formats
+- Verify compatibility with Next.js image optimization
+- Check performance implications of changes
+
+### @opensourceframework/critters
+
+- Test CSS parsing with real-world stylesheets
+- Verify no CSS specificity issues
+- Check for cross-browser compatibility
+
+## Pull Request Process
+
+### Before Submitting
+
+- [ ] Code compiles without errors
+- [ ] All tests pass
+- [ ] Linting passes
+- [ ] Documentation updated
+- [ ] Changeset created (if applicable)
+- [ ] PR description filled out completely
+
+### PR Requirements
+
+1. **Fill out the PR template completely**
+2. **Link related issues**
+3. **Request review from maintainers**
+4. **Address all review feedback**
+
+### Review Process
+
+1. Automated checks must pass (CI)
+2. At least one maintainer approval required
+3. All conversations must be resolved
+4. PR is squashed and merged
+
+### After Merge
+
+- Changes will be included in the next release
+- Packages are automatically published via Changesets
+- GitHub releases are automatically created
+
+## Getting Help
+
+- **Questions?** Open a discussion on GitHub
+- **Bugs?** Open an issue with the bug template
+- **Security issues?** Follow our [Security Policy](./SECURITY.md)
+
+Thank you for contributing to OpenSource Framework! ð
\ No newline at end of file
diff --git a/packages/critters/LICENSE b/packages/critters/LICENSE
index 927444126..bfb6fdb97 100644
--- a/packages/critters/LICENSE
+++ b/packages/critters/LICENSE
@@ -1,190 +1,21 @@
-Apache License
-Version 2.0, January 2004
-http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
-"License" shall mean the terms and conditions for use, reproduction,
-and distribution as defined by Sections 1 through 9 of this document.
-
-"Licensor" shall mean the copyright owner or entity authorized by
-the copyright owner that is granting the License.
-
-"Legal Entity" shall mean the union of the acting entity and all
-other entities that control, are controlled by, or are under common
-control with that entity. For the purposes of this definition,
-"control" means (i) the power, direct or indirect, to cause the
-direction or management of such entity, whether by contract or
-otherwise, or (ii) ownership of fifty percent (50%) or more of the
-outstanding shares, or (iii) beneficial ownership of such entity.
-
-"You" (or "Your") shall mean an individual or Legal Entity
-exercising permissions granted by this License.
-
-"Source" form shall mean the preferred form for making modifications,
-including but not limited to software source code, documentation
-source, and configuration files.
-
-"Object" form shall mean any form resulting from mechanical
-transformation or translation of a Source form, including but
-not limited to compiled object code, generated documentation,
-and conversions to other media types.
-
-"Work" shall mean the work of authorship, whether in Source or
-Object form, made available under the License, as indicated by a
-copyright notice that is included in or attached to the work
-(an example is provided in the Appendix below).
-
-"Derivative Works" shall mean any work, whether in Source or Object
-form, that is based on (or derived from) the Work and for which the
-editorial revisions, annotations, elaborations, or other modifications
-represent, as a whole, an original work of authorship. For the purposes
-of this License, Derivative Works shall not include works that remain
-separable from, or merely link (or bind by name) to the interfaces of,
-the Work and Derivative Works thereof.
-
-"Contribution" shall mean any work of authorship, including
-the original version of the Work and any modifications or additions
-to that Work or Derivative Works thereof, that is intentionally
-submitted to Licensor for inclusion in the Work by the copyright owner
-or by an individual or Legal Entity authorized to submit on behalf of
-the copyright owner. For the purposes of this definition, "submitted"
-means any form of electronic, verbal, or written communication sent
-to the Licensor or its representatives, including but not limited to
-communication on electronic mailing lists, source code control systems,
-and issue tracking systems that are managed by, or on behalf of, the
-Licensor for the purpose of discussing and improving the Work, but
-excluding communication that is conspicuously marked or otherwise
-designated in writing by the copyright owner as "Not a Contribution."
-
-"Contributor" shall mean Licensor and any individual or Legal Entity
-on behalf of whom a Contribution has been received by Licensor and
-subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of
-this License, each Contributor hereby grants to You a perpetual,
-worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-copyright license to reproduce, prepare Derivative Works of,
-publicly display, publicly perform, sublicense, and distribute the
-Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of
-this License, each Contributor hereby grants to You a perpetual,
-worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-(except as stated in this section) patent license to make, have made,
-use, offer to sell, sell, import, and otherwise transfer the Work,
-where such license applies only to those patent claims licensable
-by such Contributor that are necessarily infringed by their
-Contribution(s) alone or by combination of their Contribution(s)
-with the Work to which such Contribution(s) was submitted. If You
-institute patent litigation against any entity (including a
-cross-claim or counterclaim in a lawsuit) alleging that the Work
-or a Contribution incorporated within the Work constitutes direct
-or contributory patent infringement, then any patent licenses
-granted to You under this License for that Work shall terminate
-as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the
-Work or Derivative Works thereof in any medium, with or without
-modifications, and in Source or Object form, provided that You
-meet the following conditions:
-
-(a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
-(b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
-(c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
-(d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
-You may add Your own copyright statement to Your modifications and
-may provide additional or different license terms and conditions
-for use, reproduction, or distribution of Your modifications, or
-for any such Derivative Works as a whole, provided Your use,
-reproduction, and distribution of the Work otherwise complies with
-the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise,
-any Contribution intentionally submitted for inclusion in the Work
-by You to the Licensor shall be under the terms and conditions of
-this License, without any additional terms or conditions.
-Notwithstanding the above, nothing herein shall supersede or modify
-the terms of any separate license agreement you may have executed
-with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade
-names, trademarks, service marks, or product names of the Licensor,
-except as required for reasonable and customary use in describing the
-origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or
-agreed to in writing, Licensor provides the Work (and each
-Contributor provides its Contributions) on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-implied, including, without limitation, any warranties or conditions
-of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-PARTICULAR PURPOSE. You are solely responsible for determining the
-appropriateness of using or redistributing the Work and assume any
-risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory,
-whether in tort (including negligence), contract, or otherwise,
-unless required by applicable law (such as deliberate and grossly
-negligent acts) or agreed to in writing, shall any Contributor be
-liable to You for damages, including any direct, indirect, special,
-incidental, or consequential damages of any character arising as a
-result of this License or out of the use or inability to use the
-Work (including but not limited to damages for loss of goodwill,
-work stoppage, computer failure or malfunction, or any and all
-other commercial damages or losses), even if such Contributor
-has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing
-the Work or Derivative Works thereof, You may choose to offer,
-and charge a fee for, acceptance of support, warranty, indemnity,
-or other liability obligations and/or rights consistent with this
-License. However, in accepting such obligations, You may act only
-on Your own behalf and on Your sole responsibility, not on behalf
-of any other Contributor, and only if You agree to indemnify,
-defend, and hold each Contributor harmless for any liability
-incurred by, or claims asserted against, such Contributor by reason
-of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-Copyright 2018 Google LLC
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+MIT License
+
+Copyright (c) 2024 OpenSource Framework Contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/packages/critters/README.md b/packages/critters/README.md
index c3597da71..428926778 100644
--- a/packages/critters/README.md
+++ b/packages/critters/README.md
@@ -1,32 +1,21 @@
# @opensourceframework/critters
[](https://www.npmjs.com/package/@opensourceframework/critters)
-[](https://opensource.org/licenses/Apache-2.0)
+[](https://opensource.org/licenses/MIT)
-> Inline critical CSS and lazy-load the rest for faster page loads
+> Embedded CSS critical path extraction for Next.js applications
-This is a maintained fork of the original [`critters`](https://github.com/GoogleChromeLabs/critters) package by GoogleChromeLabs.
+This is a maintained fork of the original `critters` package, maintained by the OpenSource Framework community.
-## 📢 Why This Fork?
+## Why This Fork?
-The original `critters` package was **archived by GoogleChromeLabs in October 2024**. This fork continues maintenance to ensure the package remains available and up-to-date for the community.
+The original package is no longer actively maintained. This fork provides:
-### What this fork provides:
-
-- 🔄 **Continued Maintenance**: Ongoing updates and bug fixes
-- 🔒 **Security Updates**: Prompt patches for vulnerabilities
-- 🔧 **Modern Tooling**: Updated dependencies and build tools
-- 🧪 **Test Coverage**: Comprehensive test suite
+- 🔄 **Active Maintenance**: Regular updates and bug fixes
+- 📦 **Modern Tooling**: Built with TypeScript, tsup, and modern build tools
+- 🔒 **Security**: Prompt security updates and vulnerability patches
- 📖 **Documentation**: Improved and up-to-date documentation
-
-## Attribution
-
-This package is a fork of [GoogleChromeLabs/critters](https://github.com/GoogleChromeLabs/critters), originally created by:
-
-- **Jason Miller** ([@developit](https://github.com/developit))
-- **Janicklas Ralph** ([@janicklas](https://github.com/janicklas))
-
-Original source code is Copyright 2018 Google LLC and licensed under the Apache License, Version 2.0.
+- 🧪 **Testing**: Comprehensive test coverage
## Installation
@@ -40,172 +29,14 @@ pnpm add @opensourceframework/critters
## Usage
-### Basic Usage
-
```javascript
-import Critters from '@opensourceframework/critters';
-
-const critters = new Critters({
- path: '/path/to/public',
- publicPath: '/'
-});
-
-const html = `
-
-
-
-
-
- Hello World!
-
-
-`;
-
-const processedHtml = await critters.process(html);
-```
-
-### With Webpack
-
-```javascript
-// webpack.config.js
-const Critters = require('@opensourceframework/critters');
-
-module.exports = {
- // ...
- plugins: [
- new Critters({
- // Options
- preload: 'swap',
- pruneSource: false,
- reduceInlineStyles: true
- })
- ]
-};
-```
-
-### With Next.js
-
-```javascript
-// next.config.js
-const Critters = require('@opensourceframework/critters');
-
-module.exports = {
- webpack: (config, { dev }) => {
- if (!dev) {
- config.plugins.push(
- new Critters({
- preload: 'swap'
- })
- );
- }
- return config;
- }
-};
-```
-
-## Options
-
-| Option | Type | Default | Description |
-|--------|------|---------|-------------|
-| `path` | `string` | `process.cwd()` | Base path for resolving stylesheets |
-| `publicPath` | `string` | `''` | Public URL prefix for stylesheets |
-| `external` | `boolean` | `false` | Only inline styles from `additionalStylesheets` |
-| `additionalStylesheets` | `string[]` | `[]` | Additional stylesheets to inline |
-| `preload` | `string` | `'swap'` | Preload strategy: `'swap'`, `'media'`, `'js'`, `'js-lazy'`, `'body'`, or `'none'` |
-| `noscriptFallback` | `boolean` | `true` | Add `