Skip to content

add script load time script to readme, add .gitignore for testing file#4

Merged
nucliweb merged 2 commits into
mainfrom
first-third-extra
Jun 1, 2022
Merged

add script load time script to readme, add .gitignore for testing file#4
nucliweb merged 2 commits into
mainfrom
first-third-extra

Conversation

@jhadev

@jhadev jhadev commented May 31, 2022

Copy link
Copy Markdown
Contributor

Might need another eye both with output and presentation but it works well for me.
Thanks,
Josh

Was going for this -
https://developer.mozilla.org/en-US/docs/Web/API/Resource_Timing_API/Using_the_Resource_Timing_API#timing_resource_loading_phases

@jhadev jhadev added the enhancement New feature or request label May 31, 2022
@jhadev jhadev requested a review from nucliweb May 31, 2022 18:43
Comment thread .gitignore
@@ -0,0 +1 @@
testing.js No newline at end of file

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Do you have a test script?
Perhaps it would be interesting to have a test script, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have a test script I use to stay organized before it goes into the readme, its full of comments of dead code or changes i wanted to revisit.

@nucliweb

nucliweb commented Jun 1, 2022

Copy link
Copy Markdown
Owner

I can see that this PR change some code's syntax, we can add a linter rules to have the same rules when we ara working in this project. What do you think @jhadev?

@nucliweb nucliweb merged commit 005da79 into main Jun 1, 2022
@nucliweb nucliweb deleted the first-third-extra branch June 1, 2022 10:09
@jhadev

jhadev commented Jun 1, 2022

Copy link
Copy Markdown
Contributor Author

I can see that this PR change some code's syntax, we can add a linter rules to have the same rules when we ara working in this project. What do you think @jhadev?

Yes that was my fault. I used a different formatter by accident. The linter is up to you, I'm not sure what caused this. I always use prettier though.

nucliweb added a commit that referenced this pull request Feb 12, 2026
Validate-Preload-Async-Defer-Scripts:
- Add missing fetchpriority="low" to <link rel=preload> tag in Solution 1
  This was a correctness bug - preload without fetchpriority="low" still
  escalates network priority even if script tag has fetchpriority="low"

Prefetch-Resource-Validation (comprehensive improvements):

Performance optimizations:
- Pre-normalize all URLs once into a Map (eliminates O(N×M) URL parsing)
- Use pre-built URL map for all matching operations
- Remove redundant URL parsing in nested loops
- Performance improvement: ~6000 URL objects → ~200 for typical cases

New validations:
- Detect invalid 'as' attribute values (typos like as="scriptt")
- Detect duplicate prefetch hints (same URL prefetched multiple times)
- Warn about large scripts (>1MB threshold, was missing)
- Validate 'as' attribute against list of valid values

Improved logic:
- Better cache detection: distinguish "cached" vs "unknown (CORS)"
  Handles case where CORS blocks timing info (both sizes === 0)
- Fixed inappropriateTypes to check scripts and provide detailed reasons
- Optimized isCurrentPageResource check to use pre-built map
- Added seenUrls Set to track duplicates

Code quality:
- Added validAsValues Set with all valid 'as' attribute values
- Added THRESHOLDS.largeScriptSize (1MB) for script-specific checks
- Better error messages with specific size/reason for inappropriateness
- Comments explaining CORS edge cases and validation logic

Documentation updates:
- Added "Invalid as", "Duplicate prefetch" to issue categories table
- Updated "Inappropriate type" description to mention scripts
- Cache status can now show "unknown (CORS)" in output

Addresses issues from comprehensive code review:
- URL matching performance (#8, #9 from analysis)
- Invalid 'as' validation (#7)
- Duplicate detection (#14)
- Large script detection (#4)
- Cache detection for CORS (#3)
- Current page detection optimization (#6)
nucliweb added a commit that referenced this pull request Feb 25, 2026
add script load time script to readme, add .gitignore for testing file
nucliweb added a commit that referenced this pull request Feb 25, 2026
Validate-Preload-Async-Defer-Scripts:
- Add missing fetchpriority="low" to <link rel=preload> tag in Solution 1
  This was a correctness bug - preload without fetchpriority="low" still
  escalates network priority even if script tag has fetchpriority="low"

Prefetch-Resource-Validation (comprehensive improvements):

Performance optimizations:
- Pre-normalize all URLs once into a Map (eliminates O(N×M) URL parsing)
- Use pre-built URL map for all matching operations
- Remove redundant URL parsing in nested loops
- Performance improvement: ~6000 URL objects → ~200 for typical cases

New validations:
- Detect invalid 'as' attribute values (typos like as="scriptt")
- Detect duplicate prefetch hints (same URL prefetched multiple times)
- Warn about large scripts (>1MB threshold, was missing)
- Validate 'as' attribute against list of valid values

Improved logic:
- Better cache detection: distinguish "cached" vs "unknown (CORS)"
  Handles case where CORS blocks timing info (both sizes === 0)
- Fixed inappropriateTypes to check scripts and provide detailed reasons
- Optimized isCurrentPageResource check to use pre-built map
- Added seenUrls Set to track duplicates

Code quality:
- Added validAsValues Set with all valid 'as' attribute values
- Added THRESHOLDS.largeScriptSize (1MB) for script-specific checks
- Better error messages with specific size/reason for inappropriateness
- Comments explaining CORS edge cases and validation logic

Documentation updates:
- Added "Invalid as", "Duplicate prefetch" to issue categories table
- Updated "Inappropriate type" description to mention scripts
- Cache status can now show "unknown (CORS)" in output

Addresses issues from comprehensive code review:
- URL matching performance (#8, #9 from analysis)
- Invalid 'as' validation (#7)
- Duplicate detection (#14)
- Large script detection (#4)
- Cache detection for CORS (#3)
- Current page detection optimization (#6)
nucliweb added a commit that referenced this pull request Feb 25, 2026
Documents completed and pending tasks for CLI and Playwright integration:
- Task #1-3: Completed (tests, monorepo, commands)
- Task #4-5: Pending (E2E testing, npm publishing)

Includes detailed checklists, architecture overview, and development commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants